-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start creation of infra and github actions
- Loading branch information
Showing
17 changed files
with
187 additions
and
7 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
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,85 @@ | ||
name: CI/CD | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
env: | ||
PROJECT_NAME: sfscon-backend | ||
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/sfscon-backend | ||
|
||
jobs: | ||
deploy-test: | ||
runs-on: ubuntu-22.04 | ||
if: github.ref == 'refs/heads/main' | ||
concurrency: deploy-test | ||
env: | ||
SERVER_PORT: 1005 | ||
DOCKER_TAG: ${{ github.sha }}-test | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create .env file | ||
uses: noi-techpark/github-actions/env-file@v2 | ||
with: | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
env: | ||
X_SERVER_PORT: ${{ env.SERVER_PORT }} | ||
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} | ||
X_DOCKER_TAG: ${{ env.DOCKER_TAG }} | ||
|
||
- name: Build and push images | ||
uses: noi-techpark/github-actions/docker-build-and-push@v2 | ||
with: | ||
working-directory: infrastructure | ||
docker-username: ${{ github.actor }} | ||
docker-password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Deploy application | ||
uses: noi-techpark/github-actions/docker-deploy@v2 | ||
with: | ||
working-directory: infrastructure/ansible | ||
hosts: "test" | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
docker-username: "noi-techpark-bot" | ||
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
project-name: ${{ env.PROJECT_NAME }} | ||
|
||
deploy-prod: | ||
runs-on: ubuntu-22.04 | ||
if: github.ref == 'refs/heads/prod' | ||
# needs: test | ||
concurrency: deploy-prod | ||
env: | ||
SERVER_PORT: 1006 | ||
DOCKER_TAG: ${{ github.sha }} | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create .env file | ||
uses: noi-techpark/github-actions/env-file@v2 | ||
with: | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
env: | ||
X_SERVER_PORT: ${{ env.SERVER_PORT }} | ||
X_DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} | ||
X_DOCKER_TAG: ${{ env.DOCKER_TAG }} | ||
|
||
- name: Build and push images | ||
uses: noi-techpark/github-actions/docker-build-and-push@v2 | ||
with: | ||
working-directory: infrastructure | ||
docker-username: ${{ github.actor }} | ||
docker-password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Deploy application | ||
uses: noi-techpark/github-actions/docker-deploy@v2 | ||
with: | ||
working-directory: infrastructure/ansible | ||
hosts: "test" | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
docker-username: "noi-techpark-bot" | ||
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
project-name: ${{ env.PROJECT_NAME }} |
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,12 @@ | ||
name: REUSE Compliance Check | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v2 | ||
- name: REUSE Compliance Check | ||
uses: fsfe/reuse-action@v3 |
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,4 @@ | ||
[defaults] | ||
inventory = ./hosts | ||
roles_path = ./roles | ||
retry_files_enabled = False |
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 @@ | ||
--- | ||
- hosts: all | ||
vars: | ||
ansible_python_interpreter: /usr/bin/python3 | ||
tasks: | ||
- name: Login to GitHub Container Registry | ||
ansible.builtin.shell: | ||
cmd: echo "{{ docker_password }}" | docker login "{{ docker_host }}" --username "{{ docker_username }}" --password-stdin | ||
- name: Execute Docker deployment | ||
ansible.builtin.include_role: | ||
name: ansible-docker-deployment | ||
vars: | ||
docker_deployment_project_name: '{{ project_name }}' | ||
docker_deployment_release_name: '{{ release_name }}' | ||
docker_deployment_release_files: | ||
- local: ../docker-compose.run.yml | ||
remote: docker-compose.yml | ||
- local: ../../.env | ||
remote: .env |
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 @@ | ||
[test] | ||
docker03.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no' | ||
|
||
[prod] | ||
docker03.opendatahub.com ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no' |
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,2 @@ | ||
- src: git+https://github.com/noi-techpark/ansible-docker-deployment.git | ||
version: "2.0" |
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,2 @@ | ||
* | ||
!.gitignore |
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,8 @@ | ||
version: "3.4" | ||
|
||
services: | ||
app: | ||
image: ${DOCKER_IMAGE}:${DOCKER_TAG} | ||
build: | ||
context: ../ | ||
dockerfile: infrastructure/docker/dockerfile-static-nginx |
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,8 @@ | ||
version: "3.4" | ||
|
||
services: | ||
app: | ||
image: ${DOCKER_IMAGE}:${DOCKER_TAG} | ||
restart: unless-stopped | ||
ports: | ||
- ${SERVER_PORT}:80 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,4 @@ | ||
FROM nginx:1.23.4-alpine-slim | ||
|
||
COPY ./databrowser/dist /usr/share/nginx/html | ||
COPY ./infrastructure/nginx/default.conf /etc/nginx/conf.d/default.conf |
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,32 @@ | ||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
|
||
include mime.types; | ||
types { | ||
font/ttf ttf; | ||
} | ||
|
||
access_log off; | ||
|
||
gzip on; | ||
gzip_types text/html application/javascript application/json text/css font/ttf application/x-font-ttf; | ||
|
||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
|
||
location / { | ||
try_files $uri $uri/ $uri.html /index.html; | ||
} | ||
|
||
location ~* \.(?:css|js|jpg|svg|ttf)$ { | ||
expires 30d; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
location ~* \.(?:json)$ { | ||
expires 1d; | ||
add_header Cache-Control "public"; | ||
} | ||
} |