Compare commits

...

36 Commits

Author SHA1 Message Date
Adam Štrauch 07c9d923bb
Fix
Test build / build (push) Failing after 5s Details
2023-11-26 03:24:22 +01:00
Adam Štrauch 047f922fae
Update pipeline
Test build / build (push) Failing after 6s Details
2023-11-26 03:20:00 +01:00
Adam Štrauch ebfc74b9e3
Builder 38
Test build / build-test (push) Failing after 4m48s Details
2023-11-26 03:03:41 +01:00
Adam Štrauch 9bd5aefd76
Build test pipeline
Test build / build-test (push) Failing after 4s Details
2023-11-26 03:02:55 +01:00
Adam Štrauch c397e365dc
Test build pipeline
Test build / build (push) Successful in 57s Details
Image testing / tests (push) Has been cancelled Details
2023-11-26 02:53:10 +01:00
Adam Štrauch 73b5ce09e3
Test pipeline 2023-11-26 02:52:15 +01:00
Adam Štrauch 940d2b7f01
Passenger for Ruby
continuous-integration/drone/push Build is failing Details
2023-11-25 03:00:21 +01:00
Adam Štrauch bef7e0a2c7
2023.12-1 updated versions of all supported techs
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is failing Details
2023-11-21 01:05:16 +01:00
Adam Štrauch 488cea48af
Fix redis config
continuous-integration/drone/push Build is failing Details
2023-10-27 00:55:12 +02:00
Adam Štrauch 27c6165dd0
Fix default versions
continuous-integration/drone Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-12 21:34:03 +02:00
Adam Štrauch 3583913038
Fix python 2
continuous-integration/drone Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
2023-08-12 17:15:01 +02:00
Adam Štrauch 83d43a4121
Fix python
continuous-integration/drone Build is failing Details
2023-08-12 16:18:25 +02:00
Adam Štrauch fe72c1a797
Back to the original builder image
continuous-integration/drone Build is failing Details
2023-08-12 14:44:11 +02:00
Adam Štrauch c5801364d1
Fix builder image registry
continuous-integration/drone Build encountered an error Details
2023-08-12 14:24:18 +02:00
Adam Štrauch 82c648b7cd
Debian 12, new version of everything, switch to task
continuous-integration/drone Build encountered an error Details
2023-08-12 14:16:21 +02:00
Adam Štrauch 2c9ee0c3a7
Switch to Debian 12
continuous-integration/drone/push Build is failing Details
2023-06-10 17:05:21 +02:00
Adam Štrauch 7808e5062c
Update of techs, new version 2023.04-1
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/promote/production Build is passing Details
continuous-integration/drone/tag Build was killed Details
2023-04-12 13:26:54 +02:00
Adam Štrauch 4d804760cd
Enable imagick in php8
continuous-integration/drone/push Build is passing Details
2023-04-11 21:55:05 +02:00
Adam Štrauch 7e09a0b778
Fix PHP deploy
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2023-02-03 18:24:39 +01:00
Adam Štrauch d2333b2b3a
Version 2023.2-1, new Deno and Node, PHP fix, admin versions generator
continuous-integration/drone/push Build is failing Details
2023-02-03 17:46:51 +01:00
Adam Štrauch 631ad0c859
Fix of rosti
continuous-integration/drone/push Build is failing Details
* Default app works
* static tech = default tech
* cancel fixed
2023-02-02 23:19:31 +01:00
Adam Štrauch cd028c9e32
Fix node.js default version
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2023-01-24 23:32:39 +01:00
Adam Štrauch 4cb5bc17c9
2023.01-1: mongodb PHP extension
continuous-integration/drone/push Build was killed Details
continuous-integration/drone Build is passing Details
2023-01-12 16:46:33 +01:00
Adam Štrauch 9aef3650a9
Fix PHP builds
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
continuous-integration/drone/tag Build was killed Details
2022-12-29 09:07:45 +01:00
Adam Štrauch 9a4cf65c49
Add missing dep: libc-client-dev
continuous-integration/drone/push Build is failing Details
2022-12-27 12:02:37 +01:00
Adam Štrauch 69f856c3e0
Initial commit for 2022.12-1
continuous-integration/drone/push Build is failing Details
2022-12-27 11:47:03 +01:00
Adam Štrauch 446ae70e0e
Fix ssh-copy-id helper
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build was killed Details
2022-05-11 10:50:23 +02:00
Adam Štrauch f3a256f8d6
Default app fix
continuous-integration/drone/push Build is passing Details
2022-05-02 13:57:24 +02:00
Adam Štrauch 6d48a9e9f4
Default versions updated
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2022-04-25 02:41:20 +02:00
Adam Štrauch 00a0d64292
Version bumb
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2022-04-24 15:36:11 +02:00
Adam Štrauch 3ce7a5e7bc
New version of techs
continuous-integration/drone/push Build was killed Details
Python 3.10.4
PHP 8.0.18
PHP 8.1.5
Ruby 3.1.2
Deno 1.21.0
Node.js 16.14.2
Node.js 18.0.0
2022-04-24 14:55:55 +02:00
Adam Štrauch 3430a80d0b
Merge test build with test steps
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details
2021-12-04 16:25:58 +01:00
Adam Štrauch 76f7d9118b
fix test typo
continuous-integration/drone/push Build is failing Details
2021-12-04 14:49:28 +01:00
Adam Štrauch dcaef2db71
Dynamic testing
continuous-integration/drone/push Build is failing Details
2021-12-04 00:58:15 +01:00
Adam Štrauch ff74d2b9cb
Fix
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is passing Details
2021-12-03 20:20:43 +01:00
Adam Štrauch e8fbeeba3c
Version 2022.01-1
continuous-integration/drone/push Build is failing Details
* Debian Bullseye
* New tech version:

