diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 604e452..1098c90 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,23 +7,13 @@ on: 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 + # echo "${{ secrets.repo_password }}" | podman login -u $USERNAME --password-stdin $REPO + docker login gitea.ceperka.net -u "${{ secrets.REPO_USERNAME }}" -p "${{ secrets.REPO_PASSWORD }}" + task pipeline REPO=gitea.ceperka.net/rosti/runtime VERSION=pipeline diff --git a/Dockerfile b/Dockerfile index de0bcc4..cbe1c89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,9 @@ 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/ 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 echo "deb http://deb.debian.org/debian/ bookworm main contrib non-free" > /etc/apt/sources.list && \ + echo "deb http://security.debian.org/debian-security bookworm-security main" >> /etc/apt/sources.list && \ + echo "deb http://deb.debian.org/debian/ bookworm-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 \ @@ -14,14 +14,19 @@ 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-13 postgresql-13-postgis-3-scripts bind9-host dnsutils nginx nginx-extras libnginx-mod-http-image-filter \ +mariadb-client postgresql-client-15 postgresql-15-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 \ +libcurl4-openssl-dev python3-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 jq inotify-tools ripgrep +jpegoptim optipng pngquant gifsicle webp libvpx-dev libwebp-dev jq inotify-tools ripgrep \ +wkhtmltopdf libzbar0 fzf + +# This is stange thing in Debian 12, it blocks installation of chromium +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -y luit +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y chromium WORKDIR /srv @@ -42,45 +47,66 @@ ENV TERM xterm ############# ## Node.js +# From https://nodejs.org/en/about/previous-releases WORKDIR /usr/src ADD build_node.sh /usr/local/bin/build_node.sh -# 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 +RUN build_node.sh 18.20.4 +RUN build_node.sh 20.16.0 +RUN build_node.sh 21.7.3 +RUN build_node.sh 22.5.1 ## Python +# https://www.python.org/downloads/ WORKDIR /usr/src ADD build_python.sh /usr/local/bin/build_python.sh -# 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 +RUN build_python.sh 3.11.9 +RUN build_python.sh 3.12.4 ## PHP 8 +# https://www.php.net/downloads.php ADD build_php8.sh /usr/local/bin/build_php8.sh -# 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 +RUN build_php8.sh 8.2.15 +RUN build_php8.sh 8.2.21 +RUN build_php8.sh 8.3.6 +RUN build_php8.sh 8.3.9 ## Ruby +# https://www.ruby-lang.org/en/downloads/releases/ WORKDIR /usr/src ADD build_ruby.sh /usr/local/bin/build_ruby.sh -# 2023/08 -RUN build_ruby.sh 3.1.4 -RUN build_ruby.sh 3.2.2 +RUN build_ruby.sh 3.2.5 +RUN build_ruby.sh 3.3.4 ## Deno +# From: https://github.com/denoland/deno/releases ADD build_deno.sh /usr/local/bin/build_deno.sh -# 2023/08 -RUN build_deno.sh 1.36.1 -RUN build_deno.sh 1.38.2 +RUN build_deno.sh 1.45.4 + +# Bun +# From here: https://bun.sh/ +ADD build_bun.sh /usr/local/bin/build_bun.sh +RUN build_bun.sh 1.1.21 + +# OpenJDK +# From here: https://jdk.java.net/ +ADD build_openjdk.sh /usr/local/bin/build_openjdk.sh +RUN build_openjdk.sh 22.0.2 c9ecb94cd31b495da20a27d4581645e8 + +# Golang +# From here: https://go.dev/dl/ +ADD build_golang.sh /usr/local/bin/build_golang.sh +RUN build_golang.sh 1.22.5 + + +############# + +# WKHTMLTOX This is not in development anymore so we will remove it with next version of Debian + +WORKDIR /usr/src +RUN apt install -f xfonts-75dpi && \ + wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && \ + dpkg -i wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && \ + rm wkhtmltox_0.12.6.1-3.bookworm_amd64.deb ############# @@ -121,6 +147,10 @@ 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 +## Rosti tooling + +ADD ./activate_tech.fish /usr/local/bin/activate_tech + ## Cleaning RUN apt-get clean && rm -rf /usr/src/* diff --git a/Taskfile.yml b/Taskfile.yml index 83fd3e1..eed3c9c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -4,7 +4,7 @@ version: '3' vars: REPO: harbor.hq.rosti.cz/rosti/runtime - VERSION: 2023.12-1 + VERSION: 2024.09-1 BASEIMAGE: debian:bookworm tasks: @@ -12,6 +12,12 @@ tasks: deps: - build + pipeline: + cmds: + - task: build + - task: test + - task: push + build: cmds: - docker pull {{ .BASEIMAGE }} @@ -35,5 +41,5 @@ tasks: push: cmds: - docker push {{ .REPO }}:{{ .VERSION }} - deps: - - squashed + # deps: + # - squashed diff --git a/activate_tech.fish b/activate_tech.fish new file mode 100755 index 0000000..a46f321 --- /dev/null +++ b/activate_tech.fish @@ -0,0 +1,24 @@ +#!/usr/bin/fish + +for techline in (ls /opt/techs | fzf --layout reverse) + set tech (echo $techline | string split -f 1 - ) + set ver (echo $techline | string split -f 2 - ) + + test -e /srv/bin/active_$tech && unlink /srv/bin/active_$tech + + set primary_tech (readlink /srv/bin/primary_tech | string split -f 4 / | string split -f 1 "-") + if test $primary_tech = $tech + set_color -b red + echo "Technology $tech is already activated as primary tech, you can't activate it as secondary." + set_color normal + continue + end + + set_color yellow + echo "Activating $tech-$ver" + set_color normal + ln -s /opt/techs/$tech-$ver/bin /srv/bin/active_$tech + set_color green + echo "Done." + set_color normal +end diff --git a/build_bun.sh b/build_bun.sh new file mode 100755 index 0000000..3bacbf2 --- /dev/null +++ b/build_bun.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e + +mkdir -p /opt/techs + +VERSION=$1 + +cd /usr/src + + +wget https://github.com/oven-sh/bun/releases/download/bun-v$VERSION/bun-linux-x64.zip +unzip bun-linux-x64.zip +mkdir -p /opt/techs/bun-$VERSION +mv bun-linux-x64 /opt/techs/bun-$VERSION/bin +rm bun-linux-x64.zip diff --git a/build_golang.sh b/build_golang.sh new file mode 100755 index 0000000..8ed8062 --- /dev/null +++ b/build_golang.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +mkdir -p /opt/techs + +VERSION=$1 +HASH=$2 + +cd /usr/src + +wget https://go.dev/dl/go${VERSION}.linux-amd64.tar.gz +tar xf go${VERSION}.linux-amd64.tar.gz +mv go /opt/techs/golang-$VERSION +rm go${VERSION}.linux-amd64.tar.gz diff --git a/build_openjdk.sh b/build_openjdk.sh new file mode 100755 index 0000000..d768008 --- /dev/null +++ b/build_openjdk.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +mkdir -p /opt/techs + +VERSION=$1 +HASH=$2 + +cd /usr/src + +wget https://download.java.net/java/GA/jdk${VERSION}/${HASH}/9/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz +tar xf openjdk-${VERSION}_linux-x64_bin.tar.gz +mv jdk-${VERSION} /opt/techs/openjdk-$VERSION +rm openjdk-${VERSION}_linux-x64_bin.tar.gz diff --git a/build_php8.sh b/build_php8.sh index 8a738a9..88f724d 100755 --- a/build_php8.sh +++ b/build_php8.sh @@ -4,6 +4,7 @@ set -e VERSION=$1 + mkdir -p /opt/techs cd /usr/src @@ -71,12 +72,20 @@ cd - echo "no" | /opt/techs/php-$VERSION/bin/pecl install redis echo "no" | /opt/techs/php-$VERSION/bin/pecl install mongodb +export PATH=$PATH:/opt/techs/php-$VERSION/bin +composer.phar require ext-simplexml + 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 +# We ignore PHP 8.3.2 until it's fixed +if [ "$VERSION" != "8.3.2" -a "$VERSION" != "8.3.6" -a "$VERSION" != "8.3.9" ]; then + echo "no" | /opt/techs/php-$VERSION/bin/pecl install imagick + echo "extension=imagick.so" >> /opt/techs/php-$VERSION/etc/conf.d/extensions.ini +fi + ln -s /srv/conf/php-fpm/php.ini /opt/techs/php-$VERSION/etc/conf.d/99-app.ini diff --git a/build_ruby.sh b/build_ruby.sh index 20612dd..9bfae61 100755 --- a/build_ruby.sh +++ b/build_ruby.sh @@ -21,3 +21,7 @@ make install /opt/techs/ruby-${VERSION}/bin/gem update --system /opt/techs/ruby-${VERSION}/bin/gem install passenger + +git clone --depth 1 https://github.com/rbenv/rbenv.git /opt/techs/ruby-$VERSION/rbenv +ln -s /opt/techs/ruby-$VERSION/rbenv/libexec/rbenv /opt/techs/ruby-$VERSION/bin/rbenv + diff --git a/etc/bashrc_local b/etc/bashrc_local index f81b7e1..45c5034 100644 --- a/etc/bashrc_local +++ b/etc/bashrc_local @@ -1,4 +1,16 @@ export PATH=/srv/bin/primary_tech:/srv/bin/primary_tech/sbin:/srv/bin:$PATH:/usr/sbin:/sbin +export PATH=$PATH:/srv/bin/active_bun +export PATH=$PATH:/srv/bin/active_deno +export PATH=$PATH:/srv/bin/active_golang +export PATH=$PATH:/srv/bin/active_node +export PATH=$PATH:/srv/bin/active_openjdk +export PATH=$PATH:/srv/bin/active_php +export PATH=$PATH:/srv/bin/active_python +export PATH=$PATH:/srv/bin/active_ruby + +# Ruby related variables +export BUNDLE_PATH=/srv/tmp/cache +export GEM_HOME=/srv/.gem # Use only if the shell is opened via SSH if [ -n "$SSH_TTY" ]; then diff --git a/examples/bun/app.js b/examples/bun/app.js new file mode 100644 index 0000000..fc77756 --- /dev/null +++ b/examples/bun/app.js @@ -0,0 +1,74 @@ + +const content = ` + + + + + + Roští.cz + + + +
+ +
+
+

