-
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.
Merge pull request #1 from Smoothex/main
Project maintenance
- Loading branch information
Showing
39 changed files
with
417 additions
and
26 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,5 @@ | ||
## What this PR does | ||
* | ||
|
||
## Related Issues | ||
* |
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,34 @@ | ||
name: Build and push image to AWS ECR | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
|
||
jobs: | ||
build-and-push: | ||
name: Build and Push to ECR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Login to AWS ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v2 | ||
|
||
- name: Build, tag and push image to AWS ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY: test | ||
IMAGE_TAG: testtag | ||
run: | | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |
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,106 @@ | ||
name: Unit and integration tests | ||
|
||
on: | ||
push: | ||
branches: [ "*" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
unit-tests: | ||
env: | ||
POSTGRES_HOST: localhost | ||
POSTGRES_PORT: 5432 | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
POSTGRES_DB: routing | ||
PYTHONFAULTHANDLER: 1 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
|
||
- name: Checkout LFS objects (map files) | ||
run: git lfs checkout | ||
|
||
- name: Set up Python 3.9.16 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.9.16 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ./routing | ||
pip install -r requirements.txt | ||
- name: Run unit tests | ||
run: | | ||
cd routing | ||
python -m unittest -v | ||
integration-tests: | ||
needs: [unit-tests] | ||
env: | ||
POSTGRES_HOST: localhost | ||
POSTGRES_PORT: 5432 | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
POSTGRES_DB: routing | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgis/postgis:13-master | ||
env: | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
POSTGRES_DB: routing | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
rabbitmq: | ||
image: rabbitmq:3.9-alpine | ||
env: | ||
RABBITMQ_USERNAME: ${{ secrets.RABBITMQ_USERNAME }} | ||
RABBITMQ_PASSWORD: ${{ secrets.RABBITMQ_PASSWORD }} | ||
RABBITMQ_HOST: localhost | ||
RABBITMQ_VHOST: / | ||
ports: | ||
- 5672:5672 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
|
||
- name: Checkout LFS objects (map files) | ||
run: git lfs checkout | ||
|
||
- name: Set up Python 3.9.16 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.9.16 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -e ./routing | ||
pip install -r requirements.txt | ||
- name: Run migration | ||
run: | | ||
cd Routing_Api | ||
python manage.py migrate | ||
python manage.py migrate Mobis | ||
- name: Run integration tests | ||
run: | | ||
cd Routing_Api | ||
python manage.py test -v 2 --keepdb --noinput | ||
env: | ||
SECRET_KEY: ${{ secrets.DJANGO_SECRET_KEY }} | ||
REST_THROTTLINGRATE_ANON: 300 | ||
REST_THROTTLINGRATE_USER: 100 |
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,19 @@ | ||
FROM python:3.9.16 | ||
|
||
WORKDIR /routing | ||
COPY routing ./ | ||
RUN python -m compileall . | ||
RUN pip install --no-cache-dir . | ||
|
||
WORKDIR /www | ||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
WORKDIR /www | ||
COPY Routing_Api ./ | ||
RUN python -m compileall . | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV IS_CELERY_APP yes | ||
|
||
ENTRYPOINT ["celery", "-A", "Routing_Api", "beat", "-l", "INFO"] |
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,19 @@ | ||
FROM python:3.9.7 | ||
|
||
WORKDIR /routing | ||
COPY routing ./ | ||
RUN python -m compileall . | ||
RUN pip install --no-cache-dir . | ||
|
||
WORKDIR /www | ||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
WORKDIR /www | ||
COPY Routing_Api ./ | ||
RUN python -m compileall . | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
ENV IS_CELERY_APP yes | ||
|
||
ENTRYPOINT ["celery", "-A", "Routing_Api", "worker", "-l", "INFO"] |
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,22 @@ | ||
FROM python:3.9.16 | ||
|
||
WORKDIR /routing | ||
COPY routing ./ | ||
RUN python -m compileall . | ||
RUN pip install --no-cache-dir . | ||
|
||
WORKDIR /www | ||
COPY requirements.txt . | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
WORKDIR /maps | ||
COPY maps . | ||
|
||
WORKDIR /www | ||
COPY Routing_Api ./ | ||
RUN python -m compileall . | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# default timeout of 30 sec may be too low | ||
ENTRYPOINT ["gunicorn", "Routing_Api.wsgi", "--bind", "0.0.0.0:8080", "-k", "gevent", "--timeout", "180"] |
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
Oops, something went wrong.