Node.js 14.18.1
Node.js 15.14.0
Node.js 16.13.0
Node.js 17.1.0
Python 3.9.7
Python 3.10.0
PHP 7.4.23
PHP 7.4.26
PHP 8.0.13
Ruby 2.7.4
Ruby 3.0.2
Deno 1.16.2

Requested ed25519 support included in dropbear.
2021-12-03 18:58:56 +01:00
20 changed files with 349 additions and 363 deletions

View File

@ -4,7 +4,7 @@ name: image building
steps:
- name: build&push squashed image
image: harbor.hq.rosti.cz/library/builder:35
image: harbor.hq.rosti.cz/library/builder:39
environment:
username: robot$rosti+rosti
password:
@ -13,7 +13,7 @@ steps:
privileged: true
commands:
- echo "$password" | podman login -u $username --password-stdin $repo
- make DOCKER=podman push
- task push
trigger:
event:
@ -25,11 +25,11 @@ trigger:
kind: pipeline
type: docker
name: test image building
name: test image
steps:
- name: test build
image: harbor.hq.rosti.cz/library/builder:35
image: harbor.hq.rosti.cz/library/builder:39
environment:
username: robot$rosti+rosti
password:
@ -38,17 +38,8 @@ steps:
privileged: true
commands:
- echo "$password" | podman login -u $username --password-stdin $repo
- make VERSION=test DOCKER=podman build
- name: test image
image: harbor.hq.rosti.cz/library/builder:35
environment:
username: robot$rosti+rosti
password:
from_secret: repo_password
repo: harbor.hq.rosti.cz
privileged: true
commands:
- make DOCKER=podman VERSION=test test
- task build VERSION=test
- task test VERSION=test
trigger:
event:

29
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,29 @@
name: Test build
on:
push:
branches: [ main ]
jobs:
build:
runs-on: [moon, amd64]
container:
image: harbor.hq.rosti.cz/library/builder:38
env:
REPO: harbor.hq.rosti.cz
USERNAME: robot$rosti+rosti
# ports:
# - 80
# volumes:
# - my_docker_volume:/volume_mount
# options: --cpus 1
steps:
- uses: actions/checkout@v4
- name: Test build
run: |
echo "${{ secrets.repo_password }}" | podman login -u $USERNAME --password-stdin $REPO
# task build
# task test

