Skip to content

Commit

Permalink
traefik tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adnnor committed Nov 3, 2024
1 parent bb36da8 commit eed8b5d
Show file tree
Hide file tree
Showing 45 changed files with 962 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
COMPOSE_PROJECT_NAME=adnan
COMPOSE_PROJECT_NAME=mood
Empty file added standard-setup/backups/.gitkeep
Empty file.
20 changes: 20 additions & 0 deletions standard-setup/conf/.env-app.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ORO_DB_URL=postgres://root:root@postgres:5432/dev?sslmode=disable&charset=utf8&serverVersion=13.7
ORO_DB_DSN=${ORO_DB_URL}

MESSENGER_TRANSPORT_DSN=rabbitmq://rabbit:rabbit@rabbitmq:5672/%2f/messages


###> search engine config ###
ORO_SEARCH_URL=http://localhost:9200
ORO_SEARCH_ENGINE_DSN=${ORO_SEARCH_URL}?prefix=oro_search
ORO_WEBSITE_SEARCH_ENGINE_DSN=${ORO_SEARCH_URL}?prefix=oro_website_search
###< search engine config ###


###> websocket config ###
ORO_WEBSOCKET_SERVER_DSN=//0.0.0.0:8080
ORO_WEBSOCKET_FRONTEND_DSN=//*:8080/ws
ORO_WEBSOCKET_BACKEND_DSN=tcp://127.0.0.1:8080
###< websocket config ###

APP_DEBUG=1
59 changes: 59 additions & 0 deletions standard-setup/conf/nginx.default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
upstream fastcgi_backend {
server unix:/sock/docker.sock;
}

