-
Notifications
You must be signed in to change notification settings - Fork 1
DevOps on a Budget
Aaron Helton edited this page Nov 12, 2021
·
1 revision
- Deploying this code is best done from a Linux machine, because the AWS environment (API Gateway and Lambda) is also Linux.
- Connect to the EC2 instance that serves as our deployment source (e.g., newdr), then navigate to ~/dlx-rest
- Run the deploy script for the environment you want to deploy to, e.g.:
sh deploy.sh dev
- Options are dev, qat, uat, and prod
- If the database already exists, you'll need to delete it and re-create it. Doing this in MongoDB Compass is the easiest option.
- Connect to the mongodb EC2 instance via SSH
- Navigate to the backups folder: $ cd /backups
- Use mongorestore to populate from the most recent backup (change the environment name in all four locations in the command to reflect your target environment, e.g., UAT = uat_, etc.):
$ /usr/bin/mongorestore --uri="mongodb://qat_undlFilesAdmin:<password>@localhost:8080/qat_undlFiles?authSource=qat_undlFiles&ssl=false" --gzip --archive="undlFiles.gz" --nsFrom="undlFiles.*" --nsTo="qat_undlFiles.*"
- Connect to the deployment source EC2 instance via SSH, e.g., newdr
- Navigate to the dlx-rest directory, e.g., ~/dlx-rest
- Run the init_indexes script from the DLX library, e.g.:
python ./venv/lib/python3.6/site-packages/dlx/scripts/init_indexes.py --connect="<connect string>"
- Connect to the deployment source EC2 instance via SSH, e.g., newdr
- Navigate to the dlx-rest directory, e.g., ~/dlx-rest
- Run the build_logical_fields script from the DLX library, e.g.:
python ./venv/lib/python3.6/site-packages/dlx/scripts/build_logical_fields.py --connect="<connect string>"
Note: Connect strings can be found in the following locations:
- AWS Systems Manager, in the Parameter Store
- In the command history of newdr and mongodb EC2 instances
- In your MongoDB Compass, if you've connected before
- In archived wiki pages in our Teams channels
The usernames and passwords are different for each environment, so you'll need the credentials in the connect string for the particular environment you want to manage.
This is a fast way to create a group of users, i.e., though scripts.
- Connect to the deployment source EC2 instance via SSH, e.g., newdr
- Navigate to the dlx-rest directory, e.g., ~/dlx-rest
- Activate the environment you need to manage, e.g.:
source activate.sh DEV
- Use the Flask commands to create the user:
flask create-user <email>
- Take note of the auto-generated password. This is the only time it will be displayed.
You need at least one admin in your system, and then you can manage users and assign permissions to roles, etc.
- Connect to the deployment source EC2 instance via SSH, e.g., newdr
- Navigate to the dlx-rest directory, e.g., ~/dlx-rest
- Activate the environment you need to manage, e.g.:
source activate.sh DEV
- Use the Flask commands to create the user:
flask maka-admin <email>