feat: init
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
|
||||
FROM debian:11
|
||||
|
||||
RUN apt-get update && apt-get -y install cron
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
nginx
|
||||
|
||||
RUN apt-get update && apt-get install -y wget
|
||||
|
||||
RUN rm /etc/nginx/sites-enabled/default
|
||||
|
||||
RUN usermod -u 1000 www-data
|
||||
|
||||
RUN apt-get remove certbot
|
||||
RUN apt-get install -y python3 python3-venv libaugeas0
|
||||
RUN python3 -m venv /opt/certbot/
|
||||
RUN /opt/certbot/bin/pip install --upgrade pip
|
||||
RUN /opt/certbot/bin/pip install certbot
|
||||
RUN ln -s /opt/certbot/bin/certbot /usr/bin/certbot
|
||||
|
||||
ADD docker/twake-nginx-php-only/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Install yarn
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install curl
|
||||
RUN apt-get -y install apt-transport-https ca-certificates apt-utils gnupg
|
||||
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install yarn
|
||||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
|
||||
RUN apt-get install -y nodejs
|
||||
RUN yarn global add webpack
|
||||
RUN yarn global add webpack-cli
|
||||
RUN apt-get update
|
||||
RUN apt-get -y install git
|
||||
|
||||
# Install php
|
||||
|
||||
ADD docker/twake-nginx/site.conf /etc/nginx/sites-available/site.template
|
||||
ADD docker/twake-nginx-php-only/nginx.conf /etc/nginx/nginx.conf
|
||||
RUN apt-get update && apt-get install gettext-base
|
||||
|
||||
RUN echo "upstream php-upstream { server php:9000; }" > /etc/nginx/conf.d/upstream.conf
|
||||
|
||||
COPY docker/twake-nginx-php-only/entrypoint.sh /
|
||||
RUN chmod 0777 /entrypoint.sh
|
||||
ENTRYPOINT /entrypoint.sh
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
NODE_HOST="${NODE_HOST:-http://node:3000}"
|
||||
PHP_UPSTREAM="${PHP_UPSTREAM:-php:9000}"
|
||||
export NODE_HOST
|
||||
export PHP_UPSTREAM
|
||||
envsubst '$${NODE_HOST}' < /etc/nginx/sites-available/site.template > /etc/nginx/sites-enabled/site
|
||||
echo "upstream php-upstream { server ${PHP_UPSTREAM}; }" > /etc/nginx/conf.d/upstream.conf
|
||||
|
||||
cron -f &
|
||||
nginx -g "daemon off;"
|
||||
@@ -0,0 +1,65 @@
|
||||
user www-data;
|
||||
worker_processes 4;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
client_max_body_size 200M;
|
||||
|
||||
##
|
||||
# Basic Settings
|
||||
##
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
# server_tokens off;
|
||||
|
||||
# server_names_hash_bucket_size 64;
|
||||
# server_name_in_redirect off;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
##
|
||||
# SSL Settings
|
||||
##
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
##
|
||||
# Logging Settings
|
||||
##
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
##
|
||||
|
||||
gzip on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
# gzip_vary on;
|
||||
# gzip_proxied any;
|
||||
# gzip_comp_level 6;
|
||||
# gzip_buffers 16 8k;
|
||||
# gzip_http_version 1.1;
|
||||
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/sites-enabled/*;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /twake-core/web;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000";
|
||||
|
||||
location / {
|
||||
return 302 https://web.twake.app/;
|
||||
}
|
||||
|
||||
location ~ ^/(internal|plugins).* {
|
||||
proxy_pass http://node:3000;
|
||||
}
|
||||
|
||||
location ~ ^/(api|administration)/v2/.* {
|
||||
proxy_pass http://node:3000;
|
||||
}
|
||||
|
||||
location ~ ^/socket/.* {
|
||||
proxy_pass http://node:3000;
|
||||
# this magic is needed for WebSocket
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_connect_timeout 7d;
|
||||
proxy_send_timeout 7d;
|
||||
proxy_read_timeout 7d;
|
||||
}
|
||||
|
||||
location ~ ^/(ajax|api|administration|upload|bundle|medias).* {
|
||||
# try to serve file directly, fallback to rewrite
|
||||
try_files $uri @rewriteapp;
|
||||
}
|
||||
|
||||
location @rewriteapp {
|
||||
# rewrite all to app.php
|
||||
rewrite ^(.*)$ /app.php/$1 last;
|
||||
}
|
||||
|
||||
location ~ /.well-known {
|
||||
allow all;
|
||||
}
|
||||
|
||||
location ~ ^/(app|app_dev|config|dev\/.*)\.php(/|$) {
|
||||
fastcgi_pass php-upstream;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param HTTPS off;
|
||||
fastcgi_buffer_size 128k;
|
||||
fastcgi_buffers 4 256k;
|
||||
fastcgi_busy_buffers_size 256k;
|
||||
}
|
||||
|
||||
location ~ /.well-known {
|
||||
allow all;
|
||||
}
|
||||
|
||||
error_log /var/log/nginx/twakeapp_dev_error.log;
|
||||
access_log /var/log/nginx/twakeapp_dev_access.log;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user