Skip to content

Commit

Permalink
Delete india demo environment (#5419)
Browse files Browse the repository at this point in the history
**Story card:**
[sc-12483](https://app.shortcut.com/simpledotorg/story/12483)

## Because
The demo environment for India is no longer required and is not being
used
  • Loading branch information
roypeter committed May 2, 2024
1 parent 136630b commit f09b35c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 106 deletions.
8 changes: 4 additions & 4 deletions .semaphore/deploy.yml
Expand Up @@ -34,10 +34,6 @@ promotions:
pipeline_file: bangladesh_demo_deployment.yml
auto_promote:
when: (branch = 'master' AND result = 'passed') OR (tag =~ '^release-.*' AND result = 'passed')
- name: India Demo Deployment
pipeline_file: india_demo_deployment.yml
auto_promote:
when: (branch = 'master' AND result = 'passed') OR (tag =~ '^release-.*' AND result = 'passed')
- name: Ethiopia Demo Deployment
pipeline_file: ethiopia_demo_deployment.yml
auto_promote:
Expand All @@ -46,3 +42,7 @@ promotions:
pipeline_file: sri_lanka_demo_deployment.yml
auto_promote:
when: (branch = 'master' AND result = 'passed') OR (tag =~ '^release-.*' AND result = 'passed')
- name: India Production Deployment
pipeline_file: india_production_deployment.yml
auto_promote:
when: (branch = 'master' AND result = 'passed') OR (tag =~ '^release-.*' AND result = 'passed')
26 changes: 0 additions & 26 deletions .semaphore/india_demo_deployment.yml

This file was deleted.

69 changes: 1 addition & 68 deletions README.md
Expand Up @@ -386,12 +386,7 @@ These are not actively committed into the repository. But can be generated by ru

## Deployment

Simple Server is continuously deployed from master to all environments via [Semaphore Workflows](https://docs.semaphoreci.com/essentials/modeling-complex-workflows/) as long as the build passes. We use a mixture of tools under the hood for deployments:

* Ansible: Server management and configuration is done using Ansible. See the [deployment repository](https://github.com/simpledotorg/deployment/tree/master/ansible)
for more information.
* Capistrano: Application code is deployed to servers for a specific country and environment using Capistrano.
* SemaphoreCI: Continuous deployment - all merges to master are auto-deployed to all environments.
Simple Server is continuously deployed from master to all environments via [Semaphore Workflows](https://docs.semaphoreci.com/essentials/modeling-complex-workflows/) as long as the build passes.

If you need to make a manual production release, run the release script from master:

Expand All @@ -401,68 +396,6 @@ bin/release

This will create a git release tag and automatically trigger a deployment to all environments through Semaphore. You can monitor the deployment progress [in Semaphore](https://simple.semaphoreci.com/projects/simple-server) via the tagged release's workflow. Please make sure to copy / paste the changelog from `bin/release` so you can post it in the #releases channel.

### Deployment to a specific environment

* We use Capistrano [multi-config](https://github.com/railsware/capistrano-multiconfig) to do multi-country deploys.
* Most `cap` commands are namespaced with the country name. For eg: `bundle exec cap india:staging deploy` to deploy to India staging. Note that some (like sandbox) are do not have a country, so the command would be `bundle exec cap sandbox deploy`.
* The available country names are listed under `config/deploy`. The subsequent envs, under the country directory, like
`config/deploy/india/staging.rb`

Simple Server can be deployed to a specific environment and/or specific country via `bundle exec cap <country>:<enviroment> deploy`.
Note that Sandbox does _not_ have a country prefix:

```bash
# Sandbox (deploys master)
bundle exec cap sandbox deploy
# Sandbox from a specific branch
BRANCH=my-branch-name bundle exec cap sandbox deploy
# Bangladesh demo
bundle exec cap bangladesh:demo deploy
```

Rake tasks can be run on the deployed server using Capistrano as well. For example,

```bash
bundle exec cap india:staging deploy:rake task=db:seed
```

### Deployment to a new environment

When setting up a new environment to deploy Simple Server to, follow these steps.

#### 1. Create a config file

Create a new file in `config/deploy/<env_name>.rb` for the new environment. It can be placed inside a subdirectory if
desired. Populate the new config file with relevant IP address info. Use an existing file for reference. For example,
the configuration for a deployment with two EC2 instances may look like:
```
server "ec2-12-111-34-45.ap-south-1.compute.amazonaws.com", user: "deploy", roles: %w[web app db cron whitelist_phone_numbers seed_data]
server "ec2-12-222-67-89.ap-south-1.compute.amazonaws.com", user: "deploy", roles: %w[web sidekiq]
```

The first server runs the web application and cron tasks, the second server runs Sidekiq to process background jobs.

#### 2. Install Sidekiq

A one-time installation of Sidekiq is required in new environments. Run the following command:

```bash
bundle exec cap <environment> sidekiq:install
```

#### 2. Deploy

You can now run a regular Capistrano deployment:

```bash
FIRST_DEPLOY=true bundle exec cap <environment> deploy
```

This may take a long time for the first deployment, since several dependencies (like Ruby) need to be installed.
Subsequent deployments will be much faster.

Note that `FIRST_DEPLOY=true` only needs to be specified on the first run. Any deployments afterwards don't need the flag.

### Deployment Resources

The infrastructure setup including the ansible and terraform scripts are documented in the [deployment repository](https://github.com/simpledotorg/deployment).
Expand Down
7 changes: 0 additions & 7 deletions config/deploy/india/production.rb

This file was deleted.

1 change: 0 additions & 1 deletion config/deploy/india/staging.rb

This file was deleted.

0 comments on commit f09b35c

Please sign in to comment.