🔨 REFACTOR: Ready for Migrations

This commit is contained in:
2025-02-01 12:52:54 +00:00
parent da01b2b587
commit 56756d7c85
12 changed files with 106 additions and 861 deletions

22
.env
View File

@@ -26,3 +26,25 @@ SMTP_SECURE_CONNECTION='true' # Not in use
# ======= GraphQl ============= # ======= GraphQl =============
GRAPHQL_DEBUG='true' GRAPHQL_DEBUG='true'
GRAPHQL_TRACING='true' GRAPHQL_TRACING='true'
# ======= Integrations =============
# Bill Bee
BILL_BEE_ACTIVE='true'
BILL_BEE_API_KEY='200EEBAD-06E8-4184-B430-3428D6447B92'
BILL_BEE_API_USERNAME="yuri.lima"
BILL_BEE_API_SECRET='YTB6tgm.dzb0ntf@zqr'
BILL_BEE_API_URL='https://api.billbee.io/api/v1'
# Channel Pilot Pro
CHANNEL_PILOT_PRO_ACTIVE='true'
CHANNEL_PILOT_PRO_URL='https://capi.channelpilot.com'
CHANNEL_PILOT_PRO_API_MERCHANT_ID=''
CHANNEL_PILOT_PRO_API_TOKEN=''
CHANNEL_PILOT_PRO_ACCESS_TOKEN=''
CHANNEL_PILOT_PRO_EXPIRED_AT=''
# Shopify
SHOPIFY_ACTIVE='true'
SHOPIFY_HOST_NAME='https://phxerpdev.myshopify.com/admin/api/2024-10/graphql.json'
SHOPIFY_API_KEY='159142eaee1b747e5cb084cc77564b3e'
SHOPIFY_API_SECRET='1be9e99cad669092247f8735da3e0570'
SHOPIFY_TOKEN='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'
SHOPIFY_HOST_SCHEME='https'
SHOPIFY_IS_EMBEDDED_APP='true'

View File

@@ -73,6 +73,24 @@ services:
- ENV_MODE=${ENV_MODE} - ENV_MODE=${ENV_MODE}
- NODE_ENV=${NODE_ENV} - NODE_ENV=${NODE_ENV}
- SMTP_TLS_CIPHERS={SMTP_TLS_CIPHERS} - SMTP_TLS_CIPHERS={SMTP_TLS_CIPHERS}
- BILL_BEE_ACTIVE=${BILL_BEE_ACTIVE}
- BILL_BEE_API_KEY=${BILL_BEE_API_KEY}
- BILL_BEE_API_USERNAME=${BILL_BEE_API_USERNAME}
- BILL_BEE_API_SECRET=${BILL_BEE_API_SECRET}
- BILL_BEE_API_URL=${BILL_BEE_API_URL}
- CHANNEL_PILOT_PRO_ACTIVE=${CHANNEL_PILOT_PRO_ACTIVE}
- CHANNEL_PILOT_PRO_URL=${CHANNEL_PILOT_PRO_URL}
- CHANNEL_PILOT_PRO_API_MERCHANT_ID=${CHANNEL_PILOT_PRO_API_MERCHANT_ID}
- CHANNEL_PILOT_PRO_API_TOKEN=${CHANNEL_PILOT_PRO_API_TOKEN}
- CHANNEL_PILOT_PRO_ACCESS_TOKEN=${CHANNEL_PILOT_PRO_ACCESS_TOKEN}
- CHANNEL_PILOT_PRO_EXPIRED_AT=${CHANNEL_PILOT_PRO_EXPIRED_AT}
- SHOPIFY_ACTIVE=${SHOPIFY_ACTIVE}
- SHOPIFY_HOST_NAME=${SHOPIFY_HOST_NAME}
- SHOPIFY_API_KEY=${SHOPIFY_API_KEY}
- SHOPIFY_API_SECRET=${SHOPIFY_API_SECRET}
- SHOPIFY_HOST_SCHEME=${SHOPIFY_HOST_SCHEME}
- SHOPIFY_IS_EMBEDDED_APP=${SHOPIFY_IS_EMBEDDED_APP}
command: ["npm", "run", "start:server"] command: ["npm", "run", "start:server"]
deploy: deploy:
replicas: 1 #change here if u want to have more replicas. Cant find a way to set via variable right now replicas: 1 #change here if u want to have more replicas. Cant find a way to set via variable right now
@@ -129,6 +147,8 @@ services:
network_mode: host network_mode: host
pid: host pid: host
restart: unless-stopped restart: unless-stopped
ports:
- "9100:9100"
command: command:
- "--path.procfs=/host/proc" - "--path.procfs=/host/proc"
- "--path.sysfs=/host/sys" - "--path.sysfs=/host/sys"

