Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done update CICD #14

Merged
merged 7 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ansible/deploy_applications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
- ansible_host_key_checking: false
- ansible_stdout_callback: yaml

- api_image_image: vectornguyen76/flask_template_image
- api_image_tag: latest
- flask_template_image: vectornguyen76/flask_template_image
- flask_template_tag: latest

pre_tasks:
- name: "wait 600 seconds for target connection to become reachable/usable."
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ansible/roles/deploy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
src: "/home/ubuntu/server/artifact.zip"
dest: "/home/ubuntu/server"

- name: Pull api image
- name: Pull flask template image
community.docker.docker_image:
name: "{{ api_image }}"
tag: "{{ api_tag }}"
name: "{{ flask_template_image }}"
tag: "{{ flask_template_tag }}"
source: pull

- name: Run docker compose
Expand Down
40 changes: 10 additions & 30 deletions .github/workflows/development_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,21 @@ jobs:
DATABASE_TEST_URL: postgresql://db_user:db_password@localhost/db_test
run: python -m flask tests

deploy-service:
needs: build-test
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
id: docker_hub_auth
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build Docker Image
id: build_docker
run: |
docker compose build api_service

# Add tag
docker tag api_image:latest ${{ secrets.DOCKERHUB_USERNAME }}/api_image:latest

- name: Push Docker Image
id: push_images
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/api_image:latest

- name: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@v1
- name: Build and push
uses: docker/build-push-action@v4
with:
name: MyStackEC2
template: myStack.yaml
parameter-overrides: "MyParam1=myValue,MyParam2=${{ secrets.MY_SECRET_VALUE }}"
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/flask_template_image:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
branches:
- master

push:
branches:
- master
jobs:
build-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -47,6 +44,25 @@ jobs:
DATABASE_TEST_URL: postgresql://db_user:db_password@localhost/db_test
run: python -m flask tests

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
id: docker_hub_auth
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/flask_template_image:latest
cache-from: type=gha
cache-to: type=gha,mode=max

create-config-infrastructure:
runs-on: ubuntu-latest
needs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
branches:
- staging

push:
branches:
- staging
jobs:
build-test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -47,6 +44,25 @@ jobs:
DATABASE_TEST_URL: postgresql://db_user:db_password@localhost/db_test
run: python -m flask tests

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
id: docker_hub_auth
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/flask_template_image:latest
cache-from: type=gha
cache-to: type=gha,mode=max

create-config-infrastructure:
runs-on: ubuntu-latest
needs:
Expand Down
3 changes: 2 additions & 1 deletion instructions/anaconda-miniconda.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
```

### Install Miniconda - use the following commands consecutively

- Download miniconda
```shell
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Expand All @@ -41,7 +42,7 @@
```shell
sha256sum Miniconda3-latest-Linux-x86_64.sh
```
- The output will notify if any errors occurred. If there are no errors, move on to the actual installation step. To continue, run the Anaconda bash shell script:
- The output will notify if any errors occurred. If there are no errors, move on to the actual installation step. To continue, run the Anaconda bash shell script:
```shell
bash Miniconda3-latest-Linux-x86_64.sh
```
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ alembic==1.10.2
apispec==6.3.0
asttokens==2.2.1
backcall==0.2.0
black==23.9.1
blinker==1.5
certifi==2023.5.7
click==8.1.3
Expand All @@ -14,6 +15,7 @@ distlib==0.3.6
entrypoints==0.4
executing==1.2.0
filelock==3.12.2
flake8==6.1.0
Flask==2.2.5
Flask-Cors==3.0.10
Flask-JWT-Extended==4.4.4
Expand All @@ -27,6 +29,7 @@ gunicorn==20.1.0
importlib-metadata==6.7.0
ipykernel==6.19.2
ipython==8.10.0
isort==5.12.0
itsdangerous==2.1.2
jedi==0.18.2
Jinja2==3.1.2
Expand Down
Loading