Kde to jsem?

+

+

Na Roští.cz a prostředí pro vaši aplikaci je připraveno.

+

V adresáři /srv/app najdete tuto stránku napsanou v Bun, která funguje zároveň jako ukázka, kterou se můžete inspirovat pro nasazení vašeho vlastního kódu.

+

HTTP server vaší aplikace spusťte na portu 8080. Nezapomeňte si projít naši dokumentaci, kde máme popsané mechanismy, na kterých náš hosting funguje.

+
+

V případě problémů se prosím obraťte na technickou podporu nebo na dokumentaci.

+

Tým Roští.cz | @we@rosti.social

+
+
+ + +` + + +Bun.serve({ + port: 8080, + fetch(req) { + return new Response(content, {headers:{ 'Content-Type': 'text/html' }}); + }, +}); diff --git a/examples/bun/package.json b/examples/bun/package.json new file mode 100644 index 0000000..c099db5 --- /dev/null +++ b/examples/bun/package.json @@ -0,0 +1,9 @@ +{ + "name": "welcome", + "version": "0.1.0", + "description": "Welcome page by Roští.cz", + "author": "Adam Štrauch ", + "scripts": { + "start": "/srv/bin/primary_tech/bun run app.js" + } + } diff --git a/examples/bun/supervisor.conf b/examples/bun/supervisor.conf new file mode 100644 index 0000000..a72838c --- /dev/null +++ b/examples/bun/supervisor.conf @@ -0,0 +1,14 @@ +[program:app] +command=/srv/bin/primary_tech/bun run start +environment=PATH="/srv/bin/primary_tech:/usr/local/bin:/usr/bin:/bin:/srv/.npm-packages/bin" +stopasgroup=true +directory=/srv/app +process_name=app +autostart=true +autorestart=true +stdout_logfile=/srv/log/bun.log +stdout_logfile_maxbytes=2MB +stdout_logfile_backups=5 +stdout_capture_maxbytes=2MB +stdout_events_enabled=false +redirect_stderr=true diff --git a/examples/default/index.html b/examples/default/index.html index 9920a81..2554935 100644 --- a/examples/default/index.html +++ b/examples/default/index.html @@ -50,7 +50,7 @@

Nyní je nutné přihlásit se do kontejneru s vaší aplikací přes SSH a použít příkaz rosti k základnímu nastavení prostředí. Přístupy najdete v naší administraci v info kartě aplikace.

V případě problémů se prosím obraťte na technickou podporu nebo na dokumentaci.

-

Tým Roští.cz | @rosti_cz

+

Tým Roští.cz | @we@rosti.social

+ + +` + + fmt.Fprint(w, content) +} + +func main() { + http.HandleFunc("/", handler) + fmt.Println("Starting server at :8080") + if err := http.ListenAndServe(":8080", nil); err != nil { + fmt.Println("Server failed:", err) + } +} diff --git a/examples/golang/supervisor.conf b/examples/golang/supervisor.conf new file mode 100644 index 0000000..8124f34 --- /dev/null +++ b/examples/golang/supervisor.conf @@ -0,0 +1,14 @@ +[program:app] +command=/srv/app/example_app +environment=PATH="/srv/bin/primary_tech:/usr/local/bin:/usr/bin:/bin:/srv/.npm-packages/bin" +stopasgroup=true +directory=/srv/app +process_name=app +autostart=true +autorestart=true +stdout_logfile=/srv/log/golang.log +stdout_logfile_maxbytes=2MB +stdout_logfile_backups=5 +stdout_capture_maxbytes=2MB +stdout_events_enabled=false +redirect_stderr=true diff --git a/examples/node/Dockerfile b/examples/node/Dockerfile new file mode 100644 index 0000000..ce2d8b2 --- /dev/null +++ b/examples/node/Dockerfile @@ -0,0 +1,158 @@ +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/ bookworm main contrib non-free" > /etc/apt/sources.list && \ + echo "deb http://security.debian.org/debian-security bookworm-security main" >> /etc/apt/sources.list && \ + echo "deb http://deb.debian.org/debian/ bookworm-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 \ +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-15 postgresql-15-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 python3-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 jq inotify-tools ripgrep \ +wkhtmltopdf libzbar0 + +# This is stange thing in Debian 12, it blocks installation of chromium +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -y luit +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y chromium + +WORKDIR /srv + +RUN useradd -d /srv app -s /bin/bash +RUN usermod -G crontab -a app +RUN rm /etc/localtime +RUN ln -s /usr/share/zoneinfo/Europe/Prague /etc/localtime + +ADD /etc/locale.gen /etc/ +RUN locale-gen +ENV LANG en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +ENV TERM xterm + +############# +# Techs +############# + +## Node.js +# https://nodejs.org/en/about/previous-releases +WORKDIR /usr/src +ADD build_node.sh /usr/local/bin/build_node.sh +RUN build_node.sh 18.20.4 +RUN build_node.sh 20.15.1 +RUN build_node.sh 21.7.3 +RUN build_node.sh 22.4.1 + +## Python +# https://www.python.org/downloads/ +WORKDIR /usr/src +ADD build_python.sh /usr/local/bin/build_python.sh +RUN build_python.sh 3.11.9 +RUN build_python.sh 3.12.4 + +## PHP 8 +# https://www.php.net/downloads.php +ADD build_php8.sh /usr/local/bin/build_php8.sh +RUN build_php8.sh 8.2.15 +RUN build_php8.sh 8.2.21 +RUN build_php8.sh 8.3.6 +RUN build_php8.sh 8.3.9 + +## Ruby +# https://www.ruby-lang.org/en/downloads/releases/ +WORKDIR /usr/src +ADD build_ruby.sh /usr/local/bin/build_ruby.sh +RUN build_ruby.sh 3.2.2 +RUN build_ruby.sh 3.3.1 + +## Deno +ADD build_deno.sh /usr/local/bin/build_deno.sh +# 2024/05 +RUN build_deno.sh 1.43.6 +RUN build_deno.sh 1.45.1 + +# Bun +ADD build_bun.sh /usr/local/bin/build_bun.sh +RUN build_bun.sh 1.1.18 + +# OpenJDK +# From here: https://jdk.java.net/ +ADD build_openjdk.sh /usr/local/bin/build_openjdk.sh +RUN build_openjdk.sh 22.0.2 c9ecb94cd31b495da20a27d4581645e8 + +# Golang +# From here: https://go.dev/dl/ +ADD build_golang.sh /usr/local/bin/build_golang.sh +RUN build_golang.sh 1.22.5 + + +############# + +# WKHTMLTOX This is not in development anymore so we will remove it with next version of Debian + +WORKDIR /usr/src +RUN apt install -f xfonts-75dpi && \ + wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && \ + dpkg -i wkhtmltox_0.12.6.1-3.bookworm_amd64.deb && \ + rm wkhtmltox_0.12.6.1-3.bookworm_amd64.deb + +############# + +## Support tools and miscellaneous stuff + +RUN rm -f /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* + +ADD /scripts/enable_redis.sh /usr/local/bin/enable-redis +ADD /scripts/enable_memcached.sh /usr/local/bin/enable-memcached +RUN chmod 755 /usr/local/bin/* + +ADD /etc/supervisord.conf /etc/supervisor/supervisord.conf +ADD /examples /opt/examples +ADD /etc/bashrc_local /opt/etc/bashrc_local +ADD /etc/bash_profile /opt/etc/bash_profile +ADD /etc/vimrc /opt/etc/vimrc +RUN mkdir -p /opt/etc/bashrc +RUN mkdir -p /opt/etc/appinit +ADD /etc/bashrc/common.sh /opt/etc/bashrc/ +ADD /etc/nginx.conf /etc/nginx/nginx.conf + +RUN rmdir /var/lib/nginx +RUN ln -s /srv/var/nginx /var/lib/nginx +RUN chown app:app /var/log/nginx -R + +RUN chown app:app /home -R + +# Start script + +ADD /start.sh /start.sh +RUN chmod 755 /start.sh + +## Roští script + +RUN apt-get install -y fish +ADD ./gen_rosti.fish /usr/local/bin/ +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 + +## Cleaning +RUN apt-get clean && rm -rf /usr/src/* + + +VOLUME /srv +WORKDIR /srv +EXPOSE 8000 22 + +ENTRYPOINT ["/start.sh"] diff --git a/examples/node/app.js b/examples/node/app.js index 09922b9..0777827 100644 --- a/examples/node/app.js +++ b/examples/node/app.js @@ -58,7 +58,7 @@ var server = http.createServer(function (request, response) {

