Development Cheatsheet
Quick Reference Guide
1. Clone and Setup
From the terminal in your development environment:
git clone <your repo>
cd <your repo>
2. Create Feature Branch
git checkout -b <foo-feature>
3. Environment Setup
Before making changes:
- Ensure all secrets are created in AWS Secret Manager
- Add secret names to the .env file
Important Note
The required environment variables can be found in the Development Environment management section of the site detail page. The platform will automatically handle all secret creation - you only need to configure the developer secrets prior to building the development environment. You can simply copy and paste the Environment Template into the .env file in your app code.
4. Python Environment Setup
From the root directory of your repo, initialize the Python virtual environment:
source /home/ec2-user/py3.11-venv/bin/activate
Create and setup your .env file:
cp ./app/.env.example ./.env
Load environment variables into the venv:
set -a
source .env
set +a
5. Launch the Application
Open two terminal tabs in the root directory of your project:
Frontend (Terminal 1):
sudo npm update
sudo npm i
sudo npm run watch
Backend (Terminal 2):
pip install -r app/requirements.txt
flask db upgrade # need to run this or future migrations will fail
gunicorn --bind 0.0.0.0:8000 --timeout 120 run:app
Note
Make sure to run flask db upgrade
before starting the application, or future migrations will fail.
6. Commit Changes
Recommended: Clear the pycache before checking in changes:
# ensure the venv is activated
source /home/ec2-user/py3.11-venv/bin/activate
python clear_cache.py
git add *
git commit -m "commit message"
git push origin <foo-feature>
Deployment Process
Staging Deployment
Merge your foo-feature branch into Staging. This will automatically trigger a Staging deployment.
Production Deployment
To deploy to Production, merge either:
- Your foo-feature branch, or
- The Staging branch containing your changes
into your main branch. This will automatically trigger a Production deployment.
Important
Always test your changes in Staging before deploying to Production.
Need Help?
Join our Slack community to connect with other developers and get help in the #support channel.