View File

@@ -1,190 +0,0 @@
version: "2.1"
services:
postgres:
restart: always
image: "postgres:15.1-alpine"
container_name: phoenixDB
ports:
- "5432:5432"
environment:
- DEBUG=false
- POSTGRES_DB=phoenix
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
volumes:
- "db-data:/var/lib/postgresql/data"
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 5s
timeout: 2s
retries: 5
networks:
- postgres
pgadmin:
restart: always
image: dpage/pgadmin4
container_name: pgadmin_container
environment:
PGADMIN_DEFAULT_EMAIL: "pgadmin4@pgadmin.org"
PGADMIN_DEFAULT_PASSWORD: '${PGADMIN_DEFAULT_PASSWORD}'
PGADMIN_CONFIG_SERVER_MODE: 'False'
ports:
- "${PGADMIN_PORT:-5050}:80"
volumes:
- "pgadmin:/var/lib/pgadmin"
networks:
- postgres
phoenix-app:
restart: always
image: "yurimatoslima/phoenix-frontend:alpha"
container_name: phoenixAppProd
volumes:
- "/app_custom:/usr/share/nginx/html/assets/custom"
# - "/nginx/nginx.conf:/etc/nginx/nginx.conf" # Not working !!!!!!!!!
# - phxnginx:/etc/nginx
ports:
- "8081:80"
# - "443:443"
labels:
- "traefik.enable=true"
- "traefik.http.routers.phxalpha.entrypoints=https"
- "traefik.http.routers.phxalpha.rule=Host(`alpha.phx-erp.de`)"
- "traefik.http.routers.phxalpha.middlewares=secHeaders@file"
- "traefik.http.routers.phxalpha.tls=true"
- "traefik.http.routers.phxalpha.tls.certresolver=http"
- "traefik.http.routers.phxalpha.service=phxalpha"
- "traefik.http.services.phxalpha.loadbalancer.server.port=80"
- "traefik.docker.network=proxy"
- "traefik.http.routers.phxalpha-insecure.entrypoints=http"
- "traefik.http.routers.phxalpha-insecure.rule=Host(`alpha.phx-erp.de`)"
- "traefik.http.routers.phxalpha-insecure.tls=false"
networks:
- proxy
- postgres
depends_on:
- phoenix-system
phoenix-system:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
# container_name: phoenixSystemProd
# env_file: .env
environment:
- DB_HOST=phoenixDB
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- DB_USERNAME=postgres
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- RUN_JOB_QUEUE=${RUN_JOB_QUEUE}
- SMTP_FROM=${SMTP_FROM}
- SMTP_TYPE=${SMTP_TYPE}
- SMTP_NAME=${SMTP_NAME}
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_SECURE=${SMTP_SECURE}
- SMTP_USER=${SMTP_USER}
- SMTP_PASS=${SMTP_PASS}
- SMTP_LOGGING=${SMTP_LOGGING}
- SMTP_DEBUG=${SMTP_DEBUG}
- SMTP_TLS_REJECT_UNAUTHORIZED=${SMTP_TLS_REJECT_UNAUTHORIZED}
- SMTP_SECURE_CONNECTION=${SMTP_SECURE_CONNECTION}
- ENV_MODE=${ENV_MODE}
- SMTP_TLS_CIPHERS=SSLv3={SMTP_TLS_CIPHERS}
command: [ "npm", "run", "start:server" ]
# ports:
# - "3000:3000"
# - "3400:3400"
# - "9615:9615"
# - "587:587" # Email Port
depends_on:
postgres:
condition: service_healthy
volumes:
- "asset-data:/usr/src/app/packages/dev-server/assets"
- "/server_custom:/usr/src/app/packages/dev-server/custom" # it seems tobe no effect if we make changes, not 100% of sure!
networks:
- postgres
deploy:
replicas: 1
phoenix-worker:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
environment:
- DB_HOST=phoenixDB
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- DB_USERNAME=postgres
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- REDIS_PASSWORD=${REDIS_PASSWORD}
command: [ "npm", "run", "start:worker" ]
depends_on:
postgres:
condition: service_healthy
volumes:
# - "/opt/containers/phx/assets:/usr/src/app/packages/dev-server/custo/assets"
# - "asset-data:/usr/src/app/packages/dev-server/assets"
- "/server_custom:/usr/src/app/packages/dev-server/custom"
networks:
- postgres
phoenix-redis:
image: 'bitnami/redis:latest'
container_name: redis
#command: redis-server --save 20 1 --appendonly no --requirepass ${REDIS_PASSWORD} --loglevel warning
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb
user: root
# privileged: true
# ports:
# - 6379:6379
restart: always
environment:
# REDIS_APPENDFSYNC: "always"
ALLOW_EMPTY_PASSWORD: "no"
# REDIS_DISABLE_COMMANDS: FLUSHDB,FLUSHALL,CONFIG
REDIS_PASSWORD: ${REDIS_PASSWORD}
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
networks:
- postgres
volumes:
- /redis/data:/bitnami/redis/data
https_portal:
container_name: https_portal
image: "steveltn/https-portal:1.21"
restart: unless-stopped
user: "root"
networks:
- postgres # primary network [external]
- proxy # internal network
ports:
- "80:80"
- "443:443"
environment:
STAGE: "production" # Use Let's Encrypt production server
WEBSOCKET: "true" # Enable websocket support
DEBUG: "true"
RENEW_MARGIN_DAYS: 30
# FORCE_RENEW: 'true'
DOMAINS:
volumes:
- ./volumes/https_portal/data:/var/lib/https-portal # ssl_certs, vhost.d, htdocs
- ./volumes/https_portal/log:/var/log/nginx # nginx logs
depends_on:
- phoenix-app
- phoenix-system
- pgadmin
- phoenix-redis
- postgres
volumes:
db-data: null
app-data: null
asset-data: null
pgadmin: null
networks:
postgres:
name: postgres
driver: bridge
proxy:
name: proxy
driver: bridge

