Sto tentando di distribuire Discourse come servizio docker swarm.
Ho utilizzato il metodo ufficiale del launcher per distribuire Discourse in una configurazione a container singolo.
Ho copiato i file necessari da /var/www/discourse all’interno del container standalone in una posizione sui server host da utilizzare nel servizio Swarm.
Ho utilizzato un server PostgreSQL esistente
Ho creato un container Redis dedicato per Discourse
Discourse non si avvia ed esce con: uninitialized constant Discourse::SiteSetting (NameError)
Il container si connette a PostgreSQL e Redis senza problemi.
DISCOURSE_HOSTNAME è impostato correttamente su discourse.xyz nell’ambiente.
Potrebbe essere dovuto a dipendenze mancanti o a una compilazione di asset non riuscita?
Discourse richiede modifiche per funzionare correttamente all’interno di un ambiente Swarm?
version: '3.7'
services:
app:
image: discourse-app:latest
user: "1000:1000"
working_dir: /var/www/discourse
deploy:
replicas: 1
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.backend=discourse"
- "traefik.docker.network=service"
- "traefik.frontend.rule=Host:discourse.xyz"
- "traefik.port=80"
command:
- "/bin/bash"
- "-c"
- |
bundle config set deployment true && \
bundle config set without 'test development' && \
RAILS_ENV=production bundle install && \
RAILS_ENV=production bundle exec rake db:migrate && \
RAILS_ENV=production bundle exec rails server -b 0.0.0.0
environment:
DISCOURSE_DB_HOST: "postgrest1"
DISCOURSE_DB_PORT: "5432"
DISCOURSE_DB_USERNAME: "postgres"
DISCOURSE_DB_PASSWORD: "****"
DISCOURSE_DB_NAME: "discourse"
DISCOURSE_REDIS_HOST: "redis-discourse"
DISCOURSE_REDIS_PORT: "6379"
DISCOURSE_REDIS_PASSWORD: "****"
DISCOURSE_HOSTNAME: "discourse.xyz"
DISCOURSE_DEVELOPER_EMAILS: "abc@xyz.com"
DISCOURSE_SMTP_ADDRESS: "xyz"
DISCOURSE_SMTP_PORT: "25"
DISCOURSE_NOTIFICATION_EMAIL: "donotreply@xyz.com"
networks:
- service
ports:
- "8080:80"
- "8443:443"
volumes:
- type: bind
source: /discourse/discourse_files/discourse
target: /var/www/discourse
bind:
propagation: rprivate
- type: bind
source: /discourse/shared/standalone
target: /shared
bind:
propagation: rprivate
- type: bind
source: /discourse/shared/standalone/log/rails
target: /data/modulusdata/infra/discourse/shared/standalone/log/rails
bind:
propagation: rprivate
- type: bind
source: /discourse/shared/standalone/log/var-log
target: /var/log
bind:
propagation: rprivate
networks:
service:
external: true