View File

@ -1,14 +0,0 @@
name: Image testing
on:
- push
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: testing
run: |
make build
make test

View File

@ -1,15 +1,12 @@
FROM debian:buster
FROM debian:bookworm
RUN DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget gpg
RUN echo "deb http://deb.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://security.debian.org/debian-security buster/updates main" >> /etc/apt/sources.list && \
echo "deb http://deb.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
RUN echo "deb http://deb.debian.org/debian/ bullseye main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://security.debian.org/debian-security bullseye-security main" >> /etc/apt/sources.list && \
echo "deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free" >> /etc/apt/sources.list
RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales libffi-dev \
libssl-dev default-libmysqlclient-dev ca-certificates libpq-dev libjpeg62 libjpeg-dev \
@ -17,14 +14,14 @@ libpng-dev libpng-dev build-essential git mercurial build-essential \
libbz2-dev libsqlite3-dev libreadline-dev zlib1g-dev libncurses5-dev \
libgdbm-dev libgd-dev cron git subversion vim nano mc htop procps \
dropbear gettext wget redis-server memcached supervisor curl ssh \
mariadb-client postgresql-client-12 postgresql-12-postgis-3-scripts bind9-host dnsutils nginx \
mariadb-client postgresql-client-13 postgresql-13-postgis-3-scripts bind9-host dnsutils nginx nginx-extras libnginx-mod-http-image-filter \
libxml2-dev libxslt1-dev openssh-sftp-server links2 lynx \
imagemagick libmagick++-6.q16-dev libmagick++-6.q16hdri-dev libmagickwand-dev ncdu libsodium-dev \
python3 python3-pip python3-virtualenv \
libcurl4-openssl-dev python-dev libproj-dev gdal-bin libmemcached-dev swig mutt \
ffmpeg libyaml-dev libc-client2007e-dev libonig-dev libkrb5-dev dialog \
whiptail tmux rsync nmap libzip-dev libfreetype6-dev \
jpegoptim optipng pngquant gifsicle webp libvpx-dev libwebp-dev # User requirement (svgo not available)
jpegoptim optipng pngquant gifsicle webp libvpx-dev libwebp-dev jq inotify-tools ripgrep
WORKDIR /srv
@ -47,44 +44,43 @@ ENV TERM xterm
## Node.js
WORKDIR /usr/src
ADD build_node.sh /usr/local/bin/build_node.sh
# 2021/11
RUN build_node.sh 14.18.1
RUN build_node.sh 15.14.0
RUN build_node.sh 16.13.0
RUN build_node.sh 17.1.0
# 2023/08
RUN build_node.sh 19.9.0
RUN build_node.sh 18.17.1
RUN build_node.sh 20.5.1
RUN build_node.sh 20.9.0
RUN build_node.sh 21.2.0
## Python
WORKDIR /usr/src
ADD build_python.sh /usr/local/bin/build_python.sh
# 2020/09
RUN build_python.sh 3.9.7
# 2021/11
RUN build_python.sh 3.10.0
## PHP
WORKDIR /usr/src
ADD build_php.sh /usr/local/bin/build_php.sh
# 2021/09
RUN build_php.sh 7.4.23
# 2021/11
RUN build_php.sh 7.4.26
# 2023/08
RUN build_python.sh 3.10.12
RUN build_python.sh 3.10.13
RUN build_python.sh 3.11.4
RUN build_python.sh 3.11.6
RUN build_python.sh 3.12.0
## PHP 8
ADD build_php8.sh /usr/local/bin/build_php8.sh
# 2021/11
RUN build_php8.sh 8.0.13
# 2023/08
RUN build_php8.sh 8.1.21
RUN build_php8.sh 8.1.25
RUN build_php8.sh 8.2.7
RUN build_php8.sh 8.2.12
## Ruby
WORKDIR /usr/src
ADD build_ruby.sh /usr/local/bin/build_ruby.sh
# 2020/09
RUN build_ruby.sh 2.7.4
RUN build_ruby.sh 3.0.2
# 2023/08
RUN build_ruby.sh 3.1.4
RUN build_ruby.sh 3.2.2
## Deno
ADD build_deno.sh /usr/local/bin/build_deno.sh
# 2021/11
RUN build_deno.sh 1.16.2
# 2023/08
RUN build_deno.sh 1.36.1
RUN build_deno.sh 1.38.2
#############
@ -121,7 +117,7 @@ RUN chmod 755 /start.sh
RUN apt-get install -y fish
ADD ./gen_rosti.fish /usr/local/bin/
ADD ./rosti.sh.tmp /usr/src/
ADD ./rosti.tmpl.sh /usr/src/
ADD ./Dockerfile /usr/src/
RUN cd /usr/src && /usr/local/bin/gen_rosti.fish > /usr/local/bin/rosti && chmod 755 /usr/local/bin/rosti

