Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilelkihal committed Jun 12, 2024
2 parents afe1b10 + 88c6855 commit 03a7e8e
Show file tree
Hide file tree
Showing 14 changed files with 245 additions and 151 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ docker-compose.override.yml
yarn-error.log
yarn-debug.log*
.yarn-integrity

config/credentials/*
config/credentials.yml.enc
97 changes: 49 additions & 48 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,28 @@ name: Capistrano Deployment
# Controls when the action will run.
on:
push:
branches: [ stage test]
branches:
- stage
- test
# Allows running this workflow manually from the Actions tab
workflow_dispatch:
inputs:
BRANCH:
description: 'Branch/tag to deploy'
description: "Branch/tag to deploy"
options:
- stage
- test
- master
default: test
default: stage
required: true
environment:
description: 'target environment to deploy to'
description: "target environment to deploy to"
type: choice
options:
- staging
- production
- appliance
- agroportal
- test
default: test
default: stage
jobs:
deploy:
runs-on: ubuntu-latest
Expand All @@ -47,45 +48,45 @@ jobs:
PRIVATE_CONFIG_REPO: ${{ format('[email protected]:{0}.git', secrets.CONFIG_REPO) }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: set branch/tag and environment to deploy from inputs
run: |
# workflow_dispatch default input doesn't get set on push so we need to set defaults
# via shell parameter expansion
# https://dev.to/mrmike/github-action-handling-input-default-value-5f2g
USER_INPUT_BRANCH=${{ inputs.branch }}
echo "BRANCH=${USER_INPUT_BRANCH:github.head_ref:-master}" >> $GITHUB_ENV
- name: set branch/tag and environment to deploy from inputs
run: |
# workflow_dispatch default input doesn't get set on push so we need to set defaults
# via shell parameter expansion
# https://dev.to/mrmike/github-action-handling-input-default-value-5f2g
USER_INPUT_BRANCH=${{ inputs.branch }}
echo "BRANCH=${USER_INPUT_BRANCH:github.head_ref:-master}" >> $GITHUB_ENV
USER_INPUT_ENVIRONMENT=${{ inputs.environment }}
echo "TARGET=${USER_INPUT_ENVIRONMENT:-staging}" >> $GITHUB_ENV
CONFIG_REPO=${{ secrets.CONFIG_REPO }}
GH_PAT=${{ secrets.GH_PAT }}
echo "PRIVATE_CONFIG_REPO=https://${GH_PAT}@github.com/${CONFIG_REPO}" >> $GITHUB_ENV
echo "SSH_JUMPHOST=${{ secrets.SSH_JUMPHOST }}" >> $GITHUB_ENV
echo "SSH_JUMPHOST_USER=${{ secrets.SSH_JUMPHOST_USER }}" >> $GITHUB_ENV
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: get-deployment-config
uses: actions/checkout@v3
with:
repository: ${{ secrets.CONFIG_REPO }} # repository containing deployment settings
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
path: deploy_config
- name: copy-deployment-config
run: cp -r deploy_config/ontoportal_web_ui/${{ inputs.environment }}/* .
# add ssh hostkey so that capistrano doesn't complain
- name: Add jumphost's hostkey to Known Hosts
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_JUMPHOST }}"
ssh-keyscan -H ${{ secrets.SSH_JUMPHOST }} > ~/.ssh/known_hosts
shell: bash
- uses: miloserdow/capistrano-deploy@master
with:
target: ${{ env.TARGET }} # which environment to deploy
deploy_key: ${{ secrets.DEPLOY_ENC_KEY }} # Name of the variable configured in Settings/Secrets of your github project
USER_INPUT_ENVIRONMENT=${{ inputs.environment }}
echo "TARGET=${USER_INPUT_ENVIRONMENT:-staging}" >> $GITHUB_ENV
CONFIG_REPO=${{ secrets.CONFIG_REPO }}
GH_PAT=${{ secrets.GH_PAT }}
echo "PRIVATE_CONFIG_REPO=https://${GH_PAT}@github.com/${CONFIG_REPO}" >> $GITHUB_ENV
echo "SSH_JUMPHOST=${{ secrets.SSH_JUMPHOST }}" >> $GITHUB_ENV
echo "SSH_JUMPHOST_USER=${{ secrets.SSH_JUMPHOST_USER }}" >> $GITHUB_ENV
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6 # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: get-deployment-config
uses: actions/checkout@v3
with:
repository: ${{ secrets.CONFIG_REPO }} # repository containing deployment settings
token: ${{ secrets.GH_PAT }} # `GH_PAT` is a secret that contains your PAT
path: deploy_config
- name: copy-deployment-config
run: cp -r deploy_config/ontoportal_web_ui/${{ inputs.environment }}/* .
# add ssh hostkey so that capistrano doesn't complain
- name: Add jumphost's hostkey to Known Hosts
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_JUMPHOST }}"
ssh-keyscan -H ${{ secrets.SSH_JUMPHOST }} > ~/.ssh/known_hosts
shell: bash
- uses: miloserdow/capistrano-deploy@master
with:
target: ${{ env.TARGET }} # which environment to deploy
deploy_key: ${{ secrets.DEPLOY_ENC_KEY }} # Name of the variable configured in Settings/Secrets of your github project
3 changes: 2 additions & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ name: Docker branch Images build
on:
push:
branches:
- master
- development
- stage
- test
release:
types: [ published ]
types: [published]
jobs:
push_to_registry:
name: Push Docker branch image to Docker Hub
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,14 @@ RUN yarn install && yarn build



RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_production.rb
RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_development.rb
RUN cp config/database.yml.sample config/database.yml

# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile --gemfile app/ lib/

# RUN SECRET_KEY_BASE_DUMMY="1" ./bin/rails assets:precompile
RUN SECRET_KEY_BASE_DUMMY="1" ./bin/rails assets:precompile

ENV BINDING="0.0.0.0"
EXPOSE 3000
Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

# Main Rails gem
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '7.0.7'
gem 'rails', '7.0.3'

# JavaScript bundling for Rails
gem 'jsbundling-rails'
Expand Down Expand Up @@ -108,8 +108,9 @@ gem 'omniauth'
gem 'omniauth-rails_csrf_protection'
gem 'omniauth-github'
gem 'omniauth-google-oauth2'
gem 'omniauth-orcid'
gem 'omniauth-keycloak'
gem 'omniauth-orcid'
gem 'omniauth-rails_csrf_protection'

group :staging, :production, :appliance do
# Application performance monitoring
Expand Down
106 changes: 53 additions & 53 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,67 +17,67 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.7)
actionpack (= 7.0.7)
activesupport (= 7.0.7)
actioncable (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.7)
actionpack (= 7.0.7)
activejob (= 7.0.7)
activerecord (= 7.0.7)
activestorage (= 7.0.7)
activesupport (= 7.0.7)
actionmailbox (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.7)
actionpack (= 7.0.7)
actionview (= 7.0.7)
activejob (= 7.0.7)
activesupport (= 7.0.7)
actionmailer (7.0.3)
actionpack (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activesupport (= 7.0.3)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.7)
actionview (= 7.0.7)
activesupport (= 7.0.7)
rack (~> 2.0, >= 2.2.4)
actionpack (7.0.3)
actionview (= 7.0.3)
activesupport (= 7.0.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.7)
actionpack (= 7.0.7)
activerecord (= 7.0.7)
activestorage (= 7.0.7)
activesupport (= 7.0.7)
actiontext (7.0.3)
actionpack (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.7)
activesupport (= 7.0.7)
actionview (7.0.3)
activesupport (= 7.0.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.7)
activesupport (= 7.0.7)
activejob (7.0.3)
activesupport (= 7.0.3)
globalid (>= 0.3.6)
activemodel (7.0.7)
activesupport (= 7.0.7)
activerecord (7.0.7)
activemodel (= 7.0.7)
activesupport (= 7.0.7)
activestorage (7.0.7)
actionpack (= 7.0.7)
activejob (= 7.0.7)
activerecord (= 7.0.7)
activesupport (= 7.0.7)
activemodel (7.0.3)
activesupport (= 7.0.3)
activerecord (7.0.3)
activemodel (= 7.0.3)
activesupport (= 7.0.3)
activestorage (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activesupport (= 7.0.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.7)
activesupport (7.0.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -325,7 +325,7 @@ GEM
rack (>= 1.2, < 4)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
oj (3.16.3)
oj (3.16.4)
bigdecimal (>= 3.0)
omniauth (2.1.2)
hashie (>= 3.4.6)
Expand Down Expand Up @@ -373,20 +373,20 @@ GEM
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.7)
actioncable (= 7.0.7)
actionmailbox (= 7.0.7)
actionmailer (= 7.0.7)
actionpack (= 7.0.7)
actiontext (= 7.0.7)
actionview (= 7.0.7)
activejob (= 7.0.7)
activemodel (= 7.0.7)
activerecord (= 7.0.7)
activestorage (= 7.0.7)
activesupport (= 7.0.7)
rails (7.0.3)
actioncable (= 7.0.3)
actionmailbox (= 7.0.3)
actionmailer (= 7.0.3)
actionpack (= 7.0.3)
actiontext (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activemodel (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
bundler (>= 1.15.0)
railties (= 7.0.7)
railties (= 7.0.3)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
Expand Down Expand Up @@ -593,7 +593,7 @@ DEPENDENCIES
mysql2
net-ftp (~> 0.2.0)
net-http (~> 0.3.2)
newrelic_rpm
newrelic_rpm (< 9.10.0)
oj
omniauth
omniauth-github
Expand Down
6 changes: 3 additions & 3 deletions bin/ontoportal
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ dev() {
bash_cmd+=" (bundle config unset local.ontologies_api_client) &&"
fi
done
bash_cmd+=" (bundle check || bundle install || bundle update) && bin/rails db:prepare && bundle exec rails s -b 0.0.0.0 -p 3000"
docker_run_cmd+=" --service-ports rails bash -c \"$bash_cmd\""
bash_cmd+=" (bundle check || bundle install) && bin/rails db:prepare && bundle exec rails s -b 0.0.0.0 -p 3000"
docker_run_cmd+=" --service-ports dev bash -c \"$bash_cmd\""
echo "$docker_run_cmd"
echo "Run: bundle exec rails s -b 0.0.0.0 -p 3000"
eval "$docker_run_cmd"
Expand Down Expand Up @@ -188,7 +188,7 @@ test() {
# Function to handle the "run" option
run() {
echo "Run: $*"
docker compose run --rm -it rails bash -c "$*"
docker compose run --rm -it dev bash -c "$*"
}

create_config_files
Expand Down
1 change: 0 additions & 1 deletion config/database.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ test:
production:
<<: *default
database: bioportal_ui_production
username: bp_user
password: <%= ENV["BIOPORTAL_WEB_UI_DATABASE_PASSWORD"] %>

appliance:
Expand Down
17 changes: 17 additions & 0 deletions config/deploy/agroportal.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary
# server in each group is considered to be the first
# unless any hosts have the primary property set.
# Don't declare `role :all`, it's a meta role
role :app, %w[agroportal.lirmm.fr]
role :db, %w[agroportal.lirmm.fr] # sufficient to run db:migrate only on one system
set :branch, ENV.include?('BRANCH') ? ENV['BRANCH'] : 'master'
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server
# definition into the server list. The second argument
# something that quacks like a hash can be used to set
# extended properties on the server.
# server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
set :log_level, :error
Loading

0 comments on commit 03a7e8e

Please sign in to comment.