Skip to content

Commit f5f1e84

Browse files
committed
Merge branch 'develop' into staging
2 parents 3f16adf + 54ee77f commit f5f1e84

File tree

8 files changed

+166
-150
lines changed

8 files changed

+166
-150
lines changed

.github/workflows/deploy-to-kubernetes.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@ jobs:
2222
runs-on: ubuntu-22.04
2323
steps:
2424
- name: Wait for API image to be pushed to Docker Hub
25-
uses: fountainhead/action-wait-for-check@v1.1.0
25+
uses: fountainhead/action-wait-for-check@v1.2.0
2626
with:
2727
token: ${{ secrets.GITHUB_TOKEN }}
2828
checkName: Push API Docker image to Azure Container Registry
2929
ref: ${{ github.event.pull_request.head.sha || github.sha }}
3030
intervalSeconds: 30
3131

3232
- name: Wait for Geoprocessing image to be pushed to Docker Hub
33-
uses: fountainhead/action-wait-for-check@v1.1.0
33+
uses: fountainhead/action-wait-for-check@v1.2.0
3434
with:
3535
token: ${{ secrets.GITHUB_TOKEN }}
3636
checkName: Push Geoprocessing Docker image to Azure Container Registry
3737
ref: ${{ github.event.pull_request.head.sha || github.sha }}
3838
intervalSeconds: 30
3939

4040
- name: Wait for Client image to be pushed to Docker Hub
41-
uses: fountainhead/action-wait-for-check@v1.1.0
41+
uses: fountainhead/action-wait-for-check@v1.2.0
4242
with:
4343
token: ${{ secrets.GITHUB_TOKEN }}
4444
checkName: Push Client Docker image to Azure Container Registry
4545
ref: ${{ github.event.pull_request.head.sha || github.sha }}
4646
intervalSeconds: 30
4747

4848
- name: Wait for Webshot image to be pushed to Docker Hub
49-
uses: fountainhead/action-wait-for-check@v1.1.0
49+
uses: fountainhead/action-wait-for-check@v1.2.0
5050
with:
5151
token: ${{ secrets.GITHUB_TOKEN }}
5252
checkName: Push Webshot Docker image to Azure Container Registry
@@ -78,7 +78,7 @@ jobs:
7878

7979
- name: Add custom host data
8080
run: |
81-
sudo sh -c 'echo "127.0.0.1 ${{ secrets.AZURE_AKS_HOST }}" >> /etc/hosts'
81+
sudo sh -c 'echo "127.0.0.1 ${{ env.AZURE_AKS_HOST }}" >> /etc/hosts'
8282
8383
- name: Install kubectl
8484
uses: azure/setup-kubectl@v3
@@ -88,12 +88,12 @@ jobs:
8888
- name: Config kubectl
8989
run: |
9090
mkdir ~/.kube
91-
az aks get-credentials --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} --name ${{ secrets.AZURE_AKS_CLUSTER_NAME }}
91+
az aks get-credentials --resource-group ${{ env.AZURE_RESOURCE_GROUP }} --name ${{ env.AZURE_AKS_CLUSTER_NAME }}
9292
sed -i 's/\([[:alnum:]]\+\?.privatelink.[[:alnum:]]\+\?.azmk8s.io\):443/\1:4433/g' ~/.kube/config
9393
9494
- name: Creating SSH tunnel
9595
run: |
96-
ssh -i ~/.ssh/bastion.key -o StrictHostKeyChecking=no -N -L 4433:${{ secrets.AZURE_AKS_HOST }}:443 ${{ secrets.BASTION_USER }}@${{ secrets.BASTION_HOST }} -T &
96+
ssh -i ~/.ssh/bastion.key -o StrictHostKeyChecking=no -N -L 4433:${{ env.AZURE_AKS_HOST }}:443 ${{ env.BASTION_USER }}@${{ env.BASTION_HOST }} -T &
9797
9898
- name: Redeploy production pods
9999
if: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/e2e-client.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
path: playwright-report/
4242
retention-days: 30
4343
env:
44-
NEXT_PUBLIC_MAPBOX_API_TOKEN: ${{ secrets.NEXT_PUBLIC_MAPBOX_API_TOKEN }}
44+
NEXT_PUBLIC_MAPBOX_API_TOKEN: ${{ env.NEXT_PUBLIC_MAPBOX_API_TOKEN }}
4545
# Recommended: pass the GitHub token lets this action correctly
4646
# determine the unique run id necessary to re-run the checks
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish-marxan-docker-images.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
steps:
3434
- name: Wait for API tests to run
3535
if: ${{ github.event.inputs.waitForTest == 'true' }}
36-
uses: fountainhead/action-wait-for-check@v1.1.0
36+
uses: fountainhead/action-wait-for-check@v1.2.0
3737
with:
3838
token: ${{ secrets.GITHUB_TOKEN }}
3939
checkName: API Tests
@@ -42,7 +42,7 @@ jobs:
4242

