Projekt

Obecné

Profil

« Předchozí | Další » 

Revize a60193de

Přidáno uživatelem Tomáš Ballák před asi 4 roky(ů)

Feature Re #7745 nginx configuration

Zobrazit rozdíly:

.vscode/extensions.json
1 1
{
2 2
    "recommendations": [
3
        "ms-vscode-remote.remote-containers"
3
        "ms-vscode-remote.remote-containers",
4
        "vscode-icons-team.vscode-icons",
5
        "ms-azuretools.vscode-docker",
6
        "raynigon.nginx-formatter",
7
        "mads-hartmann.bash-ide-vscode",
8
        "shakram02.bash-beautify"
4 9
    ]
5 10

  
6 11
}
.vscode/settings.json
1
{
2
    "editor.formatOnSave": true
3
}
docker-compose-dev.yml
12 12
               volumes:
13 13
                        - data-db:/data/db
14 14
                        - ./dev-dump:/dev-dump
15
       nginx: 
16
               volumes: 
17
                        - ./docker/nginx/sites-dev:/etc/nginx/sites-available
15 18
volumes:
16 19
    data-db:
17 20
    vscode-extensions-php:
docker-compose-prod.yml
1 1
version: "3.2"
2 2
services:
3 3
       database:
4
               volumes:
5
                        - /database:/data/db
4
                volumes:
5
                         - /database:/data/db
6
       nginx:
7
              ports: 
8
                     - "443:443"
9
              volumes: 
10
                     - /etc/letsencrypt:/root/.acme.sh/heatmap.zcu.cz
11
                     - ./docker/nginx/sites-dev:/etc/nginx/sites-available
docker-compose.yml
42 42
               volumes:
43 43
                       - ./logs/nginx:/var/nginx/log
44 44
                       - ./website/:/var/www/symfony
45
                       - ./docker/nginx/sites:/etc/nginx/sites-available
46

  
45 47
               container_name: "heatmap_nginx"
46 48
       database:
47 49
               image: 'mongo'
docker/nginx/Dockerfile
1 1
FROM nginx:alpine
2 2
COPY nginx.conf /etc/nginx
3 3
COPY conf.d /etc/nginx/conf.d
4
ADD ./sites /etc/nginx/sites-available
4
RUN apk add netcat-openbsd bc curl bash wget openssl; \
5
    apk add libressl; \
6
    wget -O -  https://get.acme.sh | sh;