View File

@@ -1,161 +0,0 @@
version: "2.1"
services:
postgres:
restart: always
image: "postgres:15.1-alpine"
container_name: phoenixDB
networks:
- backend
ports:
- "5432:5432"
environment:
- DEBUG=false
- POSTGRES_DB=phoenix
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
volumes:
- "./database:/var/lib/postgresql/data"
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 5s
timeout: 2s
retries: 5
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin_container
networks:
- backend
- frontend
environment:
PGADMIN_DEFAULT_EMAIL: "pgadmin4@pgadmin.org"
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
PGADMIN_CONFIG_SERVER_MODE: 'False'
ports:
- "${PGADMIN_PORT:-5050}:80"
volumes:
- "./pgadmin:/var/lib/pgadmin"
phoenix-app:
restart: always
image: "yurimatoslima/phoenix-frontend:alpha"
container_name: phoenixApp
volumes:
- "./app_custom:/usr/share/nginx/html/assets/custom"
networks:
- backend # primary network [external]
- frontend # internal network
depends_on:
- phoenix-system
phoenix-system:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
environment:
- "DB_HOST=phoenixDB"
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- "DB_USERNAME=postgres"
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- "REDIS_PASSWORD=${REDIS_PASSWORD}"
- RUN_JOB_QUEUE=${RUN_JOB_QUEUE}
- SMTP_FROM=${SMTP_FROM}
- SMTP_TYPE=${SMTP_TYPE}
- SMTP_NAME=${SMTP_NAME}
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_SECURE=${SMTP_SECURE}
- SMTP_USER=${SMTP_USER}
- SMTP_PASS=${SMTP_PASS}
- SMTP_LOGGING=${SMTP_LOGGING}
- SMTP_DEBUG=${SMTP_DEBUG}
- SMTP_TLS_REJECT_UNAUTHORIZED=${SMTP_TLS_REJECT_UNAUTHORIZED}
- SMTP_SECURE_CONNECTION=${SMTP_SECURE_CONNECTION}
- ENV_MODE=${ENV_MODE}
- SMTP_TLS_CIPHERS={SMTP_TLS_CIPHERS}
command: ["npm", "run", "start:server"]
deploy:
replicas: 1 #change here if u want to have more replicas. Cant find a way to set via variable right now
networks:
- backend
depends_on:
postgres:
condition: service_healthy
phoenix-redis:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-worker:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
networks:
- backend
environment:
- DB_HOST=phoenixDB
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- DB_USERNAME=postgres
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- REDIS_PASSWORD=${REDIS_PASSWORD}
command: ["npm", "run", "start:worker"]
depends_on:
postgres:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-redis:
image: 'bitnami/redis:latest'
container_name: redis
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb
user: root
networks:
- backend
restart: always
environment:
ALLOW_EMPTY_PASSWORD: "no"
REDIS_DISABLE_COMMANDS: FLUSHDB,FLUSHALL,CONFIG
REDIS_PASSWORD: ${REDIS_PASSWORD}
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
volumes:
- "./redis/data:/bitnami/redis/data"
https_portal:
container_name: https_portal
image: "steveltn/https-portal:1.21"
restart: unless-stopped
user: "root"
networks:
- frontend # [ PgAdmin, Phoenix-App ]
- external # [ Outside of the World]
ports:
- "80:80"
- "443:443"
# - host:container
environment:
STAGE: "production" # Use Let's Encrypt production server
WEBSOCKET: "true" # Enable websocket support
DEBUG: "true"
RENEW_MARGIN_DAYS: 30
CLIENT_MAX_BODY_SIZE: 0
# FORCE_RENEW: 'true'
DOMAINS:
volumes:
- ./https_portal/data:/var/lib/https-portal # ssl_certs, vhost.d, htdocs
- ./https_portal/log:/var/log/nginx # nginx logs
depends_on:
- phoenix-app
- phoenix-system
- pgadmin
- phoenix-redis
- postgres
networks:
backend:
driver: bridge
external: false
frontend:
driver: bridge
external: false
external:
driver: bridge
external: true

