-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
448 additions
and
561 deletions.
There are no files selected for viewing
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,41 @@ | ||
{ | ||
"family": "atlas-task-definition", | ||
"containerDefinitions": [ | ||
{ | ||
"name": "atlas", | ||
"image": "533266983284.dkr.ecr.us-east-1.amazonaws.com/atlas", | ||
"cpu": 0, | ||
"portMappings": [ | ||
{ | ||
"name": "atlas-container-port", | ||
"containerPort": 8000, | ||
"hostPort": 8000, | ||
"protocol": "tcp", | ||
"appProtocol": "http" | ||
} | ||
], | ||
"essential": true, | ||
"environment": [], | ||
"environmentFiles": [], | ||
"mountPoints": [], | ||
"volumesFrom": [], | ||
"ulimits": [], | ||
"systemControls": [] | ||
} | ||
], | ||
"executionRoleArn": "arn:aws:iam::533266983284:role/ecsTaskExecutionRole", | ||
"networkMode": "awsvpc", | ||
"requiresCompatibilities": ["FARGATE"], | ||
"cpu": "1024", | ||
"memory": "3072", | ||
"runtimePlatform": { | ||
"cpuArchitecture": "X86_64", | ||
"operatingSystemFamily": "LINUX" | ||
}, | ||
"tags": [ | ||
{ | ||
"key": "project", | ||
"value": "atlas" | ||
} | ||
] | ||
} |
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,168 @@ | ||
# config files | ||
.github/ | ||
.husky/ | ||
.jest/ | ||
.vscode/ | ||
.editorconfig | ||
.eslintrc | ||
.git | ||
.gitignore | ||
.prettierignore | ||
.prettierrc | ||
.releaserc | ||
Dockerfile | ||
docker-compose.yml | ||
Jenkinsfile | ||
jest.config.js | ||
|
||
# documentation | ||
LICENSE | ||
CHANGELOG.md | ||
README.md | ||
|
||
# build files | ||
node_modules | ||
**/node_modules | ||
|
||
.git | ||
Dockerfile | ||
.DS_Store | ||
.gitignore | ||
.dockerignore | ||
|
||
/credentials | ||
/cache | ||
/store | ||
|
||
/node_modules | ||
|
||
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore | ||
|
||
# General | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
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,67 @@ | ||
name: Deploy to Amazon ECS | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
env: | ||
AWS_REGION: us-east-1 # AWS region, e.g. us-west-1 | ||
ECR_REPOSITORY: atlas # Amazon ECR repository name | ||
ECS_SERVICE: atlas-service # Amazon ECS service name | ||
ECS_CLUSTER: atlas-cluster # Amazon ECS cluster name | ||
ECS_TASK_DEFINITION: .aws/task-definition.json # Amazon ECS task definition | ||
CONTAINER_NAME: atlas | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_PROD_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_PROD_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg GITHUB_HASH=${GITHUB_SHA::7} --build-arg GITHUB_BRANCH=${GITHUB_REF_NAME} . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
- name: Fill in the new image ID in the Amazon ECS task definition | ||
id: task-def | ||
uses: aws-actions/amazon-ecs-render-task-definition@v1 | ||
with: | ||
task-definition: ${{ env.ECS_TASK_DEFINITION }} | ||
container-name: ${{ env.CONTAINER_NAME }} | ||
image: ${{ steps.build-image.outputs.image }} | ||
|
||
- name: Deploy Amazon ECS task definition | ||
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | ||
with: | ||
task-definition: ${{ steps.task-def.outputs.task-definition }} | ||
service: ${{ env.ECS_SERVICE }} | ||
cluster: ${{ env.ECS_CLUSTER }} | ||
wait-for-service-stability: true |
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,24 @@ | ||
# Build step #1: build the React front end | ||
FROM node:18-alpine as build-step | ||
WORKDIR /app | ||
ENV PATH /app/node_modules/.bin:$PATH | ||
COPY client/package*.json ./ | ||
RUN npm ci | ||
COPY client/ ./ | ||
RUN npm run build | ||
|
||
# Build step #2: build the API with the client as static files | ||
FROM python:3.9 | ||
WORKDIR /app | ||
COPY --from=build-step /app/dist ./build | ||
|
||
RUN mkdir ./api | ||
COPY server ./api | ||
RUN pip install -r ./api/requirements.txt | ||
RUN pip install gunicorn | ||
ENV FLASK_ENV production | ||
|
||
|
||
EXPOSE 8000 | ||
WORKDIR /app/api | ||
CMD ["gunicorn", "-b", ":8000", "api:app"] |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.