4343
- name: Wait for Client tests to run
4444
if: ${{ github.event.inputs.waitForTest == 'true' }}
45-
uses: fountainhead/action-wait-for-check@v1.1.0
45+
uses: fountainhead/action-wait-for-check@v1.2.0
4646
with:
4747
token: ${{ secrets.GITHUB_TOKEN }}
4848
checkName: Client Tests
@@ -67,15 +67,15 @@ jobs:
6767
- name: Build and push image
6868
uses: azure/docker-login@v1
6969
with:
70-
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
71-
username: ${{ secrets.REGISTRY_USERNAME }}
70+
login-server: ${{ env.REGISTRY_LOGIN_SERVER }}
71+
username: ${{ env.REGISTRY_USERNAME }}
7272
password: ${{ secrets.REGISTRY_PASSWORD }}
7373

7474
- run: |
7575
docker build ./api -f api/api.Dockerfile \
76-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.sha }} \
77-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }}
78-
docker push -a ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-api
76+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.sha }} \
77+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-api:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }}
78+
docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-api
7979
8080
push_geoprocessing_to_registry:
8181
name: Push Geoprocessing Docker image to Azure Container Registry
@@ -95,15 +95,15 @@ jobs:
9595
- name: Build and push image
9696
uses: azure/docker-login@v1
9797
with:
98-
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
99-
username: ${{ secrets.REGISTRY_USERNAME }}
98+
login-server: ${{ env.REGISTRY_LOGIN_SERVER }}
99+
username: ${{ env.REGISTRY_USERNAME }}
100100
password: ${{ secrets.REGISTRY_PASSWORD }}
101101

102102
- run: |
103103
docker build ./api -f api/geo.Dockerfile \
104-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.sha }} \
105-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }}
106-
docker push -a ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing
104+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.sha }} \
105+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }}
106+
docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-geoprocessing
107107
108108
push_client_to_registry:
109109
name: Push Client Docker image to Azure Container Registry
@@ -124,19 +124,19 @@ jobs:
124124
- name: Build and push image
125125
uses: azure/docker-login@v1
126126
with:
127-
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
128-
username: ${{ secrets.REGISTRY_USERNAME }}
127+
login-server: ${{ env.REGISTRY_LOGIN_SERVER }}
128+
username: ${{ env.REGISTRY_USERNAME }}
129129
password: ${{ secrets.REGISTRY_PASSWORD }}
130130