View File

@ -1,21 +1,27 @@
# TODO: Unnecessary, remo this file
REPO=harbor.hq.rosti.cz/rosti/runtime
DOCKER=docker
VERSION=2021.11-1
VERSION=2023.12-1
BASEIMAGE=debian:12
all: build
build:
$(DOCKER) pull debian:buster
$(DOCKER) pull ${BASEIMAGE}
$(DOCKER) build -t ${REPO}:dev .
$(DOCKER) tag ${REPO}:dev ${REPO}:$(VERSION)
@echo "JSON for admin:"
python generate_versions.py
test:
DOCKER=$(DOCKER) fish ./tests2.fish
DOCKER=$(DOCKER) bash ./tests2.sh ${REPO}:$(VERSION)
squashed:
$(DOCKER) pull debian:buster
$(DOCKER) pull ${BASEIMAGE}
$(DOCKER) build --squash -t ${REPO}:dev-squashed .
$(DOCKER) tag ${REPO}:dev-squashed ${REPO}:$(VERSION)
@echo "JSON for admin:"
python generate_versions.py
push: squashed
$(DOCKER) push ${REPO}:$(VERSION)

39
Taskfile.yml Normal file
View File

@ -0,0 +1,39 @@
# https://taskfile.dev
version: '3'
vars:
REPO: harbor.hq.rosti.cz/rosti/runtime
VERSION: 2023.12-1
BASEIMAGE: debian:bookworm
tasks:
default:
deps:
- build
build:
cmds:
- docker pull {{ .BASEIMAGE }}
- docker build -t {{ .REPO }}:dev .
- docker tag {{ .REPO }}:dev {{ .REPO }}:{{ .VERSION }}
- echo "JSON for admin:"
- python3 generate_versions.py
test:
cmds:
- bash ./tests2.sh {{ .REPO }}:{{ .VERSION }}
squashed:
cmds:
- docker pull {{ .BASEIMAGE }}
- docker build --squash -t {{ .REPO }}:dev-squashed .
- docker tag {{ .REPO }}:dev-squashed {{ .REPO }}:{{ .VERSION }}
- echo "JSON for admin:"
- python3 generate_versions.py
push:
cmds:
- docker push {{ .REPO }}:{{ .VERSION }}
deps:
- squashed

View File

