Skip to content

Commit

Permalink
hotfix: run calculate on same instance as OTP, as the calculate insta…
Browse files Browse the repository at this point in the history
…nce does not exist anymore
  • Loading branch information
clezag committed Dec 10, 2024
1 parent df68dc0 commit 4a18130
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_calculate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:

env:
PROJECT_NAME: "odh-mentor-otp"
PROJECT_NAME: "odh-mentor-otp-calculate"
API_HOST: http://localhost
API_PATH: /otp/routers/openmove
API_PORT: 8080
Expand Down
58 changes: 2 additions & 56 deletions .github/workflows/run_calculate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

env:
PROJECT_NAME: "odh-mentor-otp"
PROJECT_NAME: "odh-mentor-otp-calculate"
API_HOST: http://localhost
API_PATH: /otp/routers/openmove
API_PORT: 8080
Expand All @@ -21,14 +21,6 @@ jobs:
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
concurrency: build-calc-test
steps:
- name: Spin up EC2 instance
run: |
aws ec2 start-instances --instance-ids ${{secrets.AWS_EC2_INSTANCE_ID }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2

Expand Down Expand Up @@ -65,18 +57,6 @@ jobs:
X_CHARGER_BASEURL: "https://charger.otp.opendatahub.testingmachine.eu"
X_TRAFFIC_BASEURL: "https://traffic.otp.opendatahub.testingmachine.eu"

- name: Wait for instance to start up
run: |
aws ec2 wait instance-running --instance-ids ${{secrets.AWS_EC2_INSTANCE_ID }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

# sometimes we try to log in before the OS is up, so let's wait 60 sec just to be sure
- name: Wait for system to boot
run: sleep 60

- name: Deploy / run calculation
uses: noi-techpark/github-actions/docker-deploy@v2
with:
Expand All @@ -87,36 +67,11 @@ jobs:
project-name: ${{ env.PROJECT_NAME }}
playbook-file: deploy.calculate.test.yml

- name: Spin down EC2 instance
run: |
aws ec2 stop-instances --instance-ids ${{secrets.AWS_EC2_INSTANCE_ID }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

run-calculate-prod:
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/prod' && github.event_name == 'workflow_dispatch'
concurrency: build-calc-prod
steps:
- name: Spin up EC2 instance
run: |
aws ec2 start-instances --instance-ids ${{secrets.AWS_EC2_INSTANCE_ID }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

# this used to be a wait (120 sec) to have the efs volume be mounted. If this makes problems, return to a wait 120
- name: Wait for instance to start up
run: |
aws ec2 wait instance-running --instance-ids ${{secrets.AWS_EC2_INSTANCE_ID }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

- name: Checkout source code
uses: noi-techpark/github-actions/checkout@v2

Expand All @@ -131,7 +86,7 @@ jobs:

X_GBFS_HOST : "https://gbfs.otp.opendatahub.com/"

X_JAVA_MX: "16G"
X_JAVA_MX: "4G"
X_BUILD_GRAPH: "True"
X_DOWNLOAD_DATA: "False"
X_BACKUP_GRAPH: "True"
Expand Down Expand Up @@ -163,12 +118,3 @@ jobs:
project-name: ${{ env.PROJECT_NAME }}
playbook-file: deploy.calculate.prod.yml

- name: Spin down EC2 instance
if: always()
run: |
aws ec2 stop-instances --instance-ids ${{secrets.AWS_EC2_INSTANCE_ID }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}

4 changes: 2 additions & 2 deletions infrastructure/ansible/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ docker03.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_ar
docker03.opendatahub.com ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'

[calculate-test]
mentor01.opendatahub.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'
docker03.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'

[calculate-prod]
mentor01.opendatahub.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'
docker03.opendatahub.com ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'

[execute]
docker03.testingmachine.eu ansible_user='noi-techpark-bot' ansible_ssh_common_args='-o StrictHostKeyChecking=no'
Expand Down

0 comments on commit 4a18130

Please sign in to comment.