5 7
WORKDIR /var/www/
6 8
CMD ["nginx"]
docker/nginx/sites-dev/default.conf
1
server {
2
    listen 80 default_server;
3
    listen [::]:80 default_server ipv6only=on;
4

  
5
    server_name localhost;
6
    root /var/www/symfony/public;
7
    index index.php index.html index.htm;
8

  
9
    location / {
10
        try_files $uri $uri/ /index.php$is_args$args;
11
    }
12

  
13
    location ~ \.php$ {
14
        try_files $uri /index.php =404;
15
        fastcgi_pass php-upstream;
16
        fastcgi_index index.php;
17
        fastcgi_buffers 16 16k;
18
        fastcgi_buffer_size 32k;
19
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
20
        fastcgi_read_timeout 600;
21
        include fastcgi_params;
22
    }
23

  
24
    location ~ /\.ht {
25
        deny all;
26
    }
27
}
docker/nginx/sites/default.conf
1 1
server {
2
    listen 443 ssl;
2 3
    listen 80 default_server;
3 4
    listen [::]:80 default_server ipv6only=on;
4 5

  
5
    server_name localhost;
6
    server_name heatmap.zcu.cz www.heatmap.zcu.cz;
7
    ssl_certificate /etc/letsencrypt/heatmap.zcu.cz/heatmap.zcu.cz.cer;
8
    ssl_certificate_key /etc/letsencrypt/heatmap.zcu.cz/privkey.key;
9

  
10
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
11
    ssl_prefer_server_ciphers on;
12
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
13

  
6 14
    root /var/www/symfony/public;
15

  
7 16
    index index.php index.html index.htm;
8 17

  
9 18
    location / {
10
         try_files $uri $uri/ /index.php$is_args$args;
19
        try_files $uri $uri/ /index.php$is_args$args;
11 20
    }
12 21

  
13 22
    location ~ \.php$ {
docker/php-fpm/dev/Dockerfile
1 1
#DEV ONLY DOCKERFILE
2 2
FROM php:7.4-fpm-alpine
3 3
RUN apk update; \
4
	apk upgrade; \
4
    apk upgrade; \
5 5
    apk add --no-cache $PHPIZE_DEPS; \
6 6
    pecl install xdebug-2.9.5; \
7 7
    docker-php-ext-enable xdebug; \
8
	apk add autoconf openssl-dev g++ make && \
9
	pecl install mongodb && \
10
	docker-php-ext-enable mongodb; \
11
	apk del --purge autoconf openssl-dev g++ make;
8
    apk add autoconf openssl-dev g++ make && \
9
    pecl install mongodb && \
10
    docker-php-ext-enable mongodb; \
11
    apk del --purge autoconf openssl-dev g++ make;
12 12
RUN apk add npm;
13 13
RUN echo "**** install PHP Composer ****\n" && \
14 14
    curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
15 15
RUN rm -rf /usr/local/etc/php/conf.d/docker-php-ext-igbinary.ini;
16 16
RUN rm -fr /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini;
17 17
RUN { \
18
        echo '[xdebug]'; \
19
        echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)"; \
20
        echo 'xdebug.remote_enable = 1'; \
21
        echo 'xdebug.remote_port = 9001'; \
22
        echo 'xdebug.remote_autostart = 1'; \
23
        echo 'xdebug.remote_connect_back = 0'; \
24
        echo 'xdebug.remote_host = localhost'; \
25
        echo 'xdebug.idekey = VSCODE'; \
26
        echo 'xdebug.remote_log=/var/www/symfony/xdebug/xdebug.log'; \
18
    echo '[xdebug]'; \
19
    echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)"; \
20
    echo 'xdebug.remote_enable = 1'; \
21
    echo 'xdebug.remote_port = 9001'; \
22
    echo 'xdebug.remote_autostart = 1'; \
23
    echo 'xdebug.remote_connect_back = 0'; \
24
    echo 'xdebug.remote_host = localhost'; \
25
    echo 'xdebug.idekey = VSCODE'; \
26
    echo 'xdebug.remote_log=/var/www/symfony/xdebug/xdebug.log'; \
27 27
    } > /usr/local/etc/php/conf.d/php-config.ini
scripts/dev/build.sh
3 3
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up --build -d
4 4

  
5 5
cat << "EOF"
6
 ______  ______  __    __  ______ ______  ______  ______  ______       __  __   __  ______  ______ ______  __      __        
7
/\  ___\/\  __ \/\ "-./  \/\  == /\  __ \/\  ___\/\  ___\/\  == \     /\ \/\ "-.\ \/\  ___\/\__  _/\  __ \/\ \    /\ \       
8
\ \ \___\ \ \/\ \ \ \-./\ \ \  _-\ \ \/\ \ \___  \ \  __\\ \  __<     \ \ \ \ \-.  \ \___  \/_/\ \\ \  __ \ \ \___\ \ \____  
9
 \ \_____\ \_____\ \_\ \ \_\ \_\  \ \_____\/\_____\ \_____\ \_\ \_\    \ \_\ \_\\"\_\/\_____\ \ \_\\ \_\ \_\ \_____\ \_____\ 
10
  \/_____/\/_____/\/_/  \/_/\/_/   \/_____/\/_____/\/_____/\/_/ /_/     \/_/\/_/ \/_/\/_____/  \/_/ \/_/\/_/\/_____/\/_____/                                                                                                                                                                                                                                                                                                                                                                                                                                      
6
 ______  ______  __    __  ______ ______  ______  ______  ______       __  __   __  ______  ______ ______  __      __
7
/\  ___\/\  __ \/\ "-./  \/\  == /\  __ \/\  ___\/\  ___\/\  == \     /\ \/\ "-.\ \/\  ___\/\__  _/\  __ \/\ \    /\ \
8
\ \ \___\ \ \/\ \ \ \-./\ \ \  _-\ \ \/\ \ \___  \ \  __\\ \  __<     \ \ \ \ \-.  \ \___  \/_/\ \\ \  __ \ \ \___\ \ \____
9
 \ \_____\ \_____\ \_\ \ \_\ \_\  \ \_____\/\_____\ \_____\ \_\ \_\    \ \_\ \_\\"\_\/\_____\ \ \_\\ \_\ \_\ \_____\ \_____\
10
  \/_____/\/_____/\/_/  \/_/\/_/   \/_____/\/_____/\/_____/\/_/ /_/     \/_/\/_/ \/_/\/_____/  \/_/ \/_/\/_/\/_____/\/_____/