HTTP server vaší aplikace spusťte na portu 8080. Na jiném nebude fungovat. Původní port 8000 nyní patří Nginxu, za kterým je vaše aplikace schovaná.

V případě problémů se prosím obraťte na technickou podporu nebo na dokumentaci.

-

Tým Roští.cz | @rosti_cz

+

Tým Roští.cz | @we@rosti.social

+ + + """; + + // Create an HTTP server on port 8000 + HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0); + + // Create a context to handle requests to the root path + server.createContext("/", new HttpHandler() { + @Override + public void handle(HttpExchange exchange) throws IOException { + // Set the response headers and status code + exchange.getResponseHeaders().set("Content-Type", "text/html; charset=UTF-8"); + exchange.sendResponseHeaders(200, htmlContent.getBytes().length); + + // Write the HTML content to the response body + try (OutputStream os = exchange.getResponseBody()) { + os.write(htmlContent.getBytes()); + } + } + }); + // Start the server + server.start(); + System.out.println("Server started on port 8080"); + } +} diff --git a/examples/openjdk/supervisor.conf b/examples/openjdk/supervisor.conf new file mode 100644 index 0000000..e2ac126 --- /dev/null +++ b/examples/openjdk/supervisor.conf @@ -0,0 +1,14 @@ +[program:app] +command=/srv/bin/primary_tech/java /srv/app/app.java +environment=PATH="/srv/bin/primary_tech:/usr/local/bin:/usr/bin:/bin:/srv/.npm-packages/bin" +stopasgroup=true +directory=/srv/app +process_name=app +autostart=true +autorestart=true +stdout_logfile=/srv/log/openjdk.log +stdout_logfile_maxbytes=2MB +stdout_logfile_backups=5 +stdout_capture_maxbytes=2MB +stdout_events_enabled=false +redirect_stderr=true diff --git a/examples/php/index.php b/examples/php/index.php index bce8b38..9e915a5 100644 --- a/examples/php/index.php +++ b/examples/php/index.php @@ -49,7 +49,7 @@

V případě problémů se prosím obraťte na technickou podporu nebo na dokumentaci.

-

Tým Roští.cz | @rosti_cz

+

Tým Roští.cz | @we@rosti.social