Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to adapt for greenfield project #290

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
RAILS_ENV=test
DATABASE_HOST=solutions_db
DATABASE_HOST=tikcrm_db
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=password
DATABASE_NAME=r_solutions_test
DATABASE_NAME=tikcrm_test
DATABASE_PORT=5432
REDIS_URL=redis://solutions_redis:6379/12
REDIS_URL=redis://tikcrm_redis:6379/12
APP_HOST=lvh.me:5250
RECAPTCHA_SITE_KEY=6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy
RECAPTCHA_SECRET_KEY=6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx
10 changes: 5 additions & 5 deletions clean_run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
RAILS_ENV=test
PARALLEL_MINITEST=true
echo "RUNNING IN PARALLEL, TTY IS NOT SUPPORTED! byebug/binding.pry will cause hangs!"
docker-compose run --rm solutions_test rails db:environment:set RAILS_ENV=test
docker-compose run --rm test rails db:environment:set RAILS_ENV=test
echo "Setting: RAILS_ENV=$RAILS_ENV"
docker-compose run --rm -e PARALLEL_MINITEST solutions_test rails db:drop && \
docker-compose run --rm -e PARALLEL_MINITEST solutions_test rails db:create && \
docker-compose run --rm -e PARALLEL_MINITEST solutions_test rails db:migrate && \
docker-compose run --rm -e PARALLEL_MINITEST solutions_test rails test -f --verbose
docker-compose run --rm -e PARALLEL_MINITEST test rails db:drop && \
docker-compose run --rm -e PARALLEL_MINITEST test rails db:create && \
docker-compose run --rm -e PARALLEL_MINITEST test rails db:migrate && \
docker-compose run --rm -e PARALLEL_MINITEST test rails test -f --verbose
11 changes: 2 additions & 9 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
if Rails.env.production?
Sidekiq.configure_server { |c| c.redis = { url: ENV['REDIS_URL'] } }
else
if Rails.env.development?
Sidekiq.configure_server { |c| c.redis = { url: 'redis://solutions_redis:6379/12' } }
else
Sidekiq.configure_server { |c| c.redis = { url: 'redis://localhost:6379' } }
end
end
Sidekiq.configure_server { |c| c.redis = { url: ENV['REDIS_URL'] } }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pralish we should make this infrastructure improvement 👍


38 changes: 19 additions & 19 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ volumes:
gem_cache:
shared_data:
services:
solutions_redis:
tikcrm_redis:
image: 'redis:4.0-alpine'
command: redis-server
container_name: solutions_redis
container_name: tikcrm_redis
networks:
- development
- test
volumes:
- 'shared_data:/var/shared/redis'
ports:
- 6380:6379
solutions_db:
tikcrm_db:
image: postgres:12.5-alpine
container_name: solutions_db
container_name: tikcrm_db
volumes:
- db_data:/var/lib/postgresql/data
- shared_data:/var/shared
Expand All @@ -32,12 +32,12 @@ services:
POSTGRES_PASSWORD: password
ports:
- 6000:5432
solutions_sidekiq:
tikcrm_sidekiq:
depends_on:
- solutions_db
- solutions_redis
image: violet_rails_solutions_app
container_name: solutions_sidekiq
- tikcrm_db
- tikcrm_redis
image: tikcrm_server_app
container_name: tikcrm_sidekiq
command: sidekiq -c 1
volumes:
- .:/var/app
Expand All @@ -49,20 +49,20 @@ services:
- test
ports:
- 5251:5251
mailcatcher:
container_name: mailcatcher
tikcrm_mailcatcher:
container_name: tikcrm_mailcatcher
image: yappabe/mailcatcher
networks:
- development
- test
ports:
- 1025:1025
- 1080:1080
solutions_app:
app:
build:
context: .
dockerfile: Dockerfile.dev
container_name: solutions_app
container_name: app
volumes:
- .:/var/app
- shared_data:/var/shared
Expand All @@ -79,11 +79,11 @@ services:
environment:
RAILS_ENV: development
depends_on:
- solutions_db
- solutions_redis
solutions_test:
image: violet_rails_solutions_app
container_name: solutions_test
- tikcrm_db
- tikcrm_redis
test:
image: tikcrm_server_app
container_name: tikcrm_test
volumes:
- .:/var/app
- shared_data:/var/shared
Expand All @@ -100,5 +100,5 @@ services:
environment:
RAILS_ENV: test
depends_on:
- solutions_db
- tikcrm_db

2 changes: 1 addition & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RAILS_ENV=test
echo "Setting: RAILS_ENV=$RAILS_ENV"

docker-compose run --rm solutions_test rails test -f --verbose
docker-compose run --rm test rails test -f --verbose