Skip to content

Commit

Permalink
Merge branch 'simple-deploy'
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Mar 12, 2024
2 parents a8a5cdb + 0fce413 commit 329177c
Showing 1 changed file with 131 additions and 112 deletions.
243 changes: 131 additions & 112 deletions .github/workflows/execute.yml → .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: CI/CD
name: CI/CD nightly build

on:
on:
push:
workflow_dispatch:
schedule:
# every night at 3am
- cron: '0 3 * * *'

env:
PROJECT_NAME: "odh-mentor-otp"
Expand All @@ -21,9 +24,25 @@ env:
DOCKER_TAG: ${{ github.sha }}

jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1

- name: Build graph
run: sh build-graph.sh

- name: Build docker file
uses: noi-techpark/github-actions/docker-build@v2
with:
docker-compose-file: docker-compose.build.execute.yml

execute-test:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-22.04
needs: test
concurrency: deploy-test
env:
API_HOST: "https://otp.opendatahub.testingmachine.eu"
Expand Down Expand Up @@ -136,113 +155,113 @@ jobs:
project-name: ${{ env.PROJECT_NAME }}
playbook-file: deploy.execute.yml

execute-prod:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/prod'
concurrency: deploy-prod
env:
API_HOST: "https://otp.opendatahub.com"
API_PORT: "443"
API_PATH: "/otp/routers/openmove"
GEOCODER_BASEURL: "https://geocoder.otp.opendatahub.com"
PARKING_BASEURL: "https://parking.otp.opendatahub.com"
DRT_BASEURL: "https://drt.otp.opendatahub.com"
CHARGER_BASEURL: "https://charger.otp.opendatahub.com"
CARSHARING_BASEURL: "https://carsharing.otp.opendatahub.com"
TRAFFIC_BASEURL: "https://traffic.otp.opendatahub.com"
MATOMO_BASE_URL: "https://digital.matomo.cloud/"
MATOMO_SITE_ID: 20

steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Create .env file
uses: noi-techpark/github-actions/env-file@v2
env:
X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
X_DOCKER_IMAGE_OTP: ${{ env.DOCKER_IMAGE_OTP }}
X_DOCKER_IMAGE_JOURNEY: ${{ env.DOCKER_IMAGE_JOURNEY }}
X_DOCKER_IMAGE_GBFS: ${{ env.DOCKER_IMAGE_GBFS }}
X_DOCKER_IMAGE_GEOCODER: ${{ env.DOCKER_IMAGE_GEOCODER }}
X_DOCKER_IMAGE_CARSHARING: ${{ env.DOCKER_IMAGE_CARSHARING }}
X_DOCKER_IMAGE_PARKING: ${{ env.DOCKER_IMAGE_PARKING }}
X_DOCKER_IMAGE_ECHARGING: ${{ env.DOCKER_IMAGE_ECHARGING }}
X_DOCKER_IMAGE_DRT: ${{ env.DOCKER_IMAGE_DRT }}
X_DOCKER_IMAGE_TRAFFIC: ${{ env.DOCKER_IMAGE_TRAFFIC }}
X_DOCKER_TAG: ${{ env.DOCKER_TAG }}
# execute-prod:
# runs-on: ubuntu-22.04
# needs: test
# concurrency: deploy-prod
# env:
# API_HOST: "https://otp.opendatahub.com"
# API_PORT: "443"
# API_PATH: "/otp/routers/openmove"
# GEOCODER_BASEURL: "https://geocoder.otp.opendatahub.com"
# PARKING_BASEURL: "https://parking.otp.opendatahub.com"
# DRT_BASEURL: "https://drt.otp.opendatahub.com"
# CHARGER_BASEURL: "https://charger.otp.opendatahub.com"
# CARSHARING_BASEURL: "https://carsharing.otp.opendatahub.com"
# TRAFFIC_BASEURL: "https://traffic.otp.opendatahub.com"
# MATOMO_BASE_URL: "https://digital.matomo.cloud/"
# MATOMO_SITE_ID: 20

# steps:
# - name: Checkout source code
# uses: actions/checkout@v2