View File

@@ -1,161 +0,0 @@
version: "2.1"
services:
postgres:
restart: always
image: "postgres:15.1-alpine"
container_name: phoenixDB
networks:
- backend
ports:
- "5432:5432"
environment:
- DEBUG=false
- POSTGRES_DB=phoenix
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
volumes:
- "./database:/var/lib/postgresql/data"
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 5s
timeout: 2s
retries: 5
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin_container
networks:
- backend
- frontend
environment:
PGADMIN_DEFAULT_EMAIL: "pgadmin4@pgadmin.org"
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
PGADMIN_CONFIG_SERVER_MODE: 'False'
ports:
- "${PGADMIN_PORT:-5050}:80"
volumes:
- "./pgadmin:/var/lib/pgadmin"
phoenix-app:
restart: always
image: "yurimatoslima/phoenix-frontend:alpha"
container_name: phoenixApp
volumes:
- "./app_custom:/usr/share/nginx/html/assets/custom"
networks:
- backend # primary network [external]
- frontend # internal network
depends_on:
- phoenix-system
phoenix-system:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
environment:
- "DB_HOST=phoenixDB"
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- "DB_USERNAME=postgres"
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- "REDIS_PASSWORD=${REDIS_PASSWORD}"
- RUN_JOB_QUEUE=${RUN_JOB_QUEUE}
- SMTP_FROM=${SMTP_FROM}
- SMTP_TYPE=${SMTP_TYPE}
- SMTP_NAME=${SMTP_NAME}
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_SECURE=${SMTP_SECURE}
- SMTP_USER=${SMTP_USER}
- SMTP_PASS=${SMTP_PASS}
- SMTP_LOGGING=${SMTP_LOGGING}
- SMTP_DEBUG=${SMTP_DEBUG}
- SMTP_TLS_REJECT_UNAUTHORIZED=${SMTP_TLS_REJECT_UNAUTHORIZED}
- SMTP_SECURE_CONNECTION=${SMTP_SECURE_CONNECTION}
- ENV_MODE=${ENV_MODE}
- SMTP_TLS_CIPHERS={SMTP_TLS_CIPHERS}
command: ["npm", "run", "start:server"]
deploy:
replicas: 1 #change here if u want to have more replicas. Cant find a way to set via variable right now
networks:
- backend
depends_on:
postgres:
condition: service_healthy
phoenix-redis:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-worker:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
networks:
- backend
environment:
- DB_HOST=phoenixDB
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- DB_USERNAME=postgres
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- REDIS_PASSWORD=${REDIS_PASSWORD}
command: ["npm", "run", "start:worker"]
depends_on:
postgres:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-redis:
image: 'bitnami/redis:latest'
container_name: redis
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb
user: root
networks:
- backend
restart: always
environment:
ALLOW_EMPTY_PASSWORD: "no"
REDIS_DISABLE_COMMANDS: FLUSHDB,FLUSHALL,CONFIG
REDIS_PASSWORD: ${REDIS_PASSWORD}
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
volumes:
- "./redis/data:/bitnami/redis/data"
https_portal:
container_name: https_portal
image: "steveltn/https-portal:1.21"
restart: unless-stopped
user: "root"
networks:
- frontend # [ PgAdmin, Phoenix-App ]
- external # [ Outside of the World]
ports:
- "80:80"
- "443:443"
# - host:container
environment:
STAGE: "production" # Use Let's Encrypt production server
WEBSOCKET: "true" # Enable websocket support
DEBUG: "true"
RENEW_MARGIN_DAYS: 30
CLIENT_MAX_BODY_SIZE: 0
# FORCE_RENEW: 'true'
DOMAINS:
volumes:
- ./https_portal/data:/var/lib/https-portal # ssl_certs, vhost.d, htdocs
- ./https_portal/log:/var/log/nginx # nginx logs
depends_on:
- phoenix-app
- phoenix-system
- pgadmin
- phoenix-redis
- postgres
networks:
backend:
driver: bridge
external: false
frontend:
driver: bridge
external: false
external:
driver: bridge
external: true

