Skip to content

Commit 63b76c6

Browse files
committed
dockerfile changes
1 parent 1ac13c8 commit 63b76c6

File tree

5 files changed

+163
-15
lines changed

5 files changed

+163
-15
lines changed

.dev/docker/default_ssl.conf

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# If using Ubuntu this file should be placed in:
2+
# /etc/nginx/sites-available/
3+
#
4+
server {
5+
listen 80;
6+
server_name <domain>;
7+
return 301 https://$server_name$request_uri;
8+
}
9+
10+
server {
11+
listen 443 ssl http2;
12+
server_name <domain>;
13+
14+
root /var/www/pterodactyl/public;
15+
index index.php;
16+
17+
access_log /var/log/nginx/pterodactyl.app-access.log;
18+
error_log /var/log/nginx/pterodactyl.app-error.log error;
19+
20+
# allow larger file uploads and longer script runtimes
21+
client_max_body_size 100m;
22+
client_body_timeout 120s;
23+
24+
sendfile off;
25+
26+
# strengthen ssl security
27+
ssl_certificate /etc/letsencrypt/live/<domain>/fullchain.pem;
28+
ssl_certificate_key /etc/letsencrypt/live/<domain>/privkey.pem;
29+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
30+
ssl_prefer_server_ciphers on;
31+
ssl_session_cache shared:SSL:10m;
32+
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
33+
34+
# See the link below for more SSL information:
35+
# https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
36+
#
37+
# ssl_dhparam /etc/ssl/certs/dhparam.pem;
38+
39+
# Add headers to serve security related headers
40+
add_header Strict-Transport-Security "max-age=15768000; preload;";
41+
add_header X-Content-Type-Options nosniff;
42+
add_header X-XSS-Protection "1; mode=block";
43+
add_header X-Robots-Tag none;
44+
add_header Content-Security-Policy "frame-ancestors 'self'";
45+
46+
location / {
47+
try_files $uri $uri/ /index.php?$query_string;
48+
}
49+
50+
location ~ \.php$ {
51+
fastcgi_split_path_info ^(.+\.php)(/.+)$;
52+
fastcgi_pass unix:/run/php/pterodactyl.sock;
53+
fastcgi_index index.php;
54+
include fastcgi_params;
55+
fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
56+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
57+
fastcgi_param HTTP_PROXY "";
58+
fastcgi_intercept_errors off;
59+
fastcgi_buffer_size 16k;
60+
fastcgi_buffers 4 16k;
61+
fastcgi_connect_timeout 300;
62+
fastcgi_send_timeout 300;
63+
fastcgi_read_timeout 300;
64+
include /etc/nginx/fastcgi_params;
65+
}
66+
67+
location ~ /\.ht {
68+
deny all;
69+
}
70+
}

.dev/docker/entrypoint.sh

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
11
#!/bin/ash
2+
## Ensure we are in /app
3+
24
cd /app
35

4-
tini -- php-fpm
6+
## check for .env file and generate app keys if missing
7+
if [ -f /app/var/.env ]; then
8+
echo "external vars exist"
9+
rm /app/.env
10+
ln -s /app/var/.env /app/
11+
else
12+
echo "external vars don't exist"
13+
php artisan key:generate --force
14+
cp /app/.env /app/var/
15+
fi
516

17+
## check for DB up before starting the panel
18+
echo "Checking database status."
619
until nc -z -v -w30 $DB_HOST 3306
20+
721
do
822
echo "Waiting for database connection..."
923
# wait for 5 seconds before check again
1024
sleep 5
1125
done
1226

13-
if [ "$(cat .env)" == "" ]; then
14-
cat /app/.env.example > /app/.env
15-
fi
27+
## make sure the db is set up
28+
php artisan migrate --seed --force
1629

17-
if [ "$(cat .env | grep APP_KEY)" == "APP_KEY=" ]; then
18-
echo "Generating New Key"
19-
php artisan key:generate --force
20-
fi
30+
echo -e "Done\n"
2131