# - name: Create .env file
# uses: noi-techpark/github-actions/env-file@v2
# env:
# X_COMPOSE_PROJECT_NAME: ${{ env.PROJECT_NAME }}
# X_DOCKER_IMAGE_OTP: ${{ env.DOCKER_IMAGE_OTP }}
# X_DOCKER_IMAGE_JOURNEY: ${{ env.DOCKER_IMAGE_JOURNEY }}
# X_DOCKER_IMAGE_GBFS: ${{ env.DOCKER_IMAGE_GBFS }}
# X_DOCKER_IMAGE_GEOCODER: ${{ env.DOCKER_IMAGE_GEOCODER }}
# X_DOCKER_IMAGE_CARSHARING: ${{ env.DOCKER_IMAGE_CARSHARING }}
# X_DOCKER_IMAGE_PARKING: ${{ env.DOCKER_IMAGE_PARKING }}
# X_DOCKER_IMAGE_ECHARGING: ${{ env.DOCKER_IMAGE_ECHARGING }}
# X_DOCKER_IMAGE_DRT: ${{ env.DOCKER_IMAGE_DRT }}
# X_DOCKER_IMAGE_TRAFFIC: ${{ env.DOCKER_IMAGE_TRAFFIC }}
# X_DOCKER_TAG: ${{ env.DOCKER_TAG }}

X_EFS_FOLDER: "/opt/odh-mentor-otp-prod/"

X_SERVER_PORT_OTP: 1080
X_SERVER_PORT_JOURNEY: 1081
X_GBFS_HOST : "https://gbfs.otp.opendatahub.com/"
X_DOCKER_GBFS_PORT: 1082
X_DOCKER_GEOCODER_PORT: 1083
X_DOCKER_CARSHARING_PORT: 1084
X_DOCKER_PARKING_PORT: 1085
X_DOCKER_DRT_PORT: 1086
X_DOCKER_ECHARGING_PORT: 1087
X_DOCKER_TRAFFIC_PORT: 1088

X_JAVA_MX: "16G"
X_BUILD_GRAPH: "False"
X_DOWNLOAD_DATA: "False"
X_BACKUP_GRAPH: "False"

X_OTP_RR_BRANCH: "mentor-meran"
X_OTP_UI_BRANCH: "master"

X_API_HOST: ${{ env.API_HOST }}
X_API_PORT: ${{ env.API_PORT }}
X_API_PATH: ${{ env.API_PATH }}

X_HERE_APPID: ${{ secrets.HERE_APPID_TEST }}
X_HERE_APPCODE: ${{ secrets.HERE_APPCODE_TEST }}
X_HERE_APIKEY: ${{ secrets.HERE_APIKEY_TEST }}

X_GEOCODER_BASEURL: ${{ env.GEOCODER_BASEURL }}
X_PARKING_BASEURL: ${{ env.PARKING_BASEURL }}
X_DRT_BASEURL: ${{ env.DRT_BASEURL }}
X_CHARGER_BASEURL: ${{ env.CHARGER_BASEURL }}
X_CARSHARING_BASEURL: ${{ env.CARSHARING_BASEURL }}
X_TRAFFIC_BASEURL: ${{ env.TRAFFIC_BASEURL }}

X_OTP_OFFICIAL: "False"
X_GBFS_VERSION: 1
X_CARSHARING_HOST: "https://carsharing.otp.opendatahub.com/"
X_PARKING_HOST: "https://parking.otp.opendatahub.com/"
X_DRT_HOST: "https://drt.otp.opendatahub.com/"
X_CHARGER_HOST: "https://charger.otp.opendatahub.com/"

X_GTFS_URL: "ftp://ftp.sta.bz.it/gtfs/google_transit_shp.zip"
X_GTFS_URL_UPDATETIME: "0 4 * * *"
X_GTFS_WORKFLOW_AUTH_TOKEN: ${{ secrets.GH_WORKFLOW_ACCESS_TOKEN }}
X_GTFS_WORKFLOW_DISPATCH_URL: "https://api.github.com/repos/noi-techpark/odh-mentor-otp/actions/workflows/run_calculate.yml/dispatches"
X_GTFS_WORKFLOW_BRANCH: ${{ github.ref }}

X_GTFS_RT_URL: "https://efa.sta.bz.it/gtfs-r/"
X_GTFS_FEED_ID: 1
# X_EFS_FOLDER: "/opt/odh-mentor-otp-prod/"

