version: "3.8" services: web: <% if all_args.empty? -%> build: . <% if private_gemserver_env_variable_name -%> secrets: - gemserver_credentials <% end -%> <% else -%> build: context: . args: <% all_args.each do |name, value| -%> <%= name %>: <%= value.html_safe? ? value : "\"#{Shellwords.escape(value)}\"" %> <% end -%> <% if private_gemserver_env_variable_name -%> secrets: - gemserver_credentials <% end -%> <% end -%> volumes: <% compose_web_volumes.each do |path| -%> - ./<%= path %>:/rails/<%= path %> <% end -%> ports: - "3000:3000" environment: <% if using_redis? -%> - REDIS_URL=redis://redis-db:6379 <% end -%> <% if deploy_database == 'postgresql' -%> - DATABASE_URL=postgres://root:password@postgres-db/ <% elsif deploy_database == 'mysql' -%> <% if using_trilogy? -%> - DATABASE_URL=trilogy://root:password@mysql-db/ <% else -%> - DATABASE_URL=mysql2://root:password@mysql-db/ <% end -%> <% end -%> secrets: - source: master_key target: /rails/config/master.key <% if using_redis? or deploy_database != 'sqlite3' -%> depends_on: <% if using_redis? -%> redis-db: condition: service_started <% end -%> <% if deploy_database == 'postgresql' -%> postgres-db: condition: service_healthy <% elsif deploy_database == 'mysql' -%> mysql-db: condition: service_healthy <% end -%> <% if deploy_database == 'postgresql' -%> postgres-db: image: postgres environment: POSTGRES_USER: root POSTGRES_PASSWORD: password volumes: - ./tmp/postgres-db:/var/lib/postgresql/data healthcheck: test: pg_isready interval: 2s timeout: 5s retries: 30 <% elsif deploy_database == 'mysql' -%> mysql-db: image: mysql command: - --default-authentication-plugin=mysql_native_password environment: MYSQL_ROOT_PASSWORD: password volumes: - ./tmp/mysql-db:/var/lib/mysql healthcheck: test: mysqladmin ping -h 127.0.0.1 -u root --password=password interval: 2s timeout: 5s retries: 30 <% end -%> <% end -%> <% if using_redis? -%> redis-db: image: redis <% end -%> <% if (using_sidekiq? and deploy_database != 'sqlite3') or solidq_launcher == :process -%> <%= using_sidekiq? ? "sidekiq" : "solidq" %>: build: . <% if using_sidekiq? -%> command: bundle exec sidekiq <% else -%> command: bundle exec rake solid_queue:start <% end -%> <% if private_gemserver_env_variable_name -%> secrets: - gemserver_credentials <% end -%> environment: - RAILS_MASTER_KEY=$RAILS_MASTER_KEY - REDIS_URL=redis://redis-db:6379 <% if deploy_database == 'postgresql' -%> - DATABASE_URL=postgres://root:password@postgres-db/ <% elsif deploy_database == 'mysql' -%> <% if using_trilogy? -%> - DATABASE_URL=trilogy://root:password@mysql-db/ <% else -%> - DATABASE_URL=mysql2://root:password@mysql-db/ <% end -%> <% end -%> depends_on: redis-db: condition: service_started <% if deploy_database == 'postgresql' -%> postgres-db: condition: service_healthy <% elsif deploy_database == 'mysql' -%> mysql-db: condition: service_healthy <% end -%> <% end -%> <% if private_gemserver_env_variable_name -%> secrets: gemserver_credentials: file: ./GEMSERVER_CREDENTIALS.secret.txt <% end -%> secrets: master_key: file: ./config/master.key