Hi there.
I got the error when running circleci deploy.
I tried to implement RSpec in circleci deployment.
#!/bin/bash --login
bundle exec rake db:create
bundle exec rake db:schema:load
I, [2021-04-20T08:36:32.197469 #9588] INFO -- sentry: ** [Raven] Raven 2.9.0 configured not to capture errors: Not configured to send/capture in environment 'default'
rake aborted!
Mysql2::Error::ConnectionError: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
/home/ubuntu/Hardreggaecafe/vegewel/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `connect'
/home/ubuntu/Hardreggaecafe/vegewel/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in `initialize'
Here’s the config.
version: 2
jobs:
build:
working_directory: ~/Hardreggaecafe/vegewel
parallelism: 1
shell: /bin/bash --login
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
docker:
- image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
- image: circleci/ruby:2.5.0-node-browsers
environment:
- BUNDLER_VERSION: 1.16.1
- RAILS_ENV: 'test'
- image: circleci/mysql:5.7
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
- MYSQL_ROOT_HOST: '127.0.0.1'
steps:
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
- run:
working_directory: ~/Hardreggaecafe/vegewel
command: pip install pip==20.3.4
- run:
working_directory: ~/Hardreggaecafe/admin-vegewel
command: pip install urllib3==1.26
- run:
working_directory: ~/Hardreggaecafe/vegewel
command: pip install awsebcli --upgrade --user
- checkout
- run:
name: install dependencies
command: |
gem install bundler -v 2.0.2
bundle install --jobs=4 --retry=3 --path vendor/bundle
# Database setup
- run: mv ./config/database.yml.ci ./config/database.yml
- run:
name: Databasesetup
command: |
bundle exec rake db:create
bundle exec rake db:schema:load
# run tests!
- run:
name: Run rspec
command: |
mkdir /tmp/test-results
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | \
circleci tests split --split-by=timings)"
bundle exec rspec \
--format progress \
--format RspecJunitFormatter \
--out /tmp/test-results/rspec.xml \
--format progress \
$TEST_FILES
# collect reports
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
destination: test-results
- run:
name: Deploy
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo "Deploy production"
eb deploy Vegewel-production
else
echo "Deploy staging"
eb deploy vegewel-staging
fi
workflows:
version: 2
build-n-deploy:
jobs:
- build:
filters:
branches:
only:
- staging
- master
When I watched circleci processing, I noticed mysql and ruby container is still installing.
Do I need to wait until it finish? If so, how should I write in config? Please let me know.