# X_SERVER_PORT_OTP: 1080
# X_SERVER_PORT_JOURNEY: 1081
# X_GBFS_HOST : "https://gbfs.otp.opendatahub.com/"
# X_DOCKER_GBFS_PORT: 1082
# X_DOCKER_GEOCODER_PORT: 1083
# X_DOCKER_CARSHARING_PORT: 1084
# X_DOCKER_PARKING_PORT: 1085
# X_DOCKER_DRT_PORT: 1086
# X_DOCKER_ECHARGING_PORT: 1087
# X_DOCKER_TRAFFIC_PORT: 1088

# X_JAVA_MX: "16G"
# X_BUILD_GRAPH: "False"
# X_DOWNLOAD_DATA: "False"
# X_BACKUP_GRAPH: "False"

# X_OTP_RR_BRANCH: "mentor-meran"
# X_OTP_UI_BRANCH: "master"

# X_API_HOST: ${{ env.API_HOST }}
# X_API_PORT: ${{ env.API_PORT }}
# X_API_PATH: ${{ env.API_PATH }}

# X_HERE_APPID: ${{ secrets.HERE_APPID_TEST }}
# X_HERE_APPCODE: ${{ secrets.HERE_APPCODE_TEST }}
# X_HERE_APIKEY: ${{ secrets.HERE_APIKEY_TEST }}

# X_GEOCODER_BASEURL: ${{ env.GEOCODER_BASEURL }}
# X_PARKING_BASEURL: ${{ env.PARKING_BASEURL }}
# X_DRT_BASEURL: ${{ env.DRT_BASEURL }}
# X_CHARGER_BASEURL: ${{ env.CHARGER_BASEURL }}
# X_CARSHARING_BASEURL: ${{ env.CARSHARING_BASEURL }}
# X_TRAFFIC_BASEURL: ${{ env.TRAFFIC_BASEURL }}

# X_OTP_OFFICIAL: "False"
# X_GBFS_VERSION: 1
# X_CARSHARING_HOST: "https://carsharing.otp.opendatahub.com/"
# X_PARKING_HOST: "https://parking.otp.opendatahub.com/"
# X_DRT_HOST: "https://drt.otp.opendatahub.com/"
# X_CHARGER_HOST: "https://charger.otp.opendatahub.com/"

# X_GTFS_URL: "ftp://ftp.sta.bz.it/gtfs/google_transit_shp.zip"
# X_GTFS_URL_UPDATETIME: "0 4 * * *"
# X_GTFS_WORKFLOW_AUTH_TOKEN: ${{ secrets.GH_WORKFLOW_ACCESS_TOKEN }}
# X_GTFS_WORKFLOW_DISPATCH_URL: "https://api.github.com/repos/noi-techpark/odh-mentor-otp/actions/workflows/run_calculate.yml/dispatches"
# X_GTFS_WORKFLOW_BRANCH: ${{ github.ref }}

# X_GTFS_RT_URL: "https://efa.sta.bz.it/gtfs-r/"
# X_GTFS_FEED_ID: 1

X_MATOMO_BASE_URL: "https://digital.matomo.cloud/"
X_MATOMO_SITE_ID: 20

- name: Build graph
run: sh build-graph.sh

- name: Build and push
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-compose-file: docker-compose.build.execute.yml

- name: Deploy application
uses: noi-techpark/github-actions/docker-deploy@v2
with:
hosts: 'prod'
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
docker-username: 'noi-techpark-bot'
docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
project-name: ${{ env.PROJECT_NAME }}
playbook-file: deploy.execute.yml
# X_MATOMO_BASE_URL: "https://digital.matomo.cloud/"
# X_MATOMO_SITE_ID: 20

# - name: Build graph
# run: sh build-graph.sh

# - name: Build and push
# uses: noi-techpark/github-actions/docker-build-and-push@v2
# with:
# docker-username: ${{ github.actor }}
# docker-password: ${{ secrets.GITHUB_TOKEN }}
# docker-compose-file: docker-compose.build.execute.yml

# - name: Deploy application
# uses: noi-techpark/github-actions/docker-deploy@v2
# with:
# hosts: 'prod'
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# docker-username: 'noi-techpark-bot'
# docker-password: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
# project-name: ${{ env.PROJECT_NAME }}
# playbook-file: deploy.execute.yml

0 comments on commit 329177c

Please sign in to comment.