View File

@@ -1,161 +0,0 @@
version: "2.1"
services:
postgres:
restart: always
image: "postgres:15.1-alpine"
container_name: phoenixDB
networks:
- backend
ports:
- "5432:5432"
environment:
- DEBUG=false
- POSTGRES_DB=phoenix
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
volumes:
- "./database:/var/lib/postgresql/data"
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 5s
timeout: 2s
retries: 5
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin_container
networks:
- backend
- frontend
environment:
PGADMIN_DEFAULT_EMAIL: "pgadmin4@pgadmin.org"
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
PGADMIN_CONFIG_SERVER_MODE: 'False'
ports:
- "${PGADMIN_PORT:-5050}:80"
volumes:
- "./pgadmin:/var/lib/pgadmin"
phoenix-app:
restart: always
image: "yurimatoslima/phoenix-frontend:alpha"
container_name: phoenixApp
volumes:
- "./app_custom:/usr/share/nginx/html/assets/custom"
networks:
- backend # primary network [external]
- frontend # internal network
depends_on:
- phoenix-system
phoenix-system:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
environment:
- "DB_HOST=phoenixDB"
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- "DB_USERNAME=postgres"
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- "REDIS_PASSWORD=${REDIS_PASSWORD}"
- RUN_JOB_QUEUE=${RUN_JOB_QUEUE}
- SMTP_FROM=${SMTP_FROM}
- SMTP_TYPE=${SMTP_TYPE}
- SMTP_NAME=${SMTP_NAME}
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_SECURE=${SMTP_SECURE}
- SMTP_USER=${SMTP_USER}
- SMTP_PASS=${SMTP_PASS}
- SMTP_LOGGING=${SMTP_LOGGING}
- SMTP_DEBUG=${SMTP_DEBUG}
- SMTP_TLS_REJECT_UNAUTHORIZED=${SMTP_TLS_REJECT_UNAUTHORIZED}
- SMTP_SECURE_CONNECTION=${SMTP_SECURE_CONNECTION}
- ENV_MODE=${ENV_MODE}
- SMTP_TLS_CIPHERS={SMTP_TLS_CIPHERS}
command: ["npm", "run", "start:server"]
deploy:
replicas: 1 #change here if u want to have more replicas. Cant find a way to set via variable right now
networks:
- backend
depends_on:
postgres:
condition: service_healthy
phoenix-redis:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-worker:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
networks:
- backend
environment:
- DB_HOST=phoenixDB
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- DB_USERNAME=postgres
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- REDIS_PASSWORD=${REDIS_PASSWORD}
command: ["npm", "run", "start:worker"]
depends_on:
postgres:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-redis:
image: 'bitnami/redis:latest'
container_name: redis
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb
user: root
networks:
- backend
restart: always
environment:
ALLOW_EMPTY_PASSWORD: "no"
REDIS_DISABLE_COMMANDS: FLUSHDB,FLUSHALL,CONFIG
REDIS_PASSWORD: ${REDIS_PASSWORD}
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
volumes:
- "./redis/data:/bitnami/redis/data"
https_portal:
container_name: https_portal
image: "steveltn/https-portal:1.21"
restart: unless-stopped
user: "root"
networks:
- frontend # [ PgAdmin, Phoenix-App ]
- external # [ Outside of the World]
ports:
- "80:80"
- "443:443"
# - host:container
environment:
STAGE: "production" # Use Let's Encrypt production server
WEBSOCKET: "true" # Enable websocket support
DEBUG: "true"
RENEW_MARGIN_DAYS: 30
CLIENT_MAX_BODY_SIZE: 0
# FORCE_RENEW: 'true'
DOMAINS:
volumes:
- ./https_portal/data:/var/lib/https-portal # ssl_certs, vhost.d, htdocs
- ./https_portal/log:/var/log/nginx # nginx logs
depends_on:
- phoenix-app
- phoenix-system
- pgadmin
- phoenix-redis
- postgres
networks:
backend:
driver: bridge
external: false
frontend:
driver: bridge
external: false
external:
driver: bridge
external: true

View File