@ -12,7 +12,7 @@ wget https://www.php.net/distributions/php-$VERSION.tar.bz2
tar xf php-$VERSION.tar.bz2
rm php-$VERSION.tar.bz2
# test -e /usr/lib/x86_64-linux-gnu/libc-client.a || ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
test -e /usr/lib/x86_64-linux-gnu/libc-client.a || ln -s /usr/lib/libc-client.a /usr/lib/x86_64-linux-gnu/libc-client.a
cd php-$VERSION
./configure --enable-fpm --with-mysqli --prefix=/opt/techs/php-$VERSION \
@ -69,12 +69,14 @@ curl -s https://getcomposer.org/installer | ./php -d allow_url_fopen=On
cd -
echo "no" | /opt/techs/php-$VERSION/bin/pecl install redis
echo "no" | /opt/techs/php-$VERSION/bin/pecl install mongodb
echo "zend_extension=opcache.so" > /opt/techs/php-$VERSION/etc/conf.d/extensions.ini
echo "extension=redis.so" >> /opt/techs/php-$VERSION/etc/conf.d/extensions.ini
echo "extension=mongodb.so" >> /opt/techs/php-$VERSION/etc/conf.d/extensions.ini
# Not supported yet
# https://github.com/Imagick/imagick/issues/358
# echo "no" | /opt/techs/php-$VERSION/bin/pecl install imagick
# echo "extension=imagick.so" >> /opt/techs/php-$VERSION/etc/conf.d/extensions.ini
echo "no" | /opt/techs/php-$VERSION/bin/pecl install imagick
echo "extension=imagick.so" >> /opt/techs/php-$VERSION/etc/conf.d/extensions.ini
ln -s /srv/conf/php-fpm/php.ini /opt/techs/php-$VERSION/etc/conf.d/99-app.ini

View File

@ -18,3 +18,6 @@ cd ruby-$VERSION
./configure --prefix=/opt/techs/ruby-$VERSION
make -j
make install
/opt/techs/ruby-${VERSION}/bin/gem update --system
/opt/techs/ruby-${VERSION}/bin/gem install passenger

View File

@ -0,0 +1,10 @@
server {
listen 8000;
root /srv/app/;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}

File diff suppressed because one or more lines are too long

65
examples/ruby/index.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
[program:app]
command=/srv/bin/primary_tech/ruby app.rb
command=passenger start --port 8000 --log-file /dev/stdout --pid-file /srv/run/passenger.pid
environment=PATH="/srv/bin/primary_tech:/usr/local/bin:/usr/bin:/bin:/srv/.npm-packages/bin"
stopasgroup=true
directory=/srv/app

View File

@ -34,7 +34,7 @@ for line in (cat Dockerfile | grep "RUN build_")
echo " \"$TECH-$VERSION\" \" $TECH_VERBOSE $VERSION\" \\" >> $TECHS_FILE
end
cat rosti.sh.tmp | while read -l line
cat rosti.tmpl.sh | while read -l line
if [ "$line" = "{{TECHS}}" ]
cat $TECHS_FILE
else

38
generate_versions.py Normal file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env python
import json
import os
import subprocess
output = {
"techs": {},
"system": {
"distro": "debian",
"version": "11.6",
}
}
image = ""
with open("Dockerfile") as f:
lines = f.readlines()
for line in lines:
if line.startswith("FROM debian:"):
image = line.split(" ")[1].strip()
continue
if line.startswith("RUN build_"):
parts = line.split(" ")
name = parts[1].replace("build_", "").replace(".sh", "")
if name.startswith("php"):
name = "php"
version = line.split(" ")[2].strip()
if name not in output["techs"]:
output["techs"][name] = {
"versions": [],
}
output["techs"][name]["versions"].append(version)
# os.system(f"docker pull {image}")
system_version = subprocess.check_output(f"podman run --rm {image} cat /etc/debian_version", shell=True)
output["system"]["version"] = system_version.strip().decode()
print(json.dumps(output, indent=4))

View File