131131
- run: |
132132
docker build ./app \
133-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.sha }} \
134-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} \
135-
--build-arg NEXT_PUBLIC_URL=${{ github.ref != 'refs/heads/main' && secrets.NEXT_PUBLIC_URL_STAGING || secrets.NEXT_PUBLIC_URL_PRODUCTION }} \
136-
--build-arg NEXT_PUBLIC_API_URL=${{ github.ref != 'refs/heads/main' && secrets.NEXT_PUBLIC_API_URL_STAGING || secrets.NEXT_PUBLIC_API_URL_PRODUCTION }} \
137-
--build-arg NEXTAUTH_URL=${{ github.ref != 'refs/heads/main' && secrets.NEXTAUTH_URL_STAGING || secrets.NEXTAUTH_URL_PRODUCTION }} \
138-
--build-arg NEXT_PUBLIC_FEATURE_FLAGS=${{ github.ref != 'refs/heads/main' && secrets.NEXT_PUBLIC_FEATURE_FLAGS_STAGING || secrets.NEXT_PUBLIC_FEATURE_FLAGS_PRODUCTION }} \
139-
--build-arg NEXT_PUBLIC_MAPBOX_API_TOKEN=${{ secrets.NEXT_PUBLIC_MAPBOX_API_TOKEN }} \
133+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.sha }} \
134+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-client:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }} \
135+
--build-arg NEXT_PUBLIC_URL=${{ github.ref != 'refs/heads/main' && env.NEXT_PUBLIC_URL_STAGING || env.NEXT_PUBLIC_URL_PRODUCTION }} \
136+
--build-arg NEXT_PUBLIC_API_URL=${{ github.ref != 'refs/heads/main' && env.NEXT_PUBLIC_API_URL_STAGING || env.NEXT_PUBLIC_API_URL_PRODUCTION }} \
137+
--build-arg NEXTAUTH_URL=${{ github.ref != 'refs/heads/main' && env.NEXTAUTH_URL_STAGING || env.NEXTAUTH_URL_PRODUCTION }} \
138+
--build-arg NEXT_PUBLIC_FEATURE_FLAGS=${{ github.ref != 'refs/heads/main' && env.NEXT_PUBLIC_FEATURE_FLAGS_STAGING || env.NEXT_PUBLIC_FEATURE_FLAGS_PRODUCTION }} \
139+
--build-arg NEXT_PUBLIC_MAPBOX_API_TOKEN=${{ env.NEXT_PUBLIC_MAPBOX_API_TOKEN }} \
140140
--build-arg ENABLE_MAINTENANCE_MODE=${{ github.event.inputs.enable_maintenance_mode }} \
141-
--build-arg NEXT_PUBLIC_CONTACT_EMAIL=${{ secrets.NEXT_PUBLIC_CONTACT_EMAIL }}
142-
docker push -a ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-client
141+
--build-arg NEXT_PUBLIC_CONTACT_EMAIL=${{ env.NEXT_PUBLIC_CONTACT_EMAIL }}
142+
docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-client

.github/workflows/publish-webshot-docker-images.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ jobs:
3434
- name: Build and push image
3535
uses: azure/docker-login@v1
3636
with:
37-
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
38-
username: ${{ secrets.REGISTRY_USERNAME }}
37+
login-server: ${{ env.REGISTRY_LOGIN_SERVER }}
38+
username: ${{ env.REGISTRY_USERNAME }}
3939
password: ${{ secrets.REGISTRY_PASSWORD }}
4040

4141
- run: |
4242
docker build ./webshot \
43-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.sha }} \
44-
-t ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }}
45-
docker push -a ${{ secrets.REGISTRY_LOGIN_SERVER }}/marxan-webshot
43+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.sha }} \
44+
-t ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-webshot:${{ github.ref != 'refs/heads/main' && 'staging' || 'production' }}
45+
docker push -a ${{ env.REGISTRY_LOGIN_SERVER }}/marxan-webshot

infrastructure/README.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,39 @@ the services on kubernetes, which is done by this plan.
9797

9898
#### Github Actions
9999

