Open sunilit42 opened 1 year ago
Hi More simple way to setup domain is use nginx proxy in the root host
you can use simple docker-compose.yml
version: '3.6'
services:
packeton:
image: packeton/packeton:latest
container_name: packeton
hostname: packeton
ports:
- '127.0.0.1:8089:80'
environment:
TRUSTED_PROXIES: 172.16.0.0/12
DATABASE_URL: "mysql://app:!ChangeMe!@ec2-host.example.com:3306/app?serverVersion=8&charset=utf8mb4"
volumes:
- .docker:/data
Then you need to nginx / apache to the root host and proxy request to local 8089 port - where 8089
ports:
- '127.0.0.1:8089:80'
Example nginx proxy config is
server {
listen 443 ssl http2;
server_name satis.example.org;
ssl on;
ssl_certificate /etc/letsencrypt/live/satis.example.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/satis.example.org/privkey.pem; # managed by Certbot
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES128-GCM-SHA256:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256!RC4:!aNULL:!eNULL:!MD5:!EXPORT:!LOW:!SEED:!CAMELLIA:!IDEA:!PSK:!SRP:!SSLv2';
add_header Strict-Transport-Security max-age=15768000;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8089;
proxy_read_timeout 90;
}
}
server {
if ($host = satis.example.org) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
return 301 https://$host$request_uri;
server_name satis.example.org;
}
The second why is use jwilder/nginx-proxy
docker image to step up nginx proxy via docker. Also you may to use jrcs/letsencrypt-nginx-proxy-companion
docker to get letsencrypt
version: '3.6'
services:
packeton:
image: packeton/packeton:latest
container_name: packeton
hostname: packeton
ports:
- '127.0.0.1:8089:80'
environment:
VIRTUAL_HOST: satis.example.com
LETSENCRYPT_HOST: satis.example.com
LETSENCRYPT_EMAIL: sysadmin@example.com
TRUSTED_PROXIES: 172.16.0.0/12
DATABASE_URL: "mysql://app:!ChangeMe!@ec2-host.example.com:3306/app?serverVersion=8&charset=utf8mb4"
volumes:
- .docker:/data
networks:
default:
external:
name: webproxy
Where VIRTUAL_HOST, LETSENCRYPT_HOST, LETSENCRYPT_EMAIL used for jrcs/letsencrypt-nginx-proxy-companion
jwilder/nginx-proxy
See docs https://hub.docker.com/r/jwilder/nginx-proxy
https://github.com/jwilder/docker-letsencrypt-nginx-proxy-companion
I think we need to map - ./src/nginx.conf.sample:/var/www/html/nginx.conf:cached something right?
Hello,
I try to below way but not working `version: '2.2'
x-volumes: &default-volume volumes:
x-restart-policy: &restart_policy restart: unless-stopped
x-environment: &default-environment REDIS_URL: redis://redis DATABASE_URL: "postgresql://packeton:pack123@postgres:5432/packeton?serverVersion=14&charset=utf8" SKIP_INIT: 1
services: redis: image: redis:7-alpine hostname: redis <<: *restart_policy volumes:
redis-data:/data
postgres: image: postgres:14-alpine hostname: postgres <<: *restart_policy volumes:
postgres-data:/var/lib/postgresql/data environment: POSTGRES_USER: packeton POSTGRES_PASSWORD: pack123 POSTGRES_DB: packeton
php-fpm: image: packeton/packeton:latest hostname: php-fpm command: ['php-fpm', '-F'] <<: restart_policy <<: default-volume environment: <<: *default-environment SKIP_INIT: 0 WAIT_FOR_HOST: 'postgres:5432' depends_on:
"redis"
nginx: image: packeton/packeton:latest hostname: nginx volumes:
"php-fpm"
worker: image: packeton/packeton:latest hostname: packeton-worker command: ['bin/console', 'packagist:run-workers', '-v'] user: www-data <<: restart_policy <<: default-volume environment: <<: *default-environment WAIT_FOR_HOST: 'php-fpm:9000' depends_on:
"php-fpm"
cron: image: packeton/packeton:latest hostname: packeton-cron command: ['bin/console', 'okvpn:cron', '--demand', '--time-limit=3600'] user: www-data <<: restart_policy <<: default-volume environment: <<: *default-environment WAIT_FOR_HOST: 'php-fpm:9000' depends_on:
volumes: redis-data: postgres-data: app-data: app-var: `
And nginx-tpl.conf file
`daemon off; user www-data; worker_processes auto; pid /run/nginx.pid;
events { worker_connections 768; }
http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048;
server_tokens off;
default_type application/octet-stream;
include /etc/nginx/mime.types;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log off;
gzip on;
gzip_disable "msie6";
client_max_body_size 10M;
server {
server_name repo.custom.com;
listen 80 default_server;
root /var/www/packagist/public;
location / {
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
fastcgi_buffers 128 128k;
fastcgi_buffer_size 256k;
location ~ ^/index\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
send_timeout 600;
fastcgi_read_timeout 600;
fastcgi_pass _PHP_FPM_HOST_;
}
location ~ \.php$ {
return 404;
}
access_log off;
}
} `
Hi
Must be version: '3.9'
ERROR: Version in "./docker-compose-prod.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the services
key, or omit the version
key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
In your composer file I added volumes:
Hi, please use the simple single docker container or update docker-compose
https://github.com/vtsykun/packeton/blob/master/docker-compose.yml
Also nginx configuration was loaded from /etc/nginx
The volumes will be ignore
@vtsykun how i can set the custom domain without modifying ngix file? that's why I m doing volume mapping using that I can setup domain name
Hi, can you install nginx/apache on the root host? more simple to reverse proxy on host machine to setup ssl and custom domain, no need to change docker nginx configuration to setup custom domain.
Hello,
I try to set custom domain into ngix file so i need to use docker-compose-prod.yml but when i use docker-compose-prod.yml, it is not working
Version in "./docker-compose-prod.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the
services
key, or omit theversion
key and place your service definitions at the root of the file to use version 1. For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/My docker version : Docker version 20.10.18, build b40c2f6