server {
listen [::]:8000 ipv6only=on;
listen 8000;

root /var/www/html/public;

index index.php;
autoindex off;
charset off;

fastcgi_buffer_size 64k;
fastcgi_buffers 8 128k;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

server {
listen [::]:8443 ssl http2 ipv6only=on;
listen 8443 ssl http2;

ssl_certificate /etc/nginx/certs/nginx.crt;
ssl_certificate_key /etc/nginx/certs/nginx.key;

root /var/www/html/public;

index index.php;
autoindex off;
charset off;

fastcgi_buffer_size 64k;
fastcgi_buffers 8 128k;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

32 changes: 32 additions & 0 deletions standard-setup/conf/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[unix_http_server]
file=/tmp/supervisor.sock

[supervisord]
logfile=/var/log/supervisor/supervisord.log
loglevel=info
pidfile=/var/run/supervisor/supervisord.pid

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:oro_web_socket]
command=/usr/local/bin/php /var/www/html/bin/console gos:websocket:server --env=prod
numprocs=1
autostart=true
autorestart=true
directory=/var/www/html
user=app
redirect_stderr=true

[program:oro_message_consumer]
command=/usr/local/bin/php /var/www/html/bin/console oro:message-queue:consume --env=prod
process_name=%(program_name)s_%(process_num)02d
numprocs=5
autostart=true
autorestart=true
directory=/var/www/html
user=app
redirect_stderr=true
112 changes: 112 additions & 0 deletions standard-setup/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
version: "3"

services:
app:
image: adnnor/nginx:1.18
ports:
- "80:8000"
- "443:8443"
volumes: &appvolumes
- ~/.composer:/var/www/.composer:cached
- ~/.ssh:/var/www/.ssh:cached
- ~/.ssh/known_hosts:/var/www/.ssh/known_hosts:cached
- ./src:/var/www/html:cached
- ./conf/nginx.default.conf:/etc/nginx/conf.d/default.conf:cached
- ./conf/.env-app.local:/var/www/html/.env-app.local:cached
- sockdata:/sock
- ssldata:/etc/nginx/certs

phpfpm:
image: adnnor/php:8.3-fpm
volumes: *appvolumes
networks:
- oro
env_file: env/phpfpm.env

postgres:
image: postgres:latest
command:
- "--max_connections=200"
- "--shared_buffers=256MB"
ports:
- "5432:5432"
env_file: env/postgres.env
networks:
- oro
volumes:
- postgres-data:/var/lib/postgresql/data

supervisor:
image: adnnor/supervisor
volumes:
- ./src:/var/www/html
- ./conf/supervisord.conf:/etc/supervisord.conf
depends_on:
- phpfpm
networks:
- oro
restart: always
command: /bin/sh -c "rm -f /tmp/supervisor.sock && supervisord -n"

pgadmin:
image: dpage/pgadmin4
depends_on:
- postgres
env_file: env/pgadmin.env
networks:
- oro
ports:
- "1435:80"
volumes:
- pgadmin-data:/var/lib/pgadmin
restart: always

elasticsearch:
image: adnnor/elasticsearch:8.4
ports:
- "9200:9200"
- "9300:9300"
env_file: env/elasticsearch.env
environment:
- "discovery.type=single-node"
## Avoid test failures due to small disks
## More info at https://github.com/markshust/docker-magento/issues/488
- "cluster.routing.allocation.disk.threshold_enabled=false"
- "index.blocks.read_only_allow_delete"
## Uncomment to set custom heap size to avoid memory errors
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
## Uncomment to increase the virtual memory map count
- "max_map_count=262144"

redis:
image: redis:6.0-alpine
container_name: redis
ports:
- "6379:6379"

rabbitmq:
image: rabbitmq:3.11-management-alpine
ports:
- "15672:15672"
- "5672:5672"
volumes:
- rabbitmqdata:/var/lib/rabbitmq
env_file: env/rabbitmq.env

mailcatcher:
image: sj26/mailcatcher
ports:
- "1080:1080"

networks:
oro:
driver: bridge

volumes:
appdata:
dbdata:
rabbitmqdata:
pgadmin-data:
sockdata:
ssldata:
postgres-data:
2 changes: 2 additions & 0 deletions standard-setup/env/elasticsearch.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ES_HOST=elasticsearch
ES_PORT=9200
8 changes: 8 additions & 0 deletions standard-setup/env/mailtrap.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=60b0889ecafe2b
MAIL_PASSWORD=83c42e3c27db2d
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="Adnan Shahzad"
2 changes: 2 additions & 0 deletions standard-setup/env/pgadmin.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PGADMIN_DEFAULT_EMAIL=[email protected]
PGADMIN_DEFAULT_PASSWORD=root
1 change: 1 addition & 0 deletions standard-setup/env/phpfpm.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSER_DISABLE_XDEBUG_WARN=1
3 changes: 3 additions & 0 deletions standard-setup/env/postgres.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_USER=root
POSTGRES_PASSWORD=root
POSTGRES_DB=dev
5 changes: 5 additions & 0 deletions standard-setup/env/rabbitmq.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RABBITMQ_HOST=rabbitmq
RABBITMQ_PORT=5672
RABBITMQ_DEFAULT_USER=rabbit
RABBITMQ_DEFAULT_PASS=rabbit
RABBITMQ_DEFAULT_VHOST=/
Empty file added standard-setup/src/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions test/mood/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=mood
Empty file added test/mood/acme.json
Empty file.
20 changes: 20 additions & 0 deletions test/mood/conf/.env-app.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ORO_DB_URL=postgres://root:root@postgres:5432/dev?sslmode=disable&charset=utf8&serverVersion=13.7
ORO_DB_DSN=${ORO_DB_URL}

MESSENGER_TRANSPORT_DSN=rabbitmq://rabbit:rabbit@rabbitmq:5672/%2f/messages


###> search engine config ###
ORO_SEARCH_URL=http://localhost:9200
ORO_SEARCH_ENGINE_DSN=${ORO_SEARCH_URL}?prefix=oro_search
ORO_WEBSITE_SEARCH_ENGINE_DSN=${ORO_SEARCH_URL}?prefix=oro_website_search
###< search engine config ###


###> websocket config ###
ORO_WEBSOCKET_SERVER_DSN=//0.0.0.0:8080
ORO_WEBSOCKET_FRONTEND_DSN=//*:8080/ws
ORO_WEBSOCKET_BACKEND_DSN=tcp://127.0.0.1:8080
###< websocket config ###

APP_DEBUG=1
59 changes: 59 additions & 0 deletions test/mood/conf/nginx.default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
upstream fastcgi_backend {
server unix:/sock/docker.sock;
}

server {
listen [::]:8000 ipv6only=on;
listen 8000;

root /var/www/html/public;

index index.php;
autoindex off;
charset off;

fastcgi_buffer_size 64k;
fastcgi_buffers 8 128k;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

server {
listen [::]:8443 ssl http2 ipv6only=on;
listen 8443 ssl http2;

ssl_certificate /etc/nginx/certs/nginx.crt;
ssl_certificate_key /etc/nginx/certs/nginx.key;

root /var/www/html/public;

index index.php;
autoindex off;
charset off;

fastcgi_buffer_size 64k;
fastcgi_buffers 8 128k;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

32 changes: 32 additions & 0 deletions test/mood/conf/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[unix_http_server]
file=/tmp/supervisor.sock

[supervisord]
logfile=/var/log/supervisor/supervisord.log
loglevel=info
pidfile=/var/run/supervisor/supervisord.pid

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:oro_web_socket]
command=/usr/local/bin/php /var/www/html/bin/console gos:websocket:server --env=prod
numprocs=1
autostart=true
autorestart=true
directory=/var/www/html
user=app
redirect_stderr=true

[program:oro_message_consumer]
command=/usr/local/bin/php /var/www/html/bin/console oro:message-queue:consume --env=prod
process_name=%(program_name)s_%(process_num)02d
numprocs=5
autostart=true
autorestart=true
directory=/var/www/html
user=app
redirect_stderr=true
Loading

0 comments on commit eed8b5d

Please sign in to comment.