100-
As part of this infrastructure, Github Actions are used to automatically build and push Docker images to Azure ACR, and
101-
to redeploy Kubernetes pods once that happens. Said Github Actions depend on specific Github Secrets, that are listed below
102-
for reference. Said secrets are automatically created by the `base` Terraform project, and do not need to be created manually.
100+
As part of this infrastructure, Github Actions are used to automatically build
101+
and push Docker images to Azure ACR, and to redeploy Kubernetes pods once that
102+
happens. Said Github Actions depend on specific Github Secrets and Variables,
103+
that are listed below for reference.
104+
105+
Secrets and variables listed below are automatically created by the `base`
106+
Terraform project, and do not need to be created manually. Their value often
107+
depends on the outputs of other Terraform modules, so configuring all these via
108+
Terraform (and avoiding to change them manually within the settings of the
109+
relevant GitHub repository) guarantees that values available to GitHub actions
110+
are always coherent with the state of the terraformed infrastructure.
111+
112+
For example, AKS-related variables depend on settings for the cluster name as
113+
well as the hostname of the AKS API server, which is assigned by Azure upon
114+
creation of an AKS cluster.
115+
116+
##### Secrets
103117

104-
- `AZURE_AKS_CLUSTER_NAME`: The name of the AKS cluster. Get from `Base`'s `k8s_cluster_name`
105-
- `AZURE_AKS_HOST`: The AKS cluster hostname (without port or protocol). Get from `Base`'s `k8s_cluster_private_fqdn`
106118
- `AZURE_CLIENT_ID`: The hostname for the Azure ACT. Get from `Base`'s `container_registry_client_id`
107-
- `AZURE_RESOURCE_GROUP`: The AKS Resource Group name. Specified by you when setting up the infrastructure.
108119
- `AZURE_SUBSCRIPTION_ID`: The Azure Subscription Id. Get from `Base`'s `azure_subscription_id`
109120
- `AZURE_TENANT_ID`: The Azure Tenant Id. Get from `Base`'s `azure_tenant_id`
121+
- `BASTION_SSH_PRIVATE_KEY`: The ssh private key to access the bastion host. Get it by connection to the bastion host using SSH, and generating a new public/private SSH key pair.
122+
- `REGISTRY_PASSWORD`: The password to access the Azure. Get from `Base`'s `container_registry_password`
123+
124+
##### Variables
125+
126+
- `AZURE_AKS_CLUSTER_NAME`: The name of the AKS cluster. Get from `Base`'s `k8s_cluster_name`
127+
- `AZURE_AKS_HOST`: The AKS cluster hostname (without port or protocol). Get from `Base`'s `k8s_cluster_private_fqdn`
128+
- `AZURE_RESOURCE_GROUP`: The AKS Resource Group name. Specified by you when setting up the infrastructure.
110129
- `BASTION_HOST`: The hostname for the bastion machine. Get from `Base`'s `bastion_hostname`
111130
- `BASTION_USER`: By default this will be `ubuntu` if using the initial user created on bastion host instantiation. It is configurable in case infrastructure admins wish to configure a different user on the bastion host or the default distro user is renamed.
112-
- `BASTION_SSH_PRIVATE_KEY`: The ssh private key to access the bastion host. Get it by connection to the bastion host using SSH, and generating a new public/private SSH key pair.
113131
- `REGISTRY_LOGIN_SERVER`: The hostname for the Azure ACR. Get from `Base`'s `container_registry_hostname`
114132
- `REGISTRY_USERNAME`: The username for the Azure ACR. Get from `Base`'s `container_registry_client_id`
115-
- `REGISTRY_PASSWORD`: The password to access the Azure. Get from `Base`'s `container_registry_password`
116-
- `BASTION_SSH_PRIVATE_KEY`: The ssh private key to access the bastion host. Get it by connection to the bastion host using SSH, and generating a new public/private SSH key pair.
117133

118134
Additional Github Actions Secrets are needed, as required by the [frontend application](../app/README.md#env-variables)
119135
and used by the corresponding [Github workflow](../.github/workflows/publish-marxan-docker-images.yml) that builds

0 commit comments

Comments
 (0)