-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'edge' into te-reports-refactor
- Loading branch information
Showing
19 changed files
with
306 additions
and
309 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Deploy Preprod | ||
|
||
on: | ||
push: | ||
branches: | ||
- edge | ||
|
||
jobs: | ||
deploy-backend: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Login to Heroku | ||
uses: akhileshns/[email protected] | ||
with: | ||
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | ||
heroku_app_name: "polis-preprod" | ||
heroku_email: ${{secrets.HEROKU_EMAIL}} | ||
branch: "edge" | ||
|
||
- name: Deploy to Heroku | ||
run: | | ||
git push https://heroku:${{secrets.HEROKU_API_KEY}}@git.heroku.com/polis-preprod.git edge:main | ||
deploy-static: | ||
runs-on: ubuntu-latest | ||
needs: deploy-backend | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | ||
aws-region: us-east-1 | ||
|
||
- name: Build static assets | ||
env: | ||
EMBED_SERVICE_HOSTNAME: preprod.pol.is | ||
ENABLE_TWITTER_WIDGETS: true | ||
GA_TRACKING_ID: G-WVP78N35QR | ||
SERVICE_URL: https://preprod.pol.is | ||
run: | | ||
docker compose create --build --force-recreate file-server | ||
docker cp file-server:/app/build/build ./build | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
cache: 'pip' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install -r deploy/requirements.txt | ||
- name: Deploy to S3 | ||
run: | | ||
python deploy/deploy-static-assets.py --bucket edge.static-assets.pol.is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Python | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
.Python | ||
env/ | ||
.env | ||
venv/ | ||
.venv | ||
.pytest_cache/ | ||
.mypy_cache/ | ||
|
||
# IDE | ||
.vscode/ | ||
.idea/ | ||
|
||
# OS | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Polis Deploy | ||
|
||
Tools for deploying Polis static assets to S3. | ||
|
||
## Prerequisites | ||
|
||
- python 3.8+ | ||
- aws cli | ||
- heroku cli | ||
|
||
### Push the backend code to Heroku | ||
|
||
```bash | ||
heroku login | ||
git push <heroku-remote> edge:main | ||
``` | ||
|
||
_Replace `<heroku-remote>` with the appropriate heroku remote, e.g. heroku-preprod_ | ||
|
||
### Build the Polis static assets | ||
|
||
from the root of the project: | ||
|
||
```bash | ||
make ENV_FILE=<env-file> PROD build-web-assets | ||
``` | ||
|
||
### AWS CLI | ||
|
||
Log into AWS SSO and configure your AWS CLI with the appropriate profile. | ||
|
||
#### First time setup (or to refresh credentials) | ||
|
||
```bash | ||
aws configure sso | ||
``` | ||
|
||
follow the prompts to configure your profile. | ||
e.g. | ||
|
||
> SSO session name: polis-deploy | ||
> | ||
> SSO start URL: [aws-start-url] | ||
> | ||
> SSO region: us-east-1 | ||
> | ||
> SSO registration scopes: [enter for default] | ||
> | ||
> CLI default client Region: us-east-1 | ||
> | ||
> CLI default output format: json | ||
> | ||
> CLI profile name: polis-deploy | ||
#### Login with the above profile | ||
|
||
```bash | ||
export AWS_PROFILE=polis-deploy | ||
|
||
aws sso login | ||
|
||
# Verify that you are logged in | ||
aws sts get-caller-identity | ||
``` | ||
|
||
## Python Setup | ||
|
||
```bash | ||
python -m venv .venv | ||
source .venv/bin/activate | ||
pip install -r requirements.txt | ||
pip install -r dev-requirements.txt | ||
``` | ||
|
||
## Usage | ||
|
||
```bash | ||
python deploy-static-assets.py --bucket <bucket-name> | ||
``` | ||
|
||
_Replace `<bucket-name>` with the appropriate bucket name, e.g. edge.static-assets.pol.is_ | ||
|
||
Or from the root of the project: | ||
|
||
```bash | ||
python deploy/deploy-static-assets.py --bucket <bucket-name> | ||
``` |
Oops, something went wrong.