amida-tech / greyscale

Indaba - Turn knowledge into data :earth_africa: :earth_asia: :earth_americas:
http://indaba.amida-tech.com
Other
8 stars 4 forks source link

Feature/devops 354 jf greyscale seeding #507

Closed jmfadeley closed 5 years ago

jmfadeley commented 5 years ago

The purpose of this PR is to ease the setup processes for Indaba's backend, particularly for newcomers. Indaba has a complicated setup process that involves using several microservices, making for a heavy effort to setup and train new people. Instead, this PR offers several

What does this PR do?

Indaba requires three microservices in order to run: amida-auth-microservice, amida-messaging-microservice and amida-survey-microservice. If the user has Docker however, they can take advantage of the compose files in backend/dev_deploy in order to quickly setup their environments.

Related JIRA tickets:

How should this be manually tested?

  1. Create a network with docker network create indaba-network.
  2. Go into /backend/dev_deploy
  3. Run docker-compose -f docker-compose.db.yml up -d. This creates a database container that can be access from localhost:5433. This container will neatly contain all the databases for your local Indaba instance. While 5433 may sound confusing, the docker containers will access the service on 5432. 5433 is available for your personal access as your localhost:5432 is probably reserved for your own instance of Postgres.
  4. Run docker-compose -f docker-compose.dev.yml up -d. This creates the services, migrates and instantiates them.
  5. If you are going to do development against Greyscale, you probably don't want it deployed on Docker. Instead, got back to /backend and run yarn seed to generate a superuser and prepare the databases. Then run yarn start to start the database. Once begun, run yarn test-seed to generate some basic users and a developer namespace you can create projects against.

Keep in mind that you will have to update your local Greyscale's .env value at: GREYSCALE_PG_PORT=5433

  1. If you are going to develop exclusively against the frontend (indaba-client), you can just Greyscale using Docker. From /backend run docker build -t indaba-backend . (note that in the future you can skip this step). Once your image is build, you can also run docker-compose up -d from /backend/dev_deploy. Once it's up, run yarn test-seed to generate these users.

From there, get your local indaba-client up and regression test. Note that the login information has changed: test-adm@mail.net | Testadmin1! userX@mail.net | Testuser1!

Background/Context

The creation of the database is separate the rest of the process because it is difficult to guarantee that the creation scripts are finished in time. This is a problem with distributed systems. In the future this process may change to rely on Docker stack which has some means to run all this from one line. For now,

Screenshots (if appropriate):