New version of all techs, adding Deno and Ruby

This commit is contained in:
Adam Štrauch 2021-02-07 01:05:27 +01:00
parent a59e71ef35
commit 649e1a691a
Signed by: cx
GPG Key ID: 018304FFA8988F8D
12 changed files with 335 additions and 40 deletions

View File

@ -4,24 +4,28 @@ 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 DEBIAN_FRONTEND=noninteractive apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y locales libffi-dev \
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 \
libssl-dev libgdbm-dev libgd-dev cron git mercurial subversion vim nano mc htop procps \
subversion dropbear gettext wget redis-server memcached supervisor curl ssh \
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 \
libxml2-dev libxslt1-dev openssh-sftp-server links2 lynx \
imagemagick libmagickwand-dev ncdu \
libcurl4-openssl-dev python3 python3-pip python3-virtualenv \
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 \
imagemagick ffmpeg libyaml-dev libc-client2007e-dev libonig-dev libkrb5-dev dialog \
whiptail tmux rsync nmap libzip-dev
ffmpeg libyaml-dev libc-client2007e-dev libonig-dev libkrb5-dev dialog \
whiptail tmux rsync nmap libzip-dev libfreetype6-dev \
jpegoptim optipng pngquant gifsicle webp # User requirement (svgo not available)
WORKDIR /srv
RUN useradd -d /srv app -s /bin/bash
@ -44,40 +48,45 @@ ENV TERM xterm
WORKDIR /usr/src
ADD build_node.sh /usr/local/bin/build_node.sh
# 2020/01
RUN build_node.sh 13.12.0
RUN build_node.sh 14.8.0
# 2020/01
RUN build_node.sh 12.16.1
RUN build_node.sh 12.18.3
# 2021/02
RUN build_node.sh 15.8.0
RUN build_node.sh 14.15.4
## Python
WORKDIR /usr/src
ADD build_python.sh /usr/local/bin/build_python.sh
# 2020/01
RUN build_python.sh 3.8.2
RUN build_python.sh 3.8.5
# 2020/12
RUN build_python.sh 3.9.1
## PHP
WORKDIR /usr/src
ADD build_php.sh /usr/local/bin/build_php.sh
# 2020/01
RUN build_php.sh 7.4.4
RUN build_php.sh 7.4.9
# 2021/02
RUN build_php.sh 7.4.15
## Roští script
## Ruby
WORKDIR /usr/src
ADD build_ruby.sh /usr/local/bin/build_ruby.sh
# 2020/11
RUN build_ruby.sh 2.7.2
# 2020/12
RUN build_ruby.sh 3.0.0
ADD rosti.sh /usr/local/bin/rosti
## Deno
ADD build_deno.sh /usr/local/bin/build_deno.sh
# 2021/02
RUN build_deno.sh 1.7.2
#############
## Support tools and miscellaneous stuff
ADD /start.sh /start.sh
RUN chmod 755 /start.sh
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
@ -100,6 +109,19 @@ 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.sh.tmp /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/*

View File

@ -1,5 +1,5 @@
DOCKER=docker
VERSION=2020.09-2
VERSION=2021.02-1
all: build

15
build_deno.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
mkdir -p /opt/techs
VERSION=$1
cd /usr/src
wget https://github.com/denoland/deno/releases/download/v$VERSION/deno-x86_64-unknown-linux-gnu.zip
unzip deno-x86_64-unknown-linux-gnu.zip
mkdir -p /opt/techs/deno-$VERSION/bin
mv deno /opt/techs/deno-$VERSION/bin/deno

View File

@ -21,7 +21,7 @@ cd php-$VERSION
--sbindir=/opt/techs/php-$VERSION/bin \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--with-freetype \
--enable-mbstring \
--with-libxml-dir=/usr \
--enable-soap \
@ -47,8 +47,8 @@ cd php-$VERSION
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-jpeg \
--with-png-dir \
--enable-gd-native-ttf \
--with-openssl \
--with-fpm-user=app\
@ -61,6 +61,7 @@ cd php-$VERSION
--enable-opcache \
--with-imap \
--with-imap-ssl \
--with-sodium \
--with-kerberos \
--with-soapclient \
--with-pear
@ -75,5 +76,7 @@ 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 imagick
echo "extension=redis.so" > /opt/techs/php-$VERSION/etc/conf.d/extensions.ini
echo "extension=imagick.so" >> /opt/techs/php-$VERSION/etc/conf.d/extensions.ini

20
build_ruby.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
VERSION=$1
mkdir -p /opt/techs
cd /usr/src
SUBVERSION=`echo $VERSION | cut -d "." -f 1`.`echo $VERSION | cut -d "." -f 2`
wget https://cache.ruby-lang.org/pub/ruby/$SUBVERSION/ruby-$VERSION.tar.gz
tar xf ruby-$VERSION.tar.gz
rm ruby-$VERSION.tar.gz
cd ruby-$VERSION
./configure --prefix=/opt/techs/ruby-$VERSION
make -j
make install

74
examples/deno/app.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
[program:app]
command=/srv/bin/primary_tech/deno run --allow-net app.js
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/deno.log
stdout_logfile_maxbytes=2MB
stdout_logfile_backups=5
stdout_capture_maxbytes=2MB
stdout_events_enabled=false
redirect_stderr=true

81
examples/ruby/app.rb Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
[program:app]
command=/srv/bin/primary_tech/ruby app.rb
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/ruby.log
stdout_logfile_maxbytes=2MB
stdout_logfile_backups=5
stdout_capture_maxbytes=2MB
stdout_events_enabled=false
redirect_stderr=true

41
gen_rosti.fish Executable file
View File

@ -0,0 +1,41 @@
#!/usr/bin/fish
set TECHS_FILE /tmp/techs.txt
echo -n > $TECHS_FILE
for line in (cat Dockerfile | grep "RUN build_")
set VERSION (echo $line | cut -d " " -f 3)
set TECH_SCRIPT (echo $line | cut -d " " -f 2)
switch $TECH_SCRIPT
case "build_php.sh"
set TECH php
set TECH_VERBOSE PHP
case "build_python.sh"
set TECH python
set TECH_VERBOSE Python
case "build_node.sh"
set TECH node
set TECH_VERBOSE Node
case "build_ruby.sh"
set TECH ruby
set TECH_VERBOSE Ruby
case "build_deno.sh"
set TECH deno
set TECH_VERBOSE Deno
case '*'
set TECH unknown
end
echo " \"$TECH-$VERSION\" \" $TECH_VERBOSE $VERSION\" \\" >> $TECHS_FILE
end
cat rosti.sh.tmp | while read -l line
if [ "$line" = "{{TECHS}}" ]
cat $TECHS_FILE
else
echo $line
end
end

View File

@ -28,7 +28,7 @@ function setTech() {
tech=$1
# Activation of primary tech bin directory
test ! -e $PRIMARYDIR || unlink $PRIMARYDIR
test ! -e $PRIMARYDIR || $TECHDIR/$tech/bin
ln -s $TECHDIR/$tech/bin $PRIMARYDIR
# Parse name of the tech - like python or node
@ -163,19 +163,31 @@ function quickTech() {
case $TECH in
"python")
if [ -z "$VERSION" ]; then
VERSION=3.8.5
VERSION=3.9.1
fi
setTech $TECH-$VERSION
;;
"php")
if [ -z "$VERSION" ]; then
VERSION=7.4.9
VERSION=7.4.15
fi
setTech $TECH-$VERSION
;;
"node")
if [ -z "$VERSION" ]; then
VERSION=14.8.0
VERSION=14.15.4
fi
setTech $TECH-$VERSION
;;
"ruby")
if [ -z "$VERSION" ]; then
VERSION=3.0.0
fi
setTech $TECH-$VERSION
;;
"deno")
if [ -z "$VERSION" ]; then
VERSION=1.7.2
fi
setTech $TECH-$VERSION
;;
@ -201,7 +213,7 @@ fi
while /bin/true; do
if [ "$MENUITEM" = "" ]; then
menuitem=$(whiptail --menu "Choose what to do" $HEIGHT $WIDTH 6 \
menuitem=$(whiptail --menu "Choose what to do" $HEIGHT $WIDTH 10 \
"tech" " Activaton of primary tech" \
"services" " Enable additional services (Redis, Memcached, ..)" \
"cron" " Update crontab" \
@ -216,15 +228,8 @@ while /bin/true; do
# Only one tech can be enabled same time but it's possible to use any of them from /opt/techs
"tech")
if [ "$TECH" = "" ]; then
tech=$(whiptail --menu "Select tech" $HEIGHT $WIDTH 6 \
"python-3.8.2" " Python 3.8.2" \
"python-3.8.5" " Python 3.8.5" \
"node-13.12.0" " Node 13.12.0" \
"node-14.8.0" " Node 14.8.0" \
"node-12.16.1" " Node 12.16.1" \
"node-12.18.3" " Node 12.18.3" \
"php-7.4.4" " PHP 7.4.4" \
"php-7.4.9" " PHP 7.4.9" \
tech=$(whiptail --menu "Select tech" $HEIGHT $WIDTH 10 \
{{TECHS}}
"back" " Go back" \
3>&1 1>&2 2>&3)
else

View File

@ -122,6 +122,12 @@ if [ -e /srv/app/init.sh ]; then
su app -c /srv/app/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
####################
# Default Nginx page
####################