Skip to content

Commit

Permalink
cd: ssl cert
Browse files Browse the repository at this point in the history
  • Loading branch information
tyknkd committed May 21, 2024
1 parent 8576a99 commit 8b6b8b6
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 83 deletions.
166 changes: 83 additions & 83 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
name: ci-cd
on: push
jobs:
test:
environment: development
runs-on: ubuntu-22.04
container: tyknkd/spark:3.3.2-scala2.13-jdk17-gradle8.7-jammy
env:
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
OS_ENV: container
PGPASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: collector_db
POSTGRES_HOST: db
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_USER: postgresuser
RABBITMQ_DEFAULT_PASS: ${{ secrets.RABBITMQ_DEFAULT_PASS }}
RABBITMQ_DEFAULT_USER: rabbituser
services:
db:
image: postgres:16.2
env:
POSTGRES_DB: ${{ env.POSTGRES_DB }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_USER: ${{ env.POSTGRES_USER }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
mq:
image: rabbitmq:3.13-management
env:
RABBITMQ_DEFAULT_PASS: ${{ secrets.RABBITMQ_DEFAULT_PASS }}
RABBITMQ_DEFAULT_USER: ${{ env.RABBITMQ_DEFAULT_USER }}
ports:
- 5672:5672
- 15692:15692
options: >-
--health-cmd "rabbitmq-diagnostics check_port_connectivity"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install PostgreSQL client
run: |
apt update
apt install -y postgresql-client
- name: Check out repository
uses: actions/checkout@v4

- name: Initialize databases
shell: bash
run: |
source .env
chmod +x ./docker-databases/docker-entrypoint-initdb.d/init-additional-db.sh
./docker-databases/docker-entrypoint-initdb.d/init-additional-db.sh
- name: Run tests
shell: bash
run: |
source .env
gradle test
publish:
needs: test
if: github.ref == 'refs/heads/main'
environment: production
runs-on: ubuntu-22.04
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Check out repository
uses: actions/checkout@v4

- name: Build and push Docker images
shell: bash
run: docker compose build --push data-collector data-analyzer web-server
# test:
# environment: development
# runs-on: ubuntu-22.04
# container: tyknkd/spark:3.3.2-scala2.13-jdk17-gradle8.7-jammy
# env:
# NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
# OS_ENV: container
# PGPASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
# POSTGRES_DB: collector_db
# POSTGRES_HOST: db
# POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
# POSTGRES_USER: postgresuser
# RABBITMQ_DEFAULT_PASS: ${{ secrets.RABBITMQ_DEFAULT_PASS }}
# RABBITMQ_DEFAULT_USER: rabbituser
# services:
# db:
# image: postgres:16.2
# env:
# POSTGRES_DB: ${{ env.POSTGRES_DB }}
# POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
# POSTGRES_USER: ${{ env.POSTGRES_USER }}
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# - 5432:5432
# mq:
# image: rabbitmq:3.13-management
# env:
# RABBITMQ_DEFAULT_PASS: ${{ secrets.RABBITMQ_DEFAULT_PASS }}
# RABBITMQ_DEFAULT_USER: ${{ env.RABBITMQ_DEFAULT_USER }}
# ports:
# - 5672:5672
# - 15692:15692
# options: >-
# --health-cmd "rabbitmq-diagnostics check_port_connectivity"
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# steps:
# - name: Install PostgreSQL client
# run: |
# apt update
# apt install -y postgresql-client
#
# - name: Check out repository
# uses: actions/checkout@v4
#
# - name: Initialize databases
# shell: bash
# run: |
# source .env
# chmod +x ./docker-databases/docker-entrypoint-initdb.d/init-additional-db.sh
# ./docker-databases/docker-entrypoint-initdb.d/init-additional-db.sh
#
# - name: Run tests
# shell: bash
# run: |
# source .env
# gradle test
#
# publish:
# needs: test
# if: github.ref == 'refs/heads/main'
# environment: production
# runs-on: ubuntu-22.04
# steps:
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_TOKEN }}
#
# - name: Check out repository
# uses: actions/checkout@v4
#
# - name: Build and push Docker images
# shell: bash
# run: docker compose build --push data-collector data-analyzer web-server

deploy:
needs: publish
if: github.ref == 'refs/heads/main'
# needs: publish
# if: github.ref == 'refs/heads/main'
environment: production
runs-on: ubuntu-22.04
steps:
Expand Down
2 changes: 2 additions & 0 deletions deployment/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ metadata:
name: newsanalyzer-ingress
annotations:
kubernetes.io/ingress.global-static-ip-name: newsanalyzer-ip
networking.gke.io/managed-certificates: managed-cert
kubernetes.io/ingress.class: gce
spec:
defaultBackend:
service:
Expand Down
8 changes: 8 additions & 0 deletions deployment/templates/managed-certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
name: managed-certificate
spec:
domains:
- jeitikei.online
- www.jeitikei.online

0 comments on commit 8b6b8b6

Please sign in to comment.