@@ -1,164 +0,0 @@
version: "2.1"
services:
postgres:
restart: always
image: "postgres:15.1-alpine"
container_name: phoenixDB
networks:
- backend
ports:
- "5432:5432"
environment:
- DEBUG=false
- POSTGRES_DB=phoenix
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
volumes:
- "./database:/var/lib/postgresql/data"
healthcheck:
test:
- CMD-SHELL
- pg_isready -U postgres
interval: 5s
timeout: 2s
retries: 5
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin_container
networks:
- backend
- frontend
environment:
PGADMIN_DEFAULT_EMAIL: "pgadmin4@pgadmin.org"
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD}
PGADMIN_CONFIG_SERVER_MODE: 'False'
ports:
- "${PGADMIN_PORT:-5050}:80"
volumes:
- "pgadmin:/var/lib/pgadmin"
phoenix-app:
restart: always
image: "yurimatoslima/phoenix-frontend:alpha"
container_name: phoenixApp
volumes:
- "./app_custom:/usr/share/nginx/html/assets/custom"
networks:
- backend # primary network [external]
- frontend # internal network
depends_on:
- phoenix-system
phoenix-system:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
environment:
- "DB_HOST=phoenixDB"
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- "DB_USERNAME=postgres"
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- "REDIS_PASSWORD=${REDIS_PASSWORD}"
- RUN_JOB_QUEUE=${RUN_JOB_QUEUE}
- SMTP_FROM=${SMTP_FROM}
- SMTP_TYPE=${SMTP_TYPE}
- SMTP_NAME=${SMTP_NAME}
- SMTP_HOST=${SMTP_HOST}
- SMTP_PORT=${SMTP_PORT}
- SMTP_SECURE=${SMTP_SECURE}
- SMTP_USER=${SMTP_USER}
- SMTP_PASS=${SMTP_PASS}
- SMTP_LOGGING=${SMTP_LOGGING}
- SMTP_DEBUG=${SMTP_DEBUG}
- SMTP_TLS_REJECT_UNAUTHORIZED=${SMTP_TLS_REJECT_UNAUTHORIZED}
- SMTP_SECURE_CONNECTION=${SMTP_SECURE_CONNECTION}
- ENV_MODE=${ENV_MODE}
- SMTP_TLS_CIPHERS={SMTP_TLS_CIPHERS}
command: ["npm", "run", "start:server"]
deploy:
replicas: 1 #change here if u want to have more replicas. Cant find a way to set via variable right now
networks:
- backend
depends_on:
postgres:
condition: service_healthy
phoenix-redis:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-worker:
restart: always
image: "yurimatoslima/phoenix-backend:alpha"
networks:
- backend
environment:
- DB_HOST=phoenixDB
- "DB_PASSWORD=${POSTGRES_PASSWORD}"
- DB_USERNAME=postgres
- "SUPER_ADMIN_USER_PASSWORD=${SUPER_ADMIN_USER_PASSWORD}"
- REDIS_PASSWORD=${REDIS_PASSWORD}
command: ["npm", "run", "start:worker"]
depends_on:
postgres:
condition: service_healthy
volumes:
- "./assets:/usr/src/app/packages/dev-server/assets"
- "./server_custom:/usr/src/app/packages/dev-server/custom"
phoenix-redis:
image: 'bitnami/redis:latest'
container_name: redis
command: /opt/bitnami/scripts/redis/run.sh --maxmemory 100mb
user: root
networks:
- backend
restart: always
environment:
ALLOW_EMPTY_PASSWORD: "no"
REDIS_DISABLE_COMMANDS: FLUSHDB,FLUSHALL,CONFIG
REDIS_PASSWORD: ${REDIS_PASSWORD}
healthcheck:
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
volumes:
- "./redis/data:/bitnami/redis/data"
https_portal:
container_name: https_portal
image: "steveltn/https-portal:1.21"
restart: unless-stopped
user: "root"
networks:
- frontend # [ PgAdmin, Phoenix-App ]
- external # [ Outside of the World]
ports:
- "80:80"
- "443:443"
# - host:container
environment:
STAGE: "production" # Use Let's Encrypt production server
WEBSOCKET: "true" # Enable websocket support
DEBUG: "true"
RENEW_MARGIN_DAYS: 30
CLIENT_MAX_BODY_SIZE: 0
# FORCE_RENEW: 'true'
DOMAINS:
volumes:
- ./https_portal/data:/var/lib/https-portal # ssl_certs, vhost.d, htdocs
- ./https_portal/log:/var/log/nginx # nginx logs
depends_on:
- phoenix-app
- phoenix-system
- pgadmin
- phoenix-redis
- postgres
networks:
backend:
driver: bridge
external: false
frontend:
driver: bridge
external: false
external:
driver: bridge
external: true
volumes:
pgadmin: null

1
helper.md Normal file
View File