11 11
EOF
12 12
docker-compose exec php-fpm composer config extra.symfony.allow-contrib true --no-interaction --working-dir=/var/www/symfony
13 13
docker-compose exec php-fpm composer update --no-interaction --working-dir=/var/www/symfony
14 14
docker-compose exec php-fpm composer install --no-interaction --working-dir=/var/www/symfony
15 15

  
16 16
cat << "EOF"
17
 ________    ________   _____ ______           ___   ________    ________   _________   ________   ___        ___          
18
|\   ___  \ |\   __  \ |\   _ \  _   \        |\  \ |\   ___  \ |\   ____\ |\___   ___\|\   __  \ |\  \      |\  \         
19
\ \  \\ \  \\ \  \|\  \\ \  \\\__\ \  \       \ \  \\ \  \\ \  \\ \  \___|_\|___ \  \_|\ \  \|\  \\ \  \     \ \  \        
20
 \ \  \\ \  \\ \   ____\\ \  \\|__| \  \       \ \  \\ \  \\ \  \\ \_____  \    \ \  \  \ \   __  \\ \  \     \ \  \       
21
  \ \  \\ \  \\ \  \___| \ \  \    \ \  \       \ \  \\ \  \\ \  \\|____|\  \    \ \  \  \ \  \ \  \\ \  \____ \ \  \____  
17
 ________    ________   _____ ______           ___   ________    ________   _________   ________   ___        ___
18
|\   ___  \ |\   __  \ |\   _ \  _   \        |\  \ |\   ___  \ |\   ____\ |\___   ___\|\   __  \ |\  \      |\  \
19
\ \  \\ \  \\ \  \|\  \\ \  \\\__\ \  \       \ \  \\ \  \\ \  \\ \  \___|_\|___ \  \_|\ \  \|\  \\ \  \     \ \  \
20
 \ \  \\ \  \\ \   ____\\ \  \\|__| \  \       \ \  \\ \  \\ \  \\ \_____  \    \ \  \  \ \   __  \\ \  \     \ \  \
21
  \ \  \\ \  \\ \  \___| \ \  \    \ \  \       \ \  \\ \  \\ \  \\|____|\  \    \ \  \  \ \  \ \  \\ \  \____ \ \  \____
22 22
   \ \__\\ \__\\ \__\     \ \__\    \ \__\       \ \__\\ \__\\ \__\ ____\_\  \    \ \__\  \ \__\ \__\\ \_______\\ \_______\
23 23
    \|__| \|__| \|__|      \|__|     \|__|        \|__| \|__| \|__||\_________\    \|__|   \|__|\|__| \|_______| \|_______|
24 24
                                                                   \|_________|
25 25
EOF
26
docker-compose exec php-fpm /bin/sh -c 'cd /var/www/symfony && npm install' 
26
docker-compose exec php-fpm /bin/sh -c 'cd /var/www/symfony && npm install'
scripts/renew_certificate.sh
1
#!/bin/bash
2
# Usage
3
# if you want create new license run: renew_certificate new
4
# if you want re-create the existing license run: renew_certificate
5

  
6
if [ "$1" = "new" ]; then
7
    docker-compose exec nginx /bin/sh -c "
8
    cd /etc/letsencrypt && mkdir heatmap.zcu.cz && cd heatmap.zcu.cz; \
9
    openssl dhparam -dsaparam -out dhparams.pem 4096; \
10
    bash /root/.acme.sh/acme.sh --issue -w /var/www/symfony -d heatmap.zcu.cz -k 4096; \
11
    bash /root/.acme.sh/acme.sh --installcert -d heatmap.zcu.cz \
12
    --key-file /root/.acme.sh/heatmap.zcu.cz/heatmap.zcu.cz.key \
13
    --fullchain-file /root/.acme.sh/heatmap.zcu.cz/fullchain.cer \
14
    --reloadcmd 'bash /etc/init.d/nginx reload';
15
    ";
16
else
17
    docker-compose exec nginx /bin/sh -c "acme.sh --renew -d heatmap.zcu.cz";
18
fi

Také k dispozici: Unified diff