-
Notifications
You must be signed in to change notification settings - Fork 1
Deployment
For security and resilience purposes, there's an instance of the store for each country using the system. When doing a deploy, you will most likely want to do it in all active instances as a minimum, and possibly in all existing instances.
At this moment, releases of new versions of Maap Store are published according to lifecycles of the collector's projects, usually grouping a couple of features and bug fixes on each iteration.
Each release is named following Semantic Versioning
technique (<Major.Minor.Patch>
format).
Images are updated during Travis builds according to ManasTech's build.sh
script.
Whenever a commit with an associated tag and/or a commit belonging to either master
or a branch prefixed by release/
is pushed, a new version of the image is uploaded to the tags.
Once images are successfully updated, you'll need to head over to Rancher. For each instance you want to deploy to, you'll need to upgrade the app
and worker
containers to the image you want to deploy.
If any variables were added to the environment during development, remember to add them in the upgrade screen.
Run bundle exec rake db:migrate
inside a web
shell if there is any pending migration.
Access the instance you upgraded and check everything's ok! The URL is often instance-name.instedd.org/admin
.
Don't forget to delete the now-out-dated stopped containers after the upgrading process finishes successfully!
Steps on Rancher in order to set up a new instance comprises:
- Add a new stack. We are currently using Rancher's "Add from catalog" functionality for that purpose. In this case, choose "maap-store" catalog.
- Fill the template. It's highly recommended to copy the values from an existing instance's template, being careful of changing the values of the fields that depends on that specific instance such as the name or database related fields.
- Create
maap-app-data
andmaap-app-cache
volumes. - Launch the new instance.
- Configure the proxy so that it points
maap-store/web:80
- Run
rake db:migrate
andrake db:seed
inside app container
Each country operates on a different set of antibiotics. In order to load them into the country's database, you can tweak
and reuse the fragment of code in seeds.rb
:
CSV.foreach(
Rails.root.join('db', 'seeds', "antibiotics.csv"),
headers: true
) do |row|
Antibiotic.find_or_create_by(
name: row['name'].split.map(&:capitalize).join(' '),
strength_value: row['strength_value'],
strength_unit: row['strength_unit'],
form: row['form'].split.map(&:capitalize).join(' '),
pack_size: row['pack_size'].split.map(&:capitalize).join(' '),
brand: row['brand'].split.map(&:capitalize).join(' ')
)
end
For that, replace the content of "antibiotics.csv" with the list of antibiotics for the target country, and change the code to match accessor names with proper column names (the one's that are used in the provided antibiotic list).
Sometimes when starting the server, it complains about a sever already running and
tell us to check tmp/pids/server.pid
. If that's so, remove /app/tmp/pids/server.pid
and restart
the server.
It might happen that when starting a new instance, rails server complains about not having its assets precompiled.
It that's so, precompile them manually by running rake assets:precompile
.