-
Notifications
You must be signed in to change notification settings - Fork 0
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
Lucas Belo
authored and
Lucas Belo
committed
Oct 7, 2024
1 parent
0557248
commit 48a659d
Showing
8 changed files
with
124 additions
and
3 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 |
---|---|---|
|
@@ -5,6 +5,13 @@ on: | |
- 'services/tasks_api/**' | ||
- '.github/workflows/api.yml' | ||
|
||
|
||
env: # new | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: eu-west-1 | ||
APP_ENVIRONMENT: development | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
|
@@ -63,4 +70,37 @@ jobs: | |
- name: Run flake8 | ||
run: poetry run flake8 . | ||
- name: Run bandit | ||
run: poetry run bandit . | ||
run: poetry run bandit . | ||
deploy-development: # new | ||
needs: [ test, code-quality ] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: [3.11] | ||
poetry-version: [1.3.2] | ||
node-version: [16] | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: services/tasks_api | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install poetry | ||
uses: abatilo/[email protected] | ||
with: | ||
poetry-version: ${{ matrix.poetry-version }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install Serverless Framework | ||
run: npm install -g serverless | ||
- name: Install NPM dependencies | ||
run: npm install | ||
- name: Deploy | ||
run: sls deploy --stage development --verbose |
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 |
---|---|---|
@@ -1 +1,9 @@ | ||
# was_tasks | ||
# was_tasks | ||
|
||
## Infrastructure | ||
|
||
The easiest way to manage servers, subnets, load balancers, managed databases, etc. is by using infrastructure-as-code (IaC). Inside the "infrastructure" folder we'll store configuration files for our tool(s) of choice. These are usually long YAML, JSON, or HCL files. | ||
|
||
## Services | ||
|
||
Anything that is long-running or talks to our end users is considered a service. It can be monolithic Django application, Vue UI, or a couple of microservice APIs -- all will reside in this folder. |
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 @@ | ||
ALLOWED_ORIGINS=* |
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,15 @@ | ||
{ | ||
"name": "tasks-api", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"serverless-python-requirements": "^5.1.1" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,38 @@ | ||
service: tasks-api | ||
|
||
frameworkVersion: '3' | ||
useDotenv: true | ||
|
||
|
||
provider: | ||
name: aws | ||
runtime: python3.11 | ||
region: ${opt:region, 'eu-west-1'} | ||
stage: ${opt:stage, 'development'} | ||
logRetentionInDays: 30 | ||
environment: | ||
APP_ENVIRONMENT: ${self:provider.stage} | ||
|
||
functions: | ||
API: | ||
handler: main.handle | ||
timeout: 10 | ||
memorySize: 512 | ||
events: | ||
- http: | ||
path: /{proxy+} | ||
method: any | ||
cors: | ||
origin: ${env:ALLOWED_ORIGINS} | ||
maxAge: 60 | ||
|
||
|
||
custom: | ||
pythonRequirements: | ||
usePoetry: true | ||
noDeploy: | ||
- boto3 # already on Lambda | ||
- botocore # already on Lambda | ||
|
||
plugins: | ||
- serverless-python-requirements |