@@ -0,0 +1 @@
docker exec -it phx-phoenix-system-1 sh

View File

@@ -1,31 +1,31 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIE7zCCA9egAwIBAgISBD7cWXjY1ZYECrfo1Gcdvl3LMA0GCSqGSIb3DQEBCwUA MIIE7TCCA9WgAwIBAgISBN9fSOkvS54NMLTgeStNS2oTMA0GCSqGSIb3DQEBCwUA
MDMxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQwwCgYDVQQD MDMxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQwwCgYDVQQD
EwNSMTEwHhcNMjQwNzEyMDUzMzI4WhcNMjQxMDEwMDUzMzI3WjAaMRgwFgYDVQQD EwNSMTEwHhcNMjUwMTA4MDMyMzU2WhcNMjUwNDA4MDMyMzU1WjAaMRgwFgYDVQQD
Ew95dXJpLnBoeC1lcnAuZGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB Ew95dXJpLnBoeC1lcnAuZGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB
AQCkoSgHOsFmtqy02FZoJflGQlqx2Lc9WP12L5i5D/hutP8gpMoEfq6WyHD7Gn25 AQCkoSgHOsFmtqy02FZoJflGQlqx2Lc9WP12L5i5D/hutP8gpMoEfq6WyHD7Gn25
LR2BTn8ceqMMoArfJs6SsEXT7xdbmWSS9r4pWtbpZLWO/jwtYBbg/lwCTJUbiIvD LR2BTn8ceqMMoArfJs6SsEXT7xdbmWSS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lKo2jKjs5QLPzFuXQuPamY4QkAcA2+ Ew/2R7v7Zm8dsgnmWET2TGDT0O6ZAzeYTictTqaYkg0WMGGq1gfovjUt6E3aGhYm
+z9tApKgqFwDDN3u5jR0Z0SFuQjiEuH4QNjF7XO0Kzd9Hq3WAIgw3fLRxp348WQo TaacT0ypXm6zE0JpotXkJESNbfYx+zO0VNTCxYtfcTxeGFvqG41ZljvB5tWx2ODU
ol7U0pjdeld1bk7K41Ev4KMHq2NUQqwiIcztB1OjN2BnL6BoZmcYcxKS+XCGxpzM dlYh9omk1OnIgxY6LCdNdhIpNIfcswx0FN6dLc4hNIlZeUwAznao0/DB7M9kKKbL
qODx2T+XEIuY2UK6kCOedMsceQ05pzPmPb/Ehrf/Tg+TFCnaHGgypNxXNSnx5f+T JEISF1PD7+qgBCOLnKxylYx+aV3Bmg9jaUzySB2j95MLJirPYqqDa4ObU1UKa9v0
JeXyLiDQBCQ4O41xfxDkqG/M5w== RWOYa6/PjG44rdUjvU6GsLY=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -2,10 +2,13 @@
import path from 'path'; import path from 'path';
import { ConnectionOptions } from 'typeorm'; import { ConnectionOptions } from 'typeorm';
// import { DataSourceOptions } from 'typeorm'; // import { DataSourceOptions } from 'typeorm';
import { WinstonLogger, RedisSessionCachePlugin, LogLevel, TypeOrmLogger, SystemConfig, DefaultJobQueuePlugin, TypeORMHealthCheckStrategy } from '@phoenix/core'; import { WinstonLogger, RedisSessionCachePlugin, LogLevel, TypeOrmLogger, SystemConfig, DefaultJobQueuePlugin } from '@phoenix/core';
import { AssetServerPlugin } from '@phoenix/asset-server-plugin'; import { AssetServerPlugin } from '@phoenix/asset-server-plugin';
import { ADMIN_API_PATH, API_PORT, SHOP_API_PATH, SUPER_ADMIN_USER_IDENTIFIER, WORKER_PORT } from '@phoenix/common'; import { ADMIN_API_PATH, API_PORT, SHOP_API_PATH, SUPER_ADMIN_USER_IDENTIFIER } from '@phoenix/common';
import { EmailPlugin, FileBasedTemplateLoader, defaultEmailHandlers } from '@phoenix/email-plugin'; import { EmailPlugin, FileBasedTemplateLoader, defaultEmailHandlers } from '@phoenix/email-plugin';
import { BillBeePlugin } from "@phoenix/bill-bee-plugin";
import { ChannelPilotProPlugin } from "@phoenix/channel-pilot-pro-plugin";
import { ShopifyPlugin } from '@phoenix/shopify-plugin';
//import { BonnAPIPlugin } from '../plugins/bonn-api-plugin/bonn-api-plugin.module'; //import { BonnAPIPlugin } from '../plugins/bonn-api-plugin/bonn-api-plugin.module';
// import { DefaultJobQueuePlugin } from '@phoenix/system_service'; // import { DefaultJobQueuePlugin } from '@phoenix/system_service';
@@ -15,7 +18,6 @@ import { EmailPlugin, FileBasedTemplateLoader, defaultEmailHandlers } from '@pho
export const customConfig: SystemConfig = { export const customConfig: SystemConfig = {
apiOptions: { apiOptions: {
port: API_PORT, port: API_PORT,
workerPort: WORKER_PORT,
// sslPort: API_SSL_PORT, // sslPort: API_SSL_PORT,
//sslCertPath: path.join(__dirname, '../secrets/certificate.crt'), //sslCertPath: path.join(__dirname, '../secrets/certificate.crt'),
//sslKeyPath: path.join(__dirname, '../secrets/certificate.key'), //sslKeyPath: path.join(__dirname, '../secrets/certificate.key'),
@@ -100,6 +102,47 @@ export const customConfig: SystemConfig = {
changeEmailAddressUrl: 'http://localhost:4201/change-email-address', changeEmailAddressUrl: 'http://localhost:4201/change-email-address',
} }
}), }),
BillBeePlugin.init({
active: process.env.BILL_BEE_ACTIVE === 'true',
apiUrl: process.env.BILL_BEE_API_URL,
apiKey: process.env.BILL_BEE_API_KEY,
username: process.env.BILL_BEE_API_USERNAME,
password: process.env.BILL_BEE_API_SECRET,
header: {
'X-Billbee-Api-Key': process.env.BILL_BEE_API_KEY,
'Authorization': `Basic ${Buffer.from(`${process.env.BILL_BEE_API_USERNAME}:${process.env.BILL_BEE_API_SECRET}`).toString('base64')}`,
}
}),
ChannelPilotProPlugin.init({
active: process.env.CHANNEL_PILOT_PRO_ACTIVE === 'true',
connectionInfo: {
url: process.env.CHANNEL_PILOT_PRO_URL,
apiMerchantId: process.env.CHANNEL_PILOT_PRO_API_MERCHANT_ID,
apiToken: process.env.CHANNEL_PILOT_PRO_API_TOKEN,
access_token: process.env.CHANNEL_PILOT_PRO_ACCESS_TOKEN,
expiredAt: process.env.CHANNEL_PILOT_PRO_EXPIRED_AT,
tokenType: 'Bearer'
},
header: {
'Authorization': `Bearer ${process.env.CHANNEL_PILOT_PRO_ACCESS_TOKEN}`,
}
}),
ShopifyPlugin.init({
active: process.env.SHOPIFY_ACTIVE === 'true',
connectionInfo: {
url: process.env.SHOPIFY_HOST_NAME,
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET,
token: process.env.SHOPIFY_TOKEN,
// scopes: process.env.SHOPIFY_SCOPES.split(','),
hostName: process.env.SHOPIFY_HOST_NAME,
hostScheme: process.env.SHOPIFY_HOST_SCHEME === 'https' ? 'https' : 'http',
isEmbeddedApp: process.env.SHOPIFY_IS_EMBEDDED_APP === 'true',
header: {
'X-Shopify-Access-Token': process.env.SHOPIFY_TOKEN,
}
}
}),
// DefaultStoragePlaceRankPlugin.init({}) // DefaultStoragePlaceRankPlugin.init({})
// new DefaultSearchPlugin(), // new DefaultSearchPlugin(),
// new ElasticsearchPlugin({ // new ElasticsearchPlugin({
@@ -117,11 +160,7 @@ export const customConfig: SystemConfig = {
// new AdminUiPlugin({ // new AdminUiPlugin({
// port: 5001, // port: 5001,
// }), // }),
], ]
systemOptions: {
healthChecks: [new TypeORMHealthCheckStrategy(null, { key: 'database', timeout: 1000 })],
errorHandlers: [],
},
// ApolloEngineApiKey: "service:Logic-Bits-2900:5w1aCP5YUtF-1ErRG0KNQw" // ApolloEngineApiKey: "service:Logic-Bits-2900:5w1aCP5YUtF-1ErRG0KNQw"
}; };
@@ -149,7 +188,7 @@ function getDbConfig(): ConnectionOptions {
case 'postgres': case 'postgres':
console.log('Using postgres connection at ' + dbHost); console.log('Using postgres connection at ' + dbHost);
return { return {
synchronize: true, synchronize: false,
type: 'postgres', type: 'postgres',
//host: '127.0.0.1', //host: '127.0.0.1',
host: dbHost, host: dbHost,