22-
php artisan migrate --seed --force
23-
echo "Done"
24-
nginx -g 'pid /tmp/nginx.pid; daemon off;'
32+
## start php-fpm in the background
33+
echo -e "Starting php-fpm in the background. \n"
34+
php-fpm7 -D
35+
echo -e "php-fpm starte.d \n"
36+
37+
## start webserver
38+
echo -e "Starting nginx in the foreground. \n"
39+
nginx -g 'pid /tmp/nginx.pid; daemon off;'

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ sami.phar
2020
# For local development with docker
2121
# Remove if we ever put the Dockerfile in the repo
2222
.dockerignore
23-
#Dockerfile
24-
docker-compose.yml
23+
2524
# for image related files
2625
misc
2726
.phpstorm.meta.php

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ COPY . ./
99

1010
RUN cp .dev/docker/default.conf /etc/nginx/conf.d/default.conf \
1111
&& cp .dev/docker/www.conf /etc/php7/php-fpm.d/www.conf \
12-
&& cp .env.example .env \
12+
&& echo "APP_ENVIRONMENT_ONLY=false" > /app/.env \
13+
&& echo "APP_KEY=" >> /app/.env \
14+
&& mkdir /var/run/php \
1315
&& composer install --no-dev
1416

1517
EXPOSE 80 443
1618

1719
RUN chown -R nginx:nginx . && chmod -R 777 storage/* bootstrap/cache
1820

19-
ENTRYPOINT ["ash", ".dev/app/entrypoint.sh"]
21+
ENTRYPOINT ["ash", ".dev/docker/entrypoint.sh"]

docker-compose.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: '2'
2+
services:
3+
database:
4+
image: mariadb
5+
volumes:
6+
- "/srv/pterodactyl/database:/var/lib/mysql"
7+
environment:
8+
- "MYSQL_ROOT_PASSWORD=apassword"
9+
- "MYSQL_DATABASE=pterodb"
10+
- "MYSQL_USER=ptero"
11+
- "MYSQL_PASSWORD=pterodbpass"
12+
13+
cache:
14+
image: redis:alpine
15+
16+
panel:
17+
image: quay.io/pterodactyl/panel:latest
18+
ports:
19+
- "80:80"
20+
- "443:443"
21+
links:
22+
- database
23+
- cache
24+
volumes:
25+
- "/srv/pterodactyl/var/:/app/var/"
26+
environment:
27+
## These are defaults and should be left alone
28+
- "APP_ENV=production"
29+
- "APP_DEBUG=false"
30+
- "APP_THEME=pterodactyl"
31+
- "APP_CLEAR_TASKLOG=720"
32+
- "APP_DELETE_MINUTES=10"
33+
- "APP_ENVIRONMENT_ONLY=false"
34+
- "QUEUE_HIGH=high"
35+
- "QUEUE_STANDARD=standard"
36+
- "QUEUE_LOW=low"
37+
- "CACHE_DRIVER=redis"
38+
- "SESSION_DRIVER=redis"
39+
- "QUEUE_DRIVER=redis"
40+
- "REDIS_HOST=cache_1"
41+
- "REDIS_PASSWORD=null"
42+
- "REDIS_PORT=6379"
43+
## Domain settings
44+
- "APP_URL=https://your.domain.here"
45+
## Timezone settings
46+
- "APP_TIMEZONE=America/New_York"
47+
## Service egg settings
48+
- "APP_SERVICE_AUTHOR=noreply@your.domain.here"
49+
## Database settings
50+
- "DB_HOST=database"
51+
- "DB_PORT=3306"
52+
- "DB_DATABASE=pterodb"
53+
- "DB_USERNAME=ptero"
54+
- "DB_PASSWORD=pterodbpass"
55+
## Email settings
56+
- "MAIL_FROM=noreply@your.domain.here"
57+
- "MAIL_DRIVER=smtp"
58+
- "MAIL_HOST=mail"
59+
- "MAIL_PORT=1025"
60+
- "MAIL_USERNAME=''"
61+
- "MAIL_PASSWORD=''"
62+
- "MAIL_ENCRYPTION=true"

0 commit comments

Comments
 (0)