خطای javascript در حالت prod برای فونیکس (حل شد)

phoenix
production

#21

nginx.yml

version: "3.7"

services:
  nginx_master:
    image: mojtabanaserei/nginx:1.15.7
    container_name: nginx_master
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/conf/:/etc/nginx/
      - ./nginx/logs/:/var/log/
      - ./nginx/cache/:/var/nginx/cache
      - ./discourse/example_com/forum/:/var/www/example/forum/
      - ./discourse/example_com/shared/:/shared/
      - ./roundcube/roundcubemail-1.x.x/:/var/www/example/email/
      - ./elixir/prod/static/:/var/www/example/html
      - ./elixir/dev/html_app_example/example_html_site_umbrella/apps/example_html_site_web/priv/static/:/var/www/example_dev/html
      - /home/ftpusers/example/dl:/var/www/example/html/dl
      - ./certbot/letsencrypt:/etc/letsencrypt:ro
      - ./certbot/example:/etc/letsencrypt_example:ro
      - /etc/localtime:/etc/localtime:ro
    depends_on:
      - example_roundcube

example.yml

version: "3.7"

services:     
  example_postgres:
    image: mojtabanaserei/postgresql:10.5
    container_name: example_postgres
    restart: always
    environment:
      - POSTGRES_USER=my_user
      - POSTGRES_PASSWORD=my_pass
    volumes:
      - ./postgresql/data:/var/lib/postgresql/data
      - ./postgresql/conf:/usr/local/share/postgresql/
      - /etc/localtime:/etc/localtime:ro

  example_redis:
    image: mojtabanaserei/redis:4.0.11
    container_name: example_redis
    restart: always
    command: sh -c "redis-server /usr/local/etc/redis/redis.conf"
    volumes:
     - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
     - ./redis/data/:/data
     - /etc/localtime:/etc/localtime:ro


  example_roundcube:
    image: mojtabanaserei/php7-fpm:7.2.10
    container_name: example_roundcube
    restart: always
    volumes:
     - ./roundcube/roundcubemail-1.x.x/:/var/www/example/email/
     - ./roundcube/php/:/usr/local/etc/php/
     - /etc/localtime:/etc/localtime:ro
    depends_on:
     - example_postgres


  example_dovecot:
    image: mojtabanaserei/dovecotsmtp:2.3.4_debian
    container_name: example_dovecot
    command: bash -c "/ip_changer.sh ;service syslog-ng start ; postmap /etc/postfix/virtual ; postfix start ; dovecot -F ; tail -F /var/log/mail.log"
    restart: always
    ports:
      - "25:25"
      - "587:587"
      - "993:993"
    volumes:
      - ./dovecot/config_dovecot/:/usr/local/etc/dovecot/
      - ./dovecot/config_etc/postfix/:/etc/postfix/
      - ./dovecot/config_etc/pam.d/smtp:/etc/pam.d/smtp
      - ./dovecot/config_etc/default/saslauthd:/etc/default/saslauthd
      - ./dovecot/config_etc/pam_pgsql.conf:/etc/pam_pgsql.conf
      - ./dovecot/config_etc/myshadow:/etc/myshadow
      - ./dovecot/config_etc/mypasswd:/etc/mypasswd
      - ./dovecot/logs/dovecot.log:/var/log/dovecot.log
      - ./dovecot/logs/mail.log:/var/log/mail.log
      - ./dovecot/maildir/:/home/
      - ./dovecot/ssl/:/etc/ssl/
      - ./postgresql/socket/:/var/run/postgresql/
      - /etc/localtime:/etc/localtime:ro
    depends_on:
     - example_postgres

  example_discourse:
    image: mojtabanaserei/discourse:2.2.2_beta5_with_mailgun
    container_name: example_discourse
    restart: always
    command: bash -c "/sbin/boot"
    environment:
     - LANG=en_US.UTF-8 
     - HOME=/root 
     - RAILS_ENV=production 
     - UNICORN_WORKERS=3 
     - UNICORN_SIDEKIQS=1 
     - RUBY_GLOBAL_METHOD_CACHE_SIZE=131072
     - RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 
     - RUBY_GC_HEAP_INIT_SLOTS=400000 
     - RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 
     - DISCOURSE_DB_SOCKET=/var/run/postgresql 
     - DISCOURSE_DB_HOST= 
     - DISCOURSE_DB_PORT= 
     - DISCOURSE_HOSTNAME=forum.example.com
     - DISCOURSE_DEVELOPER_EMAILS=my_mail@gmail.com
     - DISCOURSE_SMTP_ADDRESS=smtp.mailgun.org 
     - DISCOURSE_SMTP_USER_NAME=*************************
     - DISCOURSE_SMTP_PASSWORD=*************************
    volumes:
      - ./discourse/example_com/shared/standalone/:/shared 
      - ./discourse/example_com/shared/standalone/log/var-log:/var/log 
      - /etc/localtime:/etc/localtime:ro
 
      
  example_html:
    image: example_elixir_prod_html_app:0.0.2
    container_name: example_html
    restart: always
    command: sh -c "PORT=4000 MIX_ENV=prod mix phx.server"
    environment:
      - ALG=***************************
      - CRV=***************************
      - D=***************************
      - KTY=***************************
      - USE=***************************
      - X=***************************
      - Y=***************************
    hostname: example_html
    depends_on:
      - example_api
     
     
  example_api:
    image: example_elixir_prod_api_app:0.0.1
    container_name: example_api
    restart: always
    command: sh -c "PORT=4000 MIX_ENV=prod mix phx.server"
    environment:
      - ALG=***************************
      - CRV=***************************
      - D=***************************
      - KTY=***************************
      - USE=***************************
      - X=***************************
      - Y=***************************
    hostname: example_api
    depends_on:
      - example_user
    
      
      
  example_user:
    image: example_elixir_prod_user_app:0.0.1
    container_name: example_user
    restart: always
    command: sh -c "PORT=4000 MIX_ENV=prod mix phx.server"
    hostname: example_user
    depends_on:
      - example_postgres
      - example_redis
      - example_dovecot
      
      
  example_cms:
    image: example_elixir_prod_cms_app:0.0.1
    container_name: example_cms
    restart: always
    command: sh -c "PORT=4000 MIX_ENV=prod mix phx.server"
    hostname: example_cms
    depends_on:
      - example_postgres

