diff --git a/.dockerignore b/.dockerignore index 3bb6684..6672e96 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,3 +11,4 @@ docker/** docker-compose.yml README.md .gitlab-ci.yml +/log diff --git a/Gemfile b/Gemfile index 036d7b6..91dfd63 100644 --- a/Gemfile +++ b/Gemfile @@ -7,8 +7,6 @@ ruby '3.1.2' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 7.0.3' -# Use sqlite3 as the database for Active Record -gem 'sqlite3' # Use Puma as the app server gem 'puma', '~> 5.0' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder @@ -54,6 +52,8 @@ group :development, optional: true do gem 'listen', '~> 3.3' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'railroady' + # Use sqlite3 as the database for Active Record + gem 'sqlite3' gem 'rubocop' gem 'rubocop-performance' gem 'rubocop-rails' diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 0566865..f4d11ff 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -1,5 +1,6 @@ ARG base_commit FROM ruby:3.1.2-slim +ENV RAILS_ENV production # RUN apk add --no-cache build-base tzdata sqlite sqlite-dev postgresql-dev git && gem install tzinfo-data RUN apt-get update -qq && apt-get install -y openssl git build-essential libpq-dev nodejs && apt-get clean && gem install tzinfo-data WORKDIR /app @@ -14,6 +15,5 @@ COPY script /app/script COPY config.ru Rakefile /app/ # Duplicate production environment to beta environment COPY config/environments/production.rb config/environments/beta.rb -ENV RAILS_ENV production EXPOSE 3000 CMD bundle exec rails db:migrate && bundle exec rails s -p 3000 -b 0.0.0.0 diff --git a/tasks.py b/tasks.py index ed68ca1..f50e5f3 100644 --- a/tasks.py +++ b/tasks.py @@ -1015,18 +1015,39 @@ def docker_blackbox_follow_manual_up( build=build, ) - source_env = _production_env_for("source-postgres", BLACKBOX_SOURCE_DB_NAME) - follower_env = _production_env_for("follower-postgres", BLACKBOX_FOLLOWER_DB_NAME) + env = _follow_compose_env( + source_host_port=source_host_port, + follower_host_port=follower_host_port, + app_image=app_image, + runner_image=runner_image, + postgres_image=postgres_image, + ) _print_header("Running source production database migrations") - c.run("bundle exec rails db:migrate", env=source_env, pty=True) + _compose_run( + ["exec", "-T", "source-app", "bash", "-lc", "bundle exec rails db:migrate"], + env=env, + project_name=BLACKBOX_FOLLOW_PROJECT, + compose_file=BLACKBOX_FOLLOW_COMPOSE_FILE, + ) _print_header("Running follower production database migrations") - c.run("bundle exec rails db:migrate", env=follower_env, pty=True) + _compose_run( + ["exec", "-T", "follower-app", "bash", "-lc", "bundle exec rails db:migrate"], + env=env, + project_name=BLACKBOX_FOLLOW_PROJECT, + compose_file=BLACKBOX_FOLLOW_COMPOSE_FILE, + ) _print_header("Bootstrapping confirmed E2E users on source and follower") - _bootstrap_blackbox_users(c, source_env, E2E_EMAIL, E2E_PASSWORD, E2E_USERNAME, E2E_ALT_EMAIL, E2E_ALT_PASSWORD, E2E_ALT_USERNAME) - _bootstrap_blackbox_users(c, follower_env, E2E_EMAIL, E2E_PASSWORD, E2E_USERNAME, E2E_ALT_EMAIL, E2E_ALT_PASSWORD, E2E_ALT_USERNAME) + docker_blackbox_follow_bootstrap_users( + c, + source_host_port=source_host_port, + follower_host_port=follower_host_port, + app_image=app_image, + runner_image=runner_image, + postgres_image=postgres_image, + ) source_base_url = f"http://127.0.0.1:{source_host_port}" follower_base_url = f"http://127.0.0.1:{follower_host_port}"