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

Develop #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
65 changes: 65 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
version: 2.1

orbs:
ruby: circleci/[email protected]

executors:
ruby:
docker:
- image: cimg/ruby:3.0.0
environment:
RAILS_ENV: test
ruby_and_postgres:
docker:
- image: cimg/ruby:3.0.0
environment:
RAILS_ENV: test
DATABASE_HOST: localhost
- image: cimg/postgres:14.4
environment:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust

jobs:
build:
executor: ruby
steps:
- checkout
- ruby/install-deps:
key: gems-{{ checksum "Gemfile.lock" }}
- persist_to_workspace:
root: .
paths: .
tests:
parallelism: 4
executor: ruby_and_postgres
steps:
- attach_workspace:
at: .
- run: bundle exec rails db:setup
- ruby/rspec-test
# does not check coverage because of parallelism
static_analysis:
parallelism: 4
executor: ruby
steps:
- attach_workspace:
at: .
- ruby/rubocop-check:
parallel: true
- run: bundle exec brakeman -z
- run: gem install bundle-audit
- run: bundle-audit update
- run: bundle-audit

workflows:
version: 2
ci_workflow:
jobs:
- build
- tests:
requires:
- build
- static_analysis:
requires:
- build
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ group :development do
end

group :test do
gem 'rspec_junit_formatter'
gem 'rspec-sidekiq'
gem 'simplecov', require: false
gem 'timecop'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ GEM
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.10.2)
rspec_junit_formatter (0.5.1)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.31.2)
json (~> 2.3)
parallel (~> 1.10)
Expand Down Expand Up @@ -266,6 +268,7 @@ DEPENDENCIES
rails (~> 6.1.4, >= 6.1.4.1)
rspec-rails
rspec-sidekiq
rspec_junit_formatter
rubocop
rubocop-rails
rubocop-rspec
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ After cloning
secret_key_base: <secret_key_base>
```

- Example of command for db since pgsql is a badly made as rvm:
- Example of command for db:
- `sudo -u postgres psql`
- `create user the_simple_api with password 'password';`
- `alter role the_simple_api superuser createrole createdb replication;`
- `create database the_simple_api_production owner the_simple_api;`


Expand All @@ -69,7 +68,7 @@ After cloning
to place both in `/etc/nginx/sites-available/`. Templates are available in `external_files` folders.

- Passenger is [installed](https://www.phusionpassenger.com/docs/advanced_guides/install_and_upgrade/nginx/install/oss/focal.html)
- Redis is [installed](https://redis.io/docs/getting-started/installation/install-redis-on-linux/)
- Redis is [installed](https://redis.io/docs/getting-started/installation/install-redis-on-linux/) + `sudo systemctl enable redis-server` + `sudo systemctl start redis-server`

## Make it work
- `export production_server_ip="120.120.120.120"`
Expand Down