network.yml

version: '3.7'
services:
  nginx_master:
    networks:
      nginx:
      nginx_to_roundcubemail_example:
        ipv4_address: 180.20.1.2
      nginx_to_html_example:
        ipv4_address: 180.20.2.2
      nginx_to_discourse_example:
        ipv4_address: 180.20.3.2
      html_dev_to_nginx_example:
        ipv4_address: 180.20.14.2
  #===================================      
  example_discourse:  
    networks: 
      discourse:
      nginx_to_discourse_example:
        ipv4_address: 180.20.3.3
  #===================================        
  example_html:
    networks:
      html:
      nginx_to_html_example:
        ipv4_address: 180.20.2.3
      html_to_api_example:
        ipv4_address: 180.20.4.2
  #===================================  
  example_api:
    networks:
      html_to_api_example:
        ipv4_address: 180.20.4.3
      api_to_user_example:
        ipv4_address: 180.20.5.2
      api_to_cms_example:
        ipv4_address: 180.20.6.2
  #===================================  
  example_user:
    networks:
      api_to_user_example:
        ipv4_address: 180.20.5.3
      user_to_redis_example:
        ipv4_address: 180.20.7.2     
      user_to_postgresql_example:
        ipv4_address: 180.20.8.2
      user_to_dovecotsmtp_example:
        ipv4_address: 180.20.9.2
  #===================================  
  example_cms:
    networks:
      cms_to_postgresql_example:
        ipv4_address: 180.20.10.2
      api_to_cms_example:
        ipv4_address: 180.20.6.3
  #===================================        
  example_roundcube:
    networks:
      nginx_to_roundcubemail_example:
        ipv4_address: 180.20.1.3
      roundcubemail_to_postgresql_example:
        ipv4_address: 180.20.11.2
      roundcubemail_to_dovecotsmtp_example:
        ipv4_address: 180.20.12.2
  #===================================  
  example_dovecot:
    networks:
      dovecot:
      roundcubemail_to_dovecotsmtp_example:
        ipv4_address: 180.20.12.3
      user_to_dovecotsmtp_example:
        ipv4_address: 180.20.9.3
      dovecotsmtp_to_postgresql_example:
        ipv4_address: 180.20.13.2
  #===================================  
  example_redis:
    networks:
      user_to_redis_example:
        ipv4_address: 180.20.7.3
  #===================================  
  example_postgres:
    networks:
      user_to_postgresql_example:
        ipv4_address: 180.20.8.3
      cms_to_postgresql_example:
        ipv4_address: 180.20.10.3
      roundcubemail_to_postgresql_example:
        ipv4_address: 180.20.11.3
      dovecotsmtp_to_postgresql_example:
        ipv4_address: 180.20.13.3
  #===================================
  #===================================
  example_dev_html:
    networks:
      html_dev_to_nginx_example:
        ipv4_address: 180.20.14.3     
#============================================ 
#============================================ 
networks:
#============================================   
#============================================ 
#------- internet access  
  nginx:
  discourse:
  dovecot:
  html:
#============================================   
  nginx_to_roundcubemail_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.1.0/24
  nginx_to_html_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.2.0/24
  nginx_to_discourse_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.3.0/24
#============================================         
#============================================         
  html_to_api_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.4.0/24
#============================================        
  api_to_user_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.5.0/24
  api_to_cms_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.6.0/24
#============================================        
  user_to_redis_example:
    internal: true   
    ipam:
      driver: default
      config:
        - subnet: 180.20.7.0/24     
  user_to_postgresql_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.8.0/24
  user_to_dovecotsmtp_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.9.0/24
#============================================        
  cms_to_postgresql_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.10.0/24
#============================================        
  roundcubemail_to_postgresql_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.11.0/24
  roundcubemail_to_dovecotsmtp_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.12.0/24
#============================================  
  dovecotsmtp_to_postgresql_example:
    internal: true  
    ipam:
      driver: default
      config:
        - subnet: 180.20.13.0/24  
#============================================  
  html_dev_to_nginx_example:
    internal: true
    ipam:
      driver: default
      config:
        - subnet: 180.20.14.0/24

اجرا با دستور

sudo docker-compose -f nginx.yml -f example.yml -f network.yml up -d

#22

باید از docker stack استفاده کنید، این روش کلا درست نیست.
میتونید با docker-compose config همه این yml ها رو به یک yml مناسب برای prod تبدیل کنید و بعد با استفاده از اون yml و بوسیله docker stack deploy کار دیپلوی رو انجام بدین. فقط گزینه deploy: برای هر کدوم از سویس ها در فایل های yml فراموش نشه. من سعی میکنم فردا همه دستورات لازمو بدم.(الان دیگه چشمم نمیبینه)
بهتره برای stack از ورژن ۳ استفاده کنید.


#23

بهتره توی این پست ادامه ندیم چون مشکل خطا چیز دیگه ای بوده

بقیه رو در این پست ادامه میدیم


#24

به روی چشم، بله اشتباه شد👌