@ -2,6 +2,13 @@
. ~/.bashrc
# DEFAULT VERSIONS
VERSION_PYTHON="3.12.0"
VERSION_PHP="8.2.12"
VERSION_NODE="20.9.0"
VERSION_RUBY="3.2.2"
VERSION_DENO="1.38.2"
WIDTH=180
HEIGHT=25
@ -41,7 +48,9 @@ function setTech() {
echo "NOTE: /srv/app doesn't exists, creating it from $tech example application"
mkdir -p /srv/app
cp -a /opt/examples/$name/* /srv/app/
mv /srv/app/supervisor.conf /srv/conf/supervisor.d/$name.conf
if [ -e /srv/app/supervisor.conf ]; then
mv /srv/app/supervisor.conf /srv/conf/supervisor.d/$name.conf
fi
else
echo "IMPORTANT: /srv/app found so no configuration or files are copied, make sure the application is ok after this process"
fi
@ -76,7 +85,7 @@ function setTech() {
# And remove unneeded ones
# TODO: not sure how good idea this is
rm -f /srv/app/php-fpm.conf /srv/app/pool_app.conf /srv/app/php.ini /srv/app/nginx.conf
rm -f /srv/app/php-fpm.conf /srv/app/pool_app.conf /srv/app/php.ini
fi
# Node specific stuff
@ -89,15 +98,24 @@ function setTech() {
test -e /srv/conf/nginx.d/default.conf && rm -f /srv/conf/nginx.d/default.conf
# Same thing we do for nginx but if the file exist it's not rewritten.
if [ ! -e /srv/conf/nginx.d/app.conf ]; then
# Except if the file is in /srv/app, then it's moved to /srv/conf/nginx.d
if [ ! -e /srv/conf/nginx.d/app.conf -o -e /srv/app/nginx.conf ]; then
mkdir -p /srv/conf/nginx.d
if [ "$name" = "php" ]; then
cp /opt/examples/php/nginx.conf /srv/conf/nginx.d/app.conf
if [ -e /srv/app/nginx.conf ]; then
mv /srv/app/nginx.conf /srv/conf/nginx.d/app.conf
else
cp /opt/examples/nginx/nginx.conf /srv/conf/nginx.d/app.conf
fi
echo ".. app configuration for nginx not found, adding it - please check /srv/conf/nginx.d/app.conf and make sure it fits your code"
fi
if [ "$name" = "ruby" ]; then
mkdir -p /srv/app/public
rm /srv/conf/nginx.d/app.conf
mv /srv/app/index.html /srv/app/public/index.html
rm -rf /srv/conf/nginx.d
rm -f /srv/conf/supervisor.d/nginx.conf
fi
# We load new configuration into supervisor and it's automatically started or restarted if needed
@ -164,31 +182,31 @@ function quickTech() {
case $TECH in
"python")
if [ -z "$VERSION" ]; then
VERSION=3.9.1
VERSION=$VERSION_PYTHON
fi
setTech $TECH-$VERSION
;;
"php")
if [ -z "$VERSION" ]; then
VERSION=7.4.15
VERSION=$VERSION_PHP
fi
setTech $TECH-$VERSION
;;
"node")
if [ -z "$VERSION" ]; then
VERSION=14.15.4
VERSION=$VERSION_NODE
fi
setTech $TECH-$VERSION
;;
"ruby")
if [ -z "$VERSION" ]; then
VERSION=3.0.0
VERSION=$VERSION_RUBY
fi
setTech $TECH-$VERSION
;;
"deno")
if [ -z "$VERSION" ]; then
VERSION=1.7.2
VERSION=$VERSION_DENO
fi
setTech $TECH-$VERSION
;;
@ -198,6 +216,12 @@ function quickTech() {
"redis")
setService $TECH
;;
"default")
setTech $TECH
;;
"static")
setTech default
;;
esac
}
@ -224,6 +248,10 @@ while /bin/true; do
menuitem=$MENUITEM
fi
if [ $? -ne 0 ]; then
exit 0
fi
case $menuitem in
# Activation of one of the available tech
# Only one tech can be enabled same time but it's possible to use any of them from /opt/techs

View File

@ -2,7 +2,7 @@
mkdir -p /srv/var/redis
mkdir -p /srv/run
cp /opt/conf/redis.conf /srv/conf/
cp /opt/examples/redis/redis.conf /srv/conf/
cat << EOF > /srv/conf/supervisor.d/redis.conf
[program:redis]

View File

@ -125,12 +125,25 @@ if [ -e /srv/app/init.sh ]; then
su app -c /srv/app/init.sh
fi
if [ -e /srv/init.sh ]; then
echo "Starting /srv/init.sh .."
chmod 755 /srv/init.sh
su app -c /srv/init.sh
fi
# Custom /etc/ssl/openssl.cnf
if [ -e /srv/conf/openssl.cnf ]; then
rm /etc/ssl/openssl.cnf
cp /srv/conf/openssl.cnf /etc/ssl/openssl.cnf
fi
# Fix ssh-copy-id helper
if [ ! -e /srv/.ssh/authorized_keys ]; then
mkdir -p /etc/dropbear/authorized_key
chown app:app /etc/dropbear/authorized_key
ln -s /srv/.ssh/authorized_keys /etc/dropbear/authorized_key
fi
####################
# Default Nginx page
####################

176
tests.sh
View File

@ -1,176 +0,0 @@
#!/bin/bash
if [ -z "$DOCKER" ]; then
DOCKER=docker
fi
CONTAINER_NAME=runtime-test
I=1
COUNT=9
PROBLEM=0
function run() {
$DOCKER run -d --rm --name $CONTAINER_NAME rosti/runtime:dev > /dev/null
sleep 5
}
function stop() {
$DOCKER stop $CONTAINER_NAME > /dev/null
sleep 5
}
# Default page
run
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "<title>Roští.cz</title>" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT default response correct"
else
echo "$I/$COUNT default response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Node.js 12.16.1
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-12.16.1 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 12.16.1 response correct"
else
echo "$I/$COUNT Node.js 12.16.1 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# Node.js 12.18.3
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-12.18.3 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 12.18.3 response correct"
else
echo "$I/$COUNT Node.js 12.18.3 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Node.js 13.7.0
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-13.7.0 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 13.7.0 response correct"
else
echo "$I/$COUNT Node.js 13.7.0 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# Node.js 14.8.0
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=node-14.8.0 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 3
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep package.json > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Node.js 14.8.0 response correct"
else
echo "$I/$COUNT Node.js 14.8.0 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# Python 3.8.2
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=python-3.8.2 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "app.py" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Python 3.8.2 response correct"
else
echo "$I/$COUNT Python 3.8.2 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# Python 3.8.5
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=python-3.8.5 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "app.py" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT Python 3.8.5 response correct"
else
echo "$I/$COUNT Python 3.8.5 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
# PHP 7.4.4
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=php-7.4.4 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "PHP aplikaci" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT PHP 7.4.4 response correct"
else
echo "$I/$COUNT PHP 7.4.4 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
# PHP 7.4.9
run
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=php-7.4.9 $CONTAINER_NAME su app -c rosti > /dev/null
sleep 5
$DOCKER exec $CONTAINER_NAME curl http://localhost:8000 | grep "PHP aplikaci" > /dev/null
if [ $? -eq 0 ]; then
echo "$I/$COUNT PHP 7.4.9 response correct"
else
echo "$I/$COUNT PHP 7.4.9 response incorrect"
PROBLEM=1
fi
I=$((I+1))
stop
###############
if [ "$PROBLEM" = "0" ]; then
echo
echo "All OK"
exit 0
else
echo
echo "Problem found"
exit 1
fi

View File

@ -1,22 +0,0 @@
#!/usr/bin/fish
if test -z "$DOCKER"
set DOCKER docker
end
set CONTAINER_NAME dev_test
for line in (cat Dockerfile | grep "RUN build_" | sed "s/RUN build_//" | sed "s/\.sh//" | sed "s/php8/php/")
set tech (string split " " $line)[1]
set tech_version (string split " " $line)[2]
echo "Testing $tech $tech_version"
$DOCKER run -d --rm --name $CONTAINER_NAME harbor.hq.rosti.cz/rosti/runtime:test > /dev/null; or exit 1
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=$tech-$tech_version $CONTAINER_NAME su app -c rosti > /dev/null; or exit 1
sleep 3
$DOCKER exec $CONTAINER_NAME curl --head http://localhost:8000 | grep "HTTP/1.1 200"; or exit 2
$DOCKER stop $CONTAINER_NAME; or exit 1
end

59
tests2.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
IMAGE=$1
if [ -z "$1" ]; then
IMAGE=harbor.hq.rosti.cz/rosti/runtime:test
fi
RCol='\e[0m' # Text Reset
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds
Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m'; On_Bla='\e[40m'; On_IBla='\e[0;100m';
Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m'; On_Red='\e[41m'; On_IRed='\e[0;101m';
Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m'; On_Gre='\e[42m'; On_IGre='\e[0;102m';
Yel='\e[0;33m'; BYel='\e[1;33m'; UYel='\e[4;33m'; IYel='\e[0;93m'; BIYel='\e[1;93m'; On_Yel='\e[43m'; On_IYel='\e[0;103m';
Blu='\e[0;34m'; BBlu='\e[1;34m'; UBlu='\e[4;34m'; IBlu='\e[0;94m'; BIBlu='\e[1;94m'; On_Blu='\e[44m'; On_IBlu='\e[0;104m';
Pur='\e[0;35m'; BPur='\e[1;35m'; UPur='\e[4;35m'; IPur='\e[0;95m'; BIPur='\e[1;95m'; On_Pur='\e[45m'; On_IPur='\e[0;105m';
Cya='\e[0;36m'; BCya='\e[1;36m'; UCya='\e[4;36m'; ICya='\e[0;96m'; BICya='\e[1;96m'; On_Cya='\e[46m'; On_ICya='\e[0;106m';
Whi='\e[0;37m'; BWhi='\e[1;37m'; UWhi='\e[4;37m'; IWhi='\e[0;97m'; BIWhi='\e[1;97m'; On_Whi='\e[47m'; On_IWhi='\e[0;107m';
if test -z "$DOCKER"; then
DOCKER=docker
fi
CONTAINER_NAME=dev_test
$DOCKER stop $CONTAINER_NAME &>/dev/null
COUNT=`cat Dockerfile | grep "RUN build_" | sed "s/RUN build_//" | sed "s/\.sh//" | sed "s/php8/php/" | wc -l`
I=1
cat Dockerfile | grep "RUN build_" | sed "s/RUN build_//" | sed "s/\.sh//" | sed "s/php8/php/" | \
while read line
do
tech=`echo $line | cut -d " " -f 1`
tech_version=`echo $line | cut -d " " -f 2`
echo -e "${BRed}:: ($I/$COUNT) ${Yel}Testing ${BWhi}$tech ${Gre}$tech_version${RCol}"
set -e
echo -e "${BRed}.. ${Yel}starting test container${RCol}"
$DOCKER run -d --rm --name $CONTAINER_NAME $IMAGE > /dev/null || exit 1
echo -e "${BRed}.. ${Yel}ten seconds sleep${RCol}"
sleep 10
echo -e "${BRed}.. ${Yel}setting up the tech${RCol}"
$DOCKER exec -e TESTMODE=1 -e MENUITEM=tech -e TECH=$tech-$tech_version $CONTAINER_NAME su app -c rosti > /dev/null || exit 1
echo -e "${BRed}.. ${Yel}three seconds sleep${RCol}"
sleep 3
echo -e "${BRed}.. ${Yel}trying to get HTTP status code 200${RCol}"
$DOCKER exec $CONTAINER_NAME curl --head http://localhost:8000 | grep "HTTP/1.1 200" || exit 2
set +e
echo -e "${BRed}.. ${Yel}cleaning this round${RCol}"
$DOCKER stop $CONTAINER_NAME &>/dev/null || exit 1
((I++))
done