tests - road to linux tests 🚀

This commit is contained in:
bunkerity 2022-08-17 14:01:18 +02:00
parent c277a33e9c
commit e4321629f1
No known key found for this signature in database
GPG key ID: 3D80806F12602A7C
23 changed files with 265 additions and 31 deletions

View file

@ -5,11 +5,19 @@ if [ $(id -u) -ne 0 ] ; then
exit 1
fi
curl https://ftp.drupal.org/files/projects/drupal-9.4.2.tar.gz -Lo /tmp/drupal.tar.gz
tar -xvzf /tmp/drupal.tar.gz -C /tmp
cp -r /tmp/drupal-9.4.2/* /opt/bunkerweb/www
chown -R www-data:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type d -exec chmod 750 /opt/bunkerweb/www {} \;
find /opt/bunkerweb/www -type f -exec chmod 640 /opt/bunkerweb/www {} \;
systemctl start php-fpm
cp variables.env /opt/bunkerweb/variables.env
if id www-data > /dev/null 2>&1 ; then
user="www-data"
elif id apache > /dev/null 2>&1 ; then
user="apache"
else
echo "❌ No PHP user found"
exit 1
fi
curl https://releases.mattermost.com/7.2.0/mattermost-7.2.0-linux-amd64.tar.gz -Lo /tmp/mattermost.tar.gz
tar -xvzf /tmp/mattermost.tar.gz -C /tmp
cd /tmp/drupal-*
cp -r * /opt/bunkerweb/www
chown -R $user:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \;
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;
cp -r bw-data/configs/* /opt/bunkerweb/configs

View file

@ -4,9 +4,10 @@
"docker",
"autoconf",
"swarm",
"kubernetes"
"kubernetes",
"linux"
],
"no_copy_container": true,
"no_copy_container": true,
"timeout": 60,
"delay": 60,
"tests": [

View file

@ -5,10 +5,16 @@ if [ $(id -u) -ne 0 ] ; then
exit 1
fi
if id www-data > /dev/null 2>&1 ; then
user="www-data"
elif id apache > /dev/null 2>&1 ; then
user="apache"
else
echo "❌ No PHP user found"
exit 1
fi
curl https://downloads.joomla.org/fr/cms/joomla4/4-1-5/Joomla_4-1-5-Stable-Full_Package.zip?format=zip -Lo /tmp/joomla.zip
unzip /tmp/joomla.zip -d /opt/bunkerweb/www
chown -R www-data:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type d -exec chmod 750 /opt/bunkerweb/www {} \;
find /opt/bunkerweb/www -type f -exec chmod 640 /opt/bunkerweb/www {} \;
systemctl start php-fpm
cp variables.env /opt/bunkerweb/variables.env
chown -R $user:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \;
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;

21
examples/moodle/setup-linux.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
if id www-data > /dev/null 2>&1 ; then
user="www-data"
elif id apache > /dev/null 2>&1 ; then
user="apache"
else
echo "❌ No PHP user found"
exit 1
fi
curl https://download.moodle.org/download.php/direct/stable400/moodle-4.0.2.tgz -Lo /tmp/moodle.tgz
tar -xvzf /tmp/moodle.tgz -C /tmp
cp -r /tmp/moodle/* /opt/bunkerweb/www
chown -R $user:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \;
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;

View file

@ -4,7 +4,8 @@
"docker",
"autoconf",
"swarm",
"kubernetes"
"kubernetes",
"linux"
],
"timeout": 300,
"delay": 180,

View file

@ -0,0 +1,22 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
if id www-data > /dev/null 2>&1 ; then
user="www-data"
elif id apache > /dev/null 2>&1 ; then
user="apache"
else
echo "❌ No PHP user found"
exit 1
fi
curl https://download.nextcloud.com/server/releases/latest.zip -Lo /tmp/nextcloud.zip
unzip /tmp/nextcloud.zip -d /tmp
cp -r /tmp/nextcloud/* /opt/bunkerweb/www
chown -R $user:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \;
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;
cp -r bw-data/configs/* /opt/bunkerweb/configs

View file

@ -4,7 +4,8 @@
"docker",
"autoconf",
"swarm",
"kubernetes"
"kubernetes",
"linux"
],
"timeout": 120,
"delay": 60,

View file

@ -0,0 +1,19 @@
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
# Replace with your domain
SERVER_NAME=www.example.com
DISABLE_DEFAULT_SERVER=yes
AUTO_LETS_ENCRYPT=yes
USE_CLIENT_CACHE=yes
USE_GZIP=yes
X_FRAME_OPTIONS=SAMEORIGIN
ALLOWED_METHODS=GET|POST|HEAD|COPY|DELETE|LOCK|MKCOL|MOVE|PROPFIND|PROPPATCH|PUT|UNLOCK|OPTIONS
BAD_BEHAVIOR_STATUS_CODES=400 401 403 405 444
MAX_CLIENT_SIZE=10G
LIMIT_REQ_URL_1=/apps
LIMIT_REQ_RATE_1=5r/s
LIMIT_REQ_URL_2=/apps/text/session/sync
LIMIT_REQ_RATE_2=8r/s
LIMIT_REQ_URL_3=/core/preview
LIMIT_REQ_RATE_3=5r/s

View file

@ -0,0 +1,19 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
if id www-data > /dev/null 2>&1 ; then
user="www-data"
elif id apache > /dev/null 2>&1 ; then
user="apache"
else
echo "❌ No PHP user found"
exit 1
fi
cp -r ./bw-data/www/* /opt/bunkerweb/www
chown -R $user:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \;
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;

View file

@ -2,7 +2,8 @@
"name": "php-multisite",
"kinds": [
"docker",
"autoconf"
"autoconf",
"linux"
],
"timeout": 60,
"tests": [

View file

@ -0,0 +1,19 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
if id www-data > /dev/null 2>&1 ; then
user="www-data"
elif id apache > /dev/null 2>&1 ; then
user="apache"
else
echo "❌ No PHP user found"
exit 1
fi
cp -r ./bw-data/www/* /opt/bunkerweb/www
chown -R $user:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \;
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;

View file

@ -0,0 +1,25 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
DNF=$(which dnf)
APT=$(which apt)
if [ ! -z $DNF ] ; then
dnf install -y haproxy
elif [ ! -z $APT ] ; then
apt install -y haproxy
fi
cp haproxy.cfg /etc/haproxy
sed -i "s/*:8080/*:80/g" /etc/haproxy/haproxy.cfg
sed -i "s/*:8443/*:443/g" /etc/haproxy/haproxy.cfg
sed -i "s/mybunker/127.0.0.1/g" /etc/haproxy/haproxy.cfg
systemctl stop bunkerweb
systemctl stop haproxy
systemctl start haproxy
echo "hello" > /opt/bunkerweb/www/index.html

View file

@ -1,7 +1,8 @@
{
"name": "proxy-protocol",
"kinds": [
"docker"
"docker",
"linux"
],
"timeout": 60,
"tests": [
@ -11,4 +12,4 @@
"string": "hello"
}
]
}
}

View file

@ -0,0 +1,8 @@
*DNS_RESOLVERS=8.8.8.8 8.8.4.4
# replace with your domains
SERVER_NAME=www.example.com
# real IP settings
USE_PROXY_PROTOCOL=yes
USE_REAL_IP=yes
REAL_IP_FROM=127.0.0.0/8
REAL_IP_HEADER=proxy_protocol

View file

@ -0,0 +1,10 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
mkdir /opt/bunkerweb/www/{app1.example.com,app2.example.com}
echo "hello" > /opt/bunkerweb/www/app1.example.com/index.html
echo "hello" > /opt/bunkerweb/www/app2.example.com/index.html

View file

@ -2,9 +2,10 @@
"name": "reverse-proxy-multisite",
"kinds": [
"docker",
"autoconf",
"swarm",
"kubernetes"
"autoconf",
"swarm",
"kubernetes",
"linux"
],
"timeout": 60,
"delay": 60,
@ -20,4 +21,4 @@
"string": "hello"
}
]
}
}

View file

@ -0,0 +1,14 @@
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
# Replace with your domain
SERVER_NAME=app1.example.com app2.example.com
MULTISITE=yes
DISABLE_DEFAULT_SERVER=yes
AUTO_LETS_ENCRYPT=yes
USE_CLIENT_CACHE=yes
USE_GZIP=yes
app1.example.com_LOCAL_PHP=/run/php/php-fpm.sock
app1.example.com_LOCAL_PHP_PATH=/opt/bunkerweb/www/app1.example.com
app2.example.com_LOCAL_PHP=/run/php/php-fpm.sock
app2.example.com_LOCAL_PHP_PATH=/opt/bunkerweb/www/app2.example.com

View file

@ -0,0 +1,11 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
mkdir /opt/bunkerweb/www/{app1,app2}
echo "hello" > /opt/bunkerweb/www/app1/index.html
echo "hello" > /opt/bunkerweb/www/app2/index.html
cp -r bw-data/configs/* /opt/bunkerweb/configs

View file

@ -2,8 +2,9 @@
"name": "reverse-proxy-singlesite",
"kinds": [
"docker",
"autoconf",
"swarm"
"autoconf",
"swarm",
"linux"
],
"timeout": 60,
"no_copy_container": true,
@ -19,4 +20,4 @@
"string": "hello"
}
]
}
}

View file

@ -0,0 +1,11 @@
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
# Replace with your domain
SERVER_NAME=www.example.com
DISABLE_DEFAULT_SERVER=yes
AUTO_LETS_ENCRYPT=yes
USE_CLIENT_CACHE=yes
USE_GZIP=yes
LOCAL_PHP=/run/php/php-fpm.sock
LOCAL_PHP_PATH=/opt/bunkerweb/www

View file

@ -0,0 +1,21 @@
#!/bin/bash
if [ $(id -u) -ne 0 ] ; then
echo "❌ Run me as root"
exit 1
fi
if id www-data > /dev/null 2>&1 ; then
user="www-data"
elif id apache > /dev/null 2>&1 ; then
user="apache"
else
echo "❌ No PHP user found"
exit 1
fi
curl https://wordpress.org/latest.zip -Lo /tmp/wordpress.zip
unzip /tmp/wordpress.zip -d /tmp
cp -r /tmp/wordpress/* /opt/bunkerweb/www
chown -R $user:nginx /opt/bunkerweb/www
find /opt/bunkerweb/www -type f -exec chmod 0640 {} \;
find /opt/bunkerweb/www -type d -exec chmod 0750 {} \;

View file

@ -2,9 +2,10 @@
"name": "wordpress",
"kinds": [
"docker",
"autoconf",
"swarm",
"kubernetes"
"autoconf",
"swarm",
"kubernetes",
"linux"
],
"timeout": 60,
"delay": 120,
@ -16,4 +17,4 @@
"string": "wordpress"
}
]
}
}

View file

@ -0,0 +1,12 @@
HTTP_PORT=80
HTTPS_PORT=443
DNS_RESOLVERS=8.8.8.8 8.8.4.4
# Replace with your domain
SERVER_NAME=www.example.com
DISABLE_DEFAULT_SERVER=yes
AUTO_LETS_ENCRYPT=yes
USE_CLIENT_CACHE=yes
USE_GZIP=yes
LOCAL_PHP=/run/php/php-fpm.sock
LOCAL_PHP_PATH=/opt/bunkerweb/www
MAX_CLIENT_SIZE=50m