- Use ActiveJob
- Use different adapters: Sidekiq, Resque
- Backend adapters depend on workers to execute jobs
- Use queues for different kind of jobs / tasks: mailing, maintenance, etc.
- Job perform callbacks are available as well
- ActionMailer can work as an ActiveJob
- Watch out for Thread safety - pay attention to instance variables and how they are accessed and changed in concurrent processes. One option is to use Mutex
- Sidekiq > Resque > DelayedJob (But it depends on the needs and available resources)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| frontend: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile.e2e | |
| command: nginx | |
| networks: | |
| main: | |
| aliases: | |
| - frontend | |
| ports: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| e2e: | |
| adapter: postgresql | |
| host: postgres | |
| encoding: unicode | |
| database: your_project_test | |
| pool: 5 | |
| username: postgres | |
| password: your_password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM quay.io/netguru/baseimage:0.10.1 # Image containing all dependecies like imagemagick etc | |
| ENV RUBY_VERSION 2.4.2 # To get proper ruby | |
| ## Install Ruby & Dependencies | |
| RUN \ # Install ruby | |
| apt-get update -q && \ | |
| apt-get install -q libcurl3 && \ | |
| apt-get install -q -y cron && \ | |
| ruby-install --system --cleanup ruby $RUBY_VERSION -- --disable-install-rdoc && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Capybara.register_driver :chrome do |app| | |
| Capybara::Selenium::Driver.new( | |
| app, | |
| browser: :chrome, | |
| desired_capabilities: { "chromeOptions" => { "args" => %w[window-size=1024,768] } }, | |
| ) | |
| end | |
| if Rails.env.test? | |
| Capybara.register_driver :selenium do |app| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '2' # Version of composer | |
| services: | |
| backend: # Backend container | |
| build: | |
| context: ~/backend # Backend should be pulled by git to this location | |
| dockerfile: docker/Dockerfile.e2e # The location of Dockerfile, relative to context above | |
| depends_on: # The containers below will be resolved and loaded before backed | |
| - redis | |
| - postgres | |
| - frontend |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| machine: | |
| node: | |
| version: 8.2.1 | |
| pre: | |
| - mkdir ~/.cache/yarn | |
| - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 # Download Docker 1.10.0 (linked to docker-compose v2) for CircleCI | |
| - >- | |
| GIT_SSH_COMMAND='ssh -i ~/.ssh/id_jaacoo-backend-e2e-tests-deploy-key-for-jaacoo-repo' | |
| git clone git@github.com:netguru/jaacoo.git ~/backend && cd ~/backend # Download backend to ~/backend. The SSH for backend had to be placed in CircleCI build setup page | |
| - set -o allexport; source "${HOME}/${CIRCLE_PROJECT_REPONAME}/.env"; set +o allexport |
- It may hide a problem from a plain sight
- Sometimes it resolves problem which should be there at the first place
- Implementation of
trysays nothing about the purpose of what is written
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create | |
| @form_object = UserRegistration::RegistrationForm.new(user_params, params[:notify]) | |
| if @form_object.register | |
| ... #typically we flash and redirect here | |
| else | |
| render :new | |
| end | |
| end |