From 1b6ab989da311d629a953abdd76644a6befcab0f Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Fri, 15 May 2020 13:14:42 -0400 Subject: [PATCH] Dockerize with dip (#1149) --- .docker/.bashrc | 1 + .docker/.pryrc | 7 ++ .docker/.psqlrc | 26 +++++ .docker/Aptfile | 1 + .docker/Dockerfile | 67 +++++++++++ .env-example | 166 ++++++++++++++------------- README.md | 4 + bin/copy_production_db_to_local | 2 +- bin/copy_production_db_to_staging | 2 +- bin/docker/start_rails | 4 + bin/docker/start_sidekiq | 4 + bin/docker/start_webpacker | 5 + bin/setup | 31 ++--- bin/source_env | 4 + config/database.yml | 4 +- dip.yml | 79 +++++++++++++ docker-compose.yml | 120 +++++++++++++++++++ docs/docker_development.md | 69 +++++++++++ test/application_system_test_case.rb | 3 +- 19 files changed, 493 insertions(+), 106 deletions(-) create mode 100644 .docker/.bashrc create mode 100644 .docker/.pryrc create mode 100644 .docker/.psqlrc create mode 100644 .docker/Aptfile create mode 100644 .docker/Dockerfile create mode 100755 bin/docker/start_rails create mode 100755 bin/docker/start_sidekiq create mode 100755 bin/docker/start_webpacker create mode 100755 bin/source_env create mode 100644 dip.yml create mode 100644 docker-compose.yml create mode 100644 docs/docker_development.md diff --git a/.docker/.bashrc b/.docker/.bashrc new file mode 100644 index 000000000..d55841a6c --- /dev/null +++ b/.docker/.bashrc @@ -0,0 +1 @@ +alias be="bundle exec" \ No newline at end of file diff --git a/.docker/.pryrc b/.docker/.pryrc new file mode 100644 index 000000000..fecee1180 --- /dev/null +++ b/.docker/.pryrc @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +if ENV["HISTFILE"] + hist_dir = ENV["HISTFILE"].sub(/\/[^\/]+$/, "") + Pry.config.history.should_save = true + Pry.config.history.file = File.join(hist_dir, ".pry_history") +end diff --git a/.docker/.psqlrc b/.docker/.psqlrc new file mode 100644 index 000000000..efb63f5b1 --- /dev/null +++ b/.docker/.psqlrc @@ -0,0 +1,26 @@ +-- Don't display the "helpful" message on startup. +\set QUIET 1 + +-- Allow specifying the path to history file via `PSQL_HISTFILE` env variable +-- (and fallback to the defaukt $HOME/.psql_history otherwise) +\set HISTFILE `[[ -z $PSQL_HISTFILE ]] && echo $HOME/.psql_history || echo $PSQL_HISTFILE` + +-- Show how long each query takes to execute +\timing + +-- Use best available output format +\x auto + +-- Verbose error reports +\set VERBOSITY verbose + +-- If a command is run more than once in a row, +-- only store it once in the history +\set HISTCONTROL ignoredups +\set COMP_KEYWORD_CASE upper + +-- By default, NULL displays as an empty space. Is it actually an empty +-- string, or is it null? This makes that distinction visible +\pset null '[NULL]' + +\unset QUIET diff --git a/.docker/Aptfile b/.docker/Aptfile new file mode 100644 index 000000000..f027e0d4b --- /dev/null +++ b/.docker/Aptfile @@ -0,0 +1 @@ +vim diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100644 index 000000000..b6765a3e5 --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,67 @@ +ARG RUBY_VERSION +FROM ruby:$RUBY_VERSION-slim-buster + +ARG PG_MAJOR +ARG NODE_MAJOR +ARG BUNDLER_VERSION +ARG YARN_VERSION + +# Common dependencies +RUN apt-get update -qq \ + && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ + build-essential \ + gnupg2 \ + curl \ + less \ + git \ + && apt-get clean \ + && rm -rf /var/cache/apt/archives/* \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && truncate -s 0 /var/log/*log + +# Add PostgreSQL to sources list +RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ + && echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list + +# Add NodeJS to sources list +RUN curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR.x | bash - + +# Add Yarn to the sources list +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo 'deb http://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list + +# Install deps + add Chrome Stable + purge all the things +RUN curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && echo "deb https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list + +# Install dependencies +COPY .docker/Aptfile /tmp/Aptfile +RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \ + DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ + libpq-dev \ + postgresql-client-$PG_MAJOR \ + google-chrome-stable \ + nodejs \ + yarn=$YARN_VERSION-1 \ + $(cat /tmp/Aptfile | xargs) && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + truncate -s 0 /var/log/*log + +# Configure bundler +ENV LANG=C.UTF-8 \ + BUNDLE_JOBS=4 \ + BUNDLE_RETRY=3 \ + BUNDLE_APP_CONFIG=.bundle + +# Upgrade RubyGems and install required Bundler version +RUN gem update --system && \ + gem install bundler:$BUNDLER_VERSION + +# Run binstubs without prefixing with `bin/` or `bundle exec` +ENV PATH /app/bin:$PATH + +# Create a directory for the app code +RUN mkdir -p /app + +WORKDIR /app diff --git a/.env-example b/.env-example index 2aa2f0c38..f2cd87806 100644 --- a/.env-example +++ b/.env-example @@ -1,80 +1,86 @@ -export ACTION_CABLE_MAX_THREADS=5 -export API_BASED_PROPERTY_IDS=114 -export AWS_S3_ACCESS_KEY_ID='AKIAIOSFODNN7EXAMPLE' -export AWS_S3_BUCKET='example_s3_bucket' -export AWS_S3_REGION='us-west-2' -export AWS_S3_SECRET_ACCESS_KEY='wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY' -export BASE_ECPM=400 -export BROWSER_PATH= -export CAMO_HOST= -export CAMO_KEY= -export CAMPAIGN_DEMO_ID=395 -export CLOUDFRONT_HOST= -export CODEFUND_ANALYTICS_KEY= -export DATABASE_URL= -export DEFAULT_HOST=app.codefund.io -export DOCRAPTOR_API_KEY= -export DOCRAPTOR_HTTP_PASSWORD= -export DOCRAPTOR_HTTP_USERNAME= -export ENABLED_FEATURES=jobs -export FILESTACK_API_KEY= -export GITHUB_CLIENT_ID= -export GITHUB_CLIENT_SECRET= -export GOOGLE_CLIENT_ID= -export GOOGLE_CLIENT_SECRET= -export GROOVE_WIDGET_ID= -export INTERCOM_APP_ID= -export INTERCOM_SECRET_KEY= -export IP_ADDRESS_SALT= -export JOBS_MONTHLY_PLAN_PRICE= -export JOBS_PREPAID_PLAN_PRICE= -export LINKEDIN_KEY= -export LINKEDIN_SECRET= -export MAX_QUEUE_SIZE=2500 -export MAX_REQUESTS_PER_IP_PER_MIN=20 -export MAX_REQUESTS_PER_PROPERTY_PER_MIN=600 -export METABASE_CAMPAIGN_DASHBOARD_ID= -export METABASE_PROPERTY_DASHBOARD_ID= -export METABASE_ADVERTISER_DASHBOARD_ID= -export METABASE_ADMINISTRATOR_DASHBOARD_ID= -export METABASE_SECRET_KEY= -export METABASE_SITE_URL= -export METABASE_URL= -export NGROK_HOST= -export NGROK_SUBDOMAIN= -export PAID_FALLBACK_PERCENT=90 -export PG_DATABASE_NAME='code_fund_ads_development' -export PG_PASSWORD= -export PG_TIMEOUT_IN_SECONDS=3 -export PG_URL= -export PG_USERNAME= -export PIPEDRIVE_SYNC_HOOK_URL= -export PROHIBITED_HOUR_END= -export PROHIBITED_HOUR_START= -export RAILS_INBOUND_EMAIL_PASSWORD= -export RAILS_MAX_THREADS=5 -export READ_THE_DOCS_EMAIL= -export RECAPTCHA_SECRET_KEY= -export RECAPTCHA_SITE_KEY= -export REDIS_CACHE_MAX_THREADS=5 -export REDIS_CACHE_URL='redis://127.0.0.1:6379' -export REDIS_QUEUE_MAX_THREADS=5 -export REDIS_QUEUE_URL='redis://127.0.0.1:6379' -export ROLLBAR_ACCESS_TOKEN= -export SCOUT_ENABLED='false' -export SCOUT_KEY= -export SCOUT_SAMPLE_RATE=0.3 -export SCREENSHOT_MACHINE_KEY= -export SENDGRID_API_KEY= -export SILENCE_ACTION_CABLE='false' -export SITE_TRAFFIC_API_KEY= -export SKIP_EVENTS=1 -export SLACK_WEBHOOK_URL= -export STRIPE_PUBLISHABLE_KEY= -export STRIPE_SECRET_KEY= -export TEST_CONCURRENCY= -export TRADE_API_KEY -export UPLOADCARE_PUBLIC_KEY= -export UPLOADCARE_SECRET= -export WORDPRESS_SITE_ENABLED= -export WORDPRESS_URL='https://codefund.io' +ACTION_CABLE_MAX_THREADS=5 +AWS_S3_ACCESS_KEY_ID='AKIAIOSFODNN7EXAMPLE' +AWS_S3_BUCKET='example_s3_bucket' +AWS_S3_REGION='us-west-2' +AWS_S3_SECRET_ACCESS_KEY='wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY' +BASE_ECPM=400 +BROWSER_PATH= +CAMO_HOST= +CAMO_KEY= +CAMPAIGN_DEMO_ID=395 +CLOUDFRONT_HOST= +CODEFUND_ANALYTICS_KEY= +DATABASE_URL= +DEFAULT_HOST=app.codefund.io +DOCRAPTOR_API_KEY= +DOCRAPTOR_HTTP_PASSWORD= +DOCRAPTOR_HTTP_USERNAME= +ENABLED_FEATURES=jobs +FILESTACK_API_KEY= +GITHUB_CLIENT_ID= +GITHUB_CLIENT_SECRET= +GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= +GROOVE_WIDGET_ID= +INTERCOM_APP_ID= +INTERCOM_SECRET_KEY= +IP_ADDRESS_SALT= +JOBS_MONTHLY_PLAN_PRICE= +JOBS_PREPAID_PLAN_PRICE= +LINKEDIN_KEY= +LINKEDIN_SECRET= +MAX_QUEUE_SIZE=2500 +MAX_REQUESTS_PER_IP_PER_MIN=20 +MAX_REQUESTS_PER_PROPERTY_PER_MIN=600 +METABASE_CAMPAIGN_DASHBOARD_ID= +METABASE_PROPERTY_DASHBOARD_ID= +METABASE_ADVERTISER_DASHBOARD_ID= +METABASE_ADMINISTRATOR_DASHBOARD_ID= +METABASE_SECRET_KEY= +METABASE_SITE_URL= +METABASE_URL= +NGROK_HOST= +NGROK_SUBDOMAIN= +PAID_FALLBACK_PERCENT=90 +PG_DATABASE_NAME='code_fund_ads_development' +PG_PASSWORD= +PG_TIMEOUT_IN_SECONDS=3 +PG_URL= +PG_USERNAME= +PIPEDRIVE_SYNC_HOOK_URL= +PROHIBITED_HOUR_END= +PROHIBITED_HOUR_START= +RAILS_MAX_THREADS=5 +READ_THE_DOCS_EMAIL= +RECAPTCHA_SECRET_KEY= +RECAPTCHA_SITE_KEY= +REDIS_CACHE_MAX_THREADS=5 +REDIS_QUEUE_MAX_THREADS=5 +ROLLBAR_ACCESS_TOKEN= +SCOUT_ENABLED='false' +SCOUT_KEY= +SCOUT_SAMPLE_RATE=0.3 +SCREENSHOT_MACHINE_KEY= +SENDGRID_API_KEY= +SILENCE_ACTION_CABLE='false' +SITE_TRAFFIC_API_KEY= +SKIP_EVENTS=1 +SLACK_WEBHOOK_URL= +STRIPE_PUBLISHABLE_KEY= +STRIPE_SECRET_KEY= +TEST_CONCURRENCY= +TRADE_API_KEY +UPLOADCARE_PUBLIC_KEY= +UPLOADCARE_SECRET= +WORDPRESS_SITE_ENABLED= +WORDPRESS_URL='https://codefund.io' + +# Comment these out if using docker +REDIS_URL=redis://127.0.0.1:6379 +REDIS_CACHE_URL=redis://127.0.0.1:6379 +REDIS_QUEUE_URL=redis://127.0.0.1:6379 + +# Uncomment these if using Docker +# REDIS_URL=redis://redis:6379 +# REDIS_CACHE_URL=redis://redis:6379 +# REDIS_QUEUE_URL=redis://redis:6379 diff --git a/README.md b/README.md index da9e8465c..a2820bc7b 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,10 @@ The URLs/routes responsible for ad rendering are: ## Development +If you'd like to use Docker to run the app, view that documentation [here](docs/docker_development). + +The following is for setting the app up on your local machine: + ### Prerequisites - Ruby version `2.6.6` diff --git a/bin/copy_production_db_to_local b/bin/copy_production_db_to_local index c1a69b441..79d3f71db 100755 --- a/bin/copy_production_db_to_local +++ b/bin/copy_production_db_to_local @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source .env +./bin/source_env export RAILS_ENV=development bundle exec rails db:migrate db:drop db:create ./bin/heroku_pg_dump_production_replica diff --git a/bin/copy_production_db_to_staging b/bin/copy_production_db_to_staging index c898671cb..3a78151b3 100755 --- a/bin/copy_production_db_to_staging +++ b/bin/copy_production_db_to_staging @@ -5,7 +5,7 @@ # * METABASE_URL # * STAGING_DATABASE_URL -source .env +./bin/source_env app='code-fund-ads-staging' staging_config="$(heroku pg:credentials:url -a $app)" diff --git a/bin/docker/start_rails b/bin/docker/start_rails new file mode 100755 index 000000000..3d1c09037 --- /dev/null +++ b/bin/docker/start_rails @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +bundle check || bundle install +bundle exec rails s -b 0.0.0.0 \ No newline at end of file diff --git a/bin/docker/start_sidekiq b/bin/docker/start_sidekiq new file mode 100755 index 000000000..6b4c47136 --- /dev/null +++ b/bin/docker/start_sidekiq @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +bundle check || bundle install +bundle exec sidekiq -C config/sidekiq.yml \ No newline at end of file diff --git a/bin/docker/start_webpacker b/bin/docker/start_webpacker new file mode 100755 index 000000000..0b637ecde --- /dev/null +++ b/bin/docker/start_webpacker @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +bundle check || bundle install +yarn check || yarn install +./bin/webpack-dev-server \ No newline at end of file diff --git a/bin/setup b/bin/setup index 94fd4d797..679e3f4f1 100755 --- a/bin/setup +++ b/bin/setup @@ -1,36 +1,25 @@ #!/usr/bin/env ruby -require 'fileutils' +require "fileutils" include FileUtils # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') - - # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' - # end + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") + system("bin/yarn") puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! "bundle exec rails db:create db:structure:load" + system! "bundle exec rails db:test:prepare" + system! "bundle exec rails db:seed" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails log:clear tmp:clear" end diff --git a/bin/source_env b/bin/source_env new file mode 100755 index 000000000..61e532d70 --- /dev/null +++ b/bin/source_env @@ -0,0 +1,4 @@ +#!/bin/bash + +# Export the vars in .env into your shell: +export "$(egrep -v '^#' .env | xargs)" diff --git a/config/database.yml b/config/database.yml index 0650175dc..9a08ff5b8 100644 --- a/config/database.yml +++ b/config/database.yml @@ -9,7 +9,7 @@ default: &default development: primary: &development_primary <<: *default - host: localhost + host: <%= ENV.fetch("PG_HOST", "localhost") %> database: <%= ENV.fetch("PG_DATABASE_NAME", "code_fund_ads_development") %> primary_replica: <<: *development_primary @@ -18,7 +18,7 @@ development: test: primary: &test_primary <<: *default - host: localhost + host: <%= ENV.fetch("PG_HOST", "localhost") %> database: code_fund_ads_test primary_replica: <<: *test_primary diff --git a/dip.yml b/dip.yml new file mode 100644 index 000000000..85f1b1490 --- /dev/null +++ b/dip.yml @@ -0,0 +1,79 @@ +version: '4.1' + +environment: + RAILS_ENV: development + +compose: + files: + - docker-compose.yml + +interaction: + sh: + description: Open a Bash shell within a Rails container (with dependencies up) + service: backend + command: /bin/bash + + bash: + description: Run an arbitrary script within a container (or open a shell without deps) + service: backend + command: /bin/bash + compose_run_options: [no-deps] + + bundle: + description: Run Bundler commands + service: backend + command: bundle + compose_run_options: [no-deps] + + rake: + description: Run Rake commands + service: backend + command: bundle exec rake + + rails: + description: Run Rails commands + service: backend + command: bundle exec rails + subcommands: + s: + description: Run Rails server available at http://localhost:3000 + service: rails + compose: + run_options: [service-ports, use-aliases] + + integration_tests: + description: Run rails test commands within test environment + service: backend + environment: + RAILS_ENV: test + command: bundle exec rails test + + system_tests: + description: Run rails system test commands within test environment + service: backend + environment: + RAILS_ENV: test + command: bundle exec rails test:system + + standard: + service: backend + command: bundle exec standardrb + compose_run_options: [no-deps] + + yarn: + service: backend + command: yarn + compose_run_options: [no-deps] + + psql: + service: postgres + command: psql -h postgres -U postgres -d code_fund_ads_development + + 'redis-cli': + service: redis + command: redis-cli -h redis + +provision: + - dip compose down --volumes + - dip compose up -d postgres redis + - dip bash -c ./bin/setup diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..5e501ff63 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,120 @@ +version: '2.4' + +services: + app: &app + build: + context: . + dockerfile: ./.docker/Dockerfile + args: + RUBY_VERSION: '2.6.6' + PG_MAJOR: '11' + NODE_MAJOR: '13' + YARN_VERSION: '1.22.4' + BUNDLER_VERSION: '2.1.4' + image: code_fund_ads-dev:1.0.0 + tmpfs: + - /tmp + env_file: + - .env + + backend: &backend + <<: *app + stdin_open: true + tty: true + volumes: + - .:/app:cached + - rails_cache:/app/tmp/cache + - bundle:/usr/local/bundle + - node_modules:/app/node_modules + - packs:/app/public/packs + - .docker/.psqlrc:/root/.psqlrc:ro + - .docker/.pryrc:/root/.pryrc:ro + environment: + - NODE_ENV=development + - RAILS_ENV=${RAILS_ENV:-development} + - BOOTSNAP_CACHE_DIR=/usr/local/bundle/_bootsnap + - WEBPACKER_DEV_SERVER_HOST=webpacker + - WEB_CONCURRENCY=1 + - HISTFILE=/app/log/.bash_history + - PSQL_HISTFILE=/app/log/.psql_history + - EDITOR=vi + - PG_HOST=postgres + - PG_USERNAME=postgres + - PG_PASSWORD=postgres + - SMTP_HOST=mail + - REDIS_URL=redis://redis:6379/ + - REDIS_CACHE_URL=redis://redis:6379 + - REDIS_QUEUE_URL=redis://redis:6379 + depends_on: + postgres: + condition: service_healthy + redis: + condition: service_healthy + + rails: + <<: *backend + command: ./bin/docker/start_rails + ports: + - '3000:3000' + + sidekiq: + <<: *backend + command: ./bin/docker/start_sidekiq + + postgres: + image: postgres:11.1 + volumes: + - .psqlrc:/root/.psqlrc:ro + - postgres:/var/lib/postgresql/data + - ./log:/root/log:cached + environment: + - PSQL_HISTFILE=/root/log/.psql_history + ports: + - 5432 + healthcheck: + test: pg_isready -U postgres -h 127.0.0.1 + interval: 5s + + redis: + image: redis:4.0-alpine + volumes: + - redis:/data + ports: + - 6379 + healthcheck: + test: redis-cli ping + interval: 1s + timeout: 3s + retries: 30 + environment: + - REDIS_CACHE_URL=redis://redis:6379 + - REDIS_QUEUE_URL=redis://redis:6379 + + webpacker: + <<: *app + command: ./bin/docker/start_webpacker + ports: + - '3035:3035' + volumes: + - .:/app:cached + - bundle:/usr/local/bundle + - node_modules:/app/node_modules + - packs:/app/public/packs + environment: + - NODE_ENV=${NODE_ENV:-development} + - RAILS_ENV=${RAILS_ENV:-development} + - WEBPACKER_DEV_SERVER_HOST=0.0.0.0 + + mail: + image: drujensen/mailcatcher:latest + ports: + - '1025:1025' + - '1080:1080' + +volumes: + postgres: + redis: + bundle: + node_modules: + rails_cache: + packs: diff --git a/docs/docker_development.md b/docs/docker_development.md new file mode 100644 index 000000000..051f12496 --- /dev/null +++ b/docs/docker_development.md @@ -0,0 +1,69 @@ +# Local Setup with Docker + +You can also use a dockerized development environment (based on the Evil Martians' [Ruby on Whales](https://evilmartians.com/chronicles/ruby-on-whales-docker-for-ruby-rails-development) setup). + +### 0. Install dependencies + +- [Docker](https://www.docker.com/products/docker-desktop) +- [Dip](https://github.com/bibendi/dip) +- [lazydocker*](https://github.com/jesseduffield/lazydocker) + +_* recommended but not required_ + +### 1. Clone the repo + +```sh +git clone https://github.com/gitcoin/code_fund_ads.git +``` + +### 2. Switch into the project folder + +```sh +cd code_fund_ads +``` + +### 3. Run the provision command + +```sh +dip provision +``` + +This will: + +- run `bundle install` +- run `yarn install` +- Create the databases +- Seed the database + + +### 4. Start the rails server along with webpacker + +```sh +dip up rails webpacker +``` + +### 5. See the app in action + +To see the application in action, open a browser window and navigate to http://localhost:3000. That's it! + +### Commands + +Prefix the command you want to run with `dip`. + +Example: + +```sh +# Local command +bundle install +# Docker command +dip bundle install +``` + +### Cleaning your system + +Here are some common commands you may use to clean your system of Docker artifacts: + +```sh +docker system prune -a -f +docker volume prune -f +``` diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 053077468..3f49e5a7d 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -8,7 +8,8 @@ window_size: [1400, 1400], js_errors: false, headless: !(ENV["WATCH"] == "true"), - process_timeout: 5 + process_timeout: 5, + browser_options: {'no-sandbox': nil} ) end