Deployment


Server deployment

  • The AgtroPortal VM is deployed in INRAE servers

  • The global architecture


Code deployment

  • AgroPortal new deployment process: https://github.com/ontoportal-lirmm/agroportal_deployment

    • This repository contains the Capistrano-based deployment system for the three AgroPortal components:

      • BioPortal Web UI (bioportal_web_ui)

      • Ontologies API (ontologies_api)

      • NCBO Cron (ncbo_cron)

    • It supports deployment to production (master branch) and pre-production (development branch) environments with a simple command-line script.

Quick Start: Deploy in One Command

From the root of this repository, run:

./deploy.sh <application> <stage>

Examples

# Deploy with full name of apps in production and pre_production servers
./deploy.sh bioportal_web_ui production
./deploy.sh ontologies_api pre_production
./deploy.sh ncbo_cron production

# Use short aliases (UI, API, CRON)
./deploy.sh UI production
./deploy.sh API pre_production
./deploy.sh CRON production

How to use it inside the server

This repo is private so we have to add PAT token so that we can clone it in the server (copy the PAT token in settings => Secrets and variables => Actions => Variables => Repository variables) or generate new one.

Inside the server do:

# with user ontoportal
git clone https://<PAT_TOKEN>@github.com/agroportal/agroportal_deployment.git
cd agroportal_deployment
./deploy.sh <application> <stage>

Project Structure

.
├── deployment/                 # Capistrano project (Ruby-based)
│   ├── Capfile                # Capistrano entry point
│   ├── Gemfile                # Ruby dependencies
│   └── config/
│       ├── deploy.rb          # Main deployment logic
│       ├── apps/              # App-specific settings (repo, etc.)
│       │   ├── bioportal_web_ui.rb
│       │   ├── ontologies_api.rb
│       │   └── ncbo_cron.rb
│       └── deploy/            # Environment definitions
│           ├── production.rb
│           └── pre_production.rb
├── projects_configs/          # Environment-specific config files
│   ├── bioportal_web_ui/
│   │   ├── production/config/
│   │   └── pre_production/config/
│   ├── ontologies_api/
│   │   ├── production/config/
│   │   └── pre_production/config/
│   └── ncbo_cron/
│       ├── production/config/
│       └── pre_production/config/
├── deploy.sh                  # Main deployment script (use this!)
└── README.md

Key Directories

Directory

Purpose

deployment/

Contains the Capistrano automation code (Ruby)

projects_configs/

Holds environment-specific configuration files that get uploaded during deploy (e.g., database.yml, settings.rb)

deployment/config/apps/

Defines Git repo, app name, and other per-project settings

deployment/config/deploy/

Defines servers, branches, and environment settings (production vs pre_production)

How It Works

  1. You run ./deploy.sh UI production

  2. The script:

    • Validates inputs

    • Normalizes UI → bioportal_web_ui (if you use short aliases)

    • Installs Ruby gems (into vendor/bundle)

    • Runs: APP=bioportal_web_ui bundle exec cap production deploy

  3. Capistrano:

    • Clones the correct Git repo

    • Uploads configs from projects_configs/bioportal_web_ui/production/config/

    • Symlinks shared files

    • Restarts the service (systemctl restart bioportal_web_ui.service)

Requirements on the server

  • Ruby 3.1+ (managed via rbenv on target servers)

  • SSH access to target servers as the ontoportal user

  • Internet access (to clone Git repos and install gems)

Notes

  • To add a new application, create:

    • deployment/config/apps/<app_name>.rb

    • projects_configs/<app_name>/production/config/

    • projects_configs/<app_name>/pre_production/config/

  • To add a new environment, create:

    • deployment/config/deploy/<env_name>.rb

    • Update VALID_STAGES in deploy.sh

  • Config files in projects_configs/ are copied as-is to the app’s release_path during deploy.