Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/arup-group/speckle-server i…
Browse files Browse the repository at this point in the history
…nto jm/dev/2.14.7
  • Loading branch information
jenessaman committed Jun 29, 2023
2 parents 5361d64 + ffe76d4 commit 6e066ef
Show file tree
Hide file tree
Showing 65 changed files with 2,106 additions and 40 deletions.
Empty file modified .circleci/is_draft.sh
100755 → 100644
Empty file.
33 changes: 33 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:16

# Install Docker CE CLI
RUN apt-get update \
&& apt-get install -y apt-transport-https ca-certificates curl gnupg2 lsb-release \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | apt-key add - 2>/dev/null \
&& echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list \
&& apt-get update \
&& apt-get install -y docker-ce-cli

# Install Docker Compose
RUN LATEST_COMPOSE_VERSION=$(curl -sSL "https://api.github.com/repos/docker/compose/releases/latest" | grep -o -P '(?<="tag_name": ").+(?=")') \
&& curl -sSL "https://github.com/docker/compose/releases/download/${LATEST_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose

ARG NONROOT_USER=node

RUN echo "#!/bin/sh\n\
sudoIf() { if [ \"\$(id -u)\" -ne 0 ]; then sudo \"\$@\"; else \"\$@\"; fi }\n\
SOCKET_GID=\$(stat -c '%g' /var/run/docker.sock) \n\
if [ \"${SOCKET_GID}\" != '0' ]; then\n\
if [ \"\$(cat /etc/group | grep :\${SOCKET_GID}:)\" = '' ]; then sudoIf groupadd --gid \${SOCKET_GID} docker-host; fi \n\
if [ \"\$(id ${NONROOT_USER} | grep -E \"groups=.*(=|,)\${SOCKET_GID}\(\")\" = '' ]; then sudoIf usermod -aG \${SOCKET_GID} ${NONROOT_USER}; fi\n\
fi\n\
exec \"\$@\"" > /usr/local/share/docker-init.sh \
&& chmod +x /usr/local/share/docker-init.sh

# VS Code overrides ENTRYPOINT and CMD when executing `docker run` by default.
# Setting the ENTRYPOINT to docker-init.sh will configure non-root access to
# the Docker socket if "overrideCommand": false is set in devcontainer.json.
# The script will also execute CMD if you need to alter startup behaviors.
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ]
CMD [ "sleep", "infinity" ]
12 changes: 12 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Speckle Dev Environment",
"build": {
"dockerfile": "Dockerfile"
},
"extensions": ["ms-azuretools.vscode-docker"],
"runArgs": ["--init"],
"mounts": ["source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"],
"remoteUser": "node",
"overrideCommand": false,
"postStartCommand": "npm install && npx lerna bootstrap && npx lerna run build && docker-compose -f docker-compose-deps.yml up -d && cp packages/server/.env-example packages/server/.env"
}
1 change: 1 addition & 0 deletions .github/workflows/matrix_environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["prod", "hs2", "staging", "hk", "alr", "et"]
1 change: 1 addition & 0 deletions .github/workflows/matrix_environment_staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["staging"]
69 changes: 69 additions & 0 deletions .github/workflows/matrix_include.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[
{
"environment": "staging",
"region": "eu-west-1",
"accessKey": "STAGING_AWS_ACCESS_KEY_ID",
"secretAccessKey": "STAGING_AWS_SECRET_ACCESS_KEY",
"url": "https://v2.staging-speckle.arup.com"
},
{
"environment": "prod",
"region": "eu-west-1",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://v2.speckle.arup.com"
},
{
"environment": "hk",
"region": "ap-east-1",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://hk.speckle.arup.com"
},
{
"environment": "alr",
"region": "ap-southeast-2",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://lightrail.speckle.arup.com"
},
{
"environment": "et",
"region": "eu-west-2",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://eustontower.speckle.arup.com"
},
{
"environment": "hs2",
"region": "eu-west-2",
"accessKey": "AWS_ACCESS_KEY_ID",
"secretAccessKey": "AWS_SECRET_ACCESS_KEY",
"url": "https://hs2.speckle.arup.com"
},
{
"package": "server",
"cxName": "spec-cx-server",
"serviceName": "specklev2"
},
{
"package": "frontend",
"cxName": "spec-cx-frontend",
"serviceName": "specklev2-frontend"
},
{
"package": "preview-service",
"cxName": "spec-cx-preview",
"serviceName": "specklev2-preview-service"
},
{
"package": "webhook-service",
"cxName": "spec-cx-webhook",
"serviceName": "specklev2-webhook-service"
},
{
"package": "fileimport-service",
"cxName": "spec-cx-fileimport-service",
"serviceName": "specklev2-fileimport-service"
}
]
34 changes: 34 additions & 0 deletions .github/workflows/matrix_include_staging.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"environment": "staging",
"region": "eu-west-1",
"accessKey": "STAGING_AWS_ACCESS_KEY_ID",
"secretAccessKey": "STAGING_AWS_SECRET_ACCESS_KEY",
"url": "https://v2.staging-speckle.arup.com"
},
{
"package": "server",
"cxName": "spec-cx-server",
"serviceName": "specklev2"
},
{
"package": "frontend",
"cxName": "spec-cx-frontend",
"serviceName": "specklev2-frontend"
},
{
"package": "preview-service",
"cxName": "spec-cx-preview",
"serviceName": "specklev2-preview-service"
},
{
"package": "webhook-service",
"cxName": "spec-cx-webhook",
"serviceName": "specklev2-webhook-service"
},
{
"package": "fileimport-service",
"cxName": "spec-cx-fileimport-service",
"serviceName": "specklev2-fileimport-service"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy container app to Azure Web App - speckle-v2-webhook-prod-web

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to registry
uses: docker/login-action@v1
with:
registry: https://arupspecklev2prodacr.azurecr.io/
username: ${{ secrets.AzureAppService_ContainerUsername_592a6616f6cc45a5a547a318c5808ddf }}
password: ${{ secrets.AzureAppService_ContainerPassword_1a4296e21ed54d00ad50079f39c4ae7c }}

- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_592a6616f6cc45a5a547a318c5808ddf }}/arupspecklev2prodacr/webhook-service:${{ github.sha }}
file: ./packages/webhook-service/Dockerfile

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'p500-webhook-service'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'speckle-v2-webhook-prod-web'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_54dd1b5256ec4f1d92dbbba7abe745ec }}
images: 'arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_592a6616f6cc45a5a547a318c5808ddf }}/arupspecklev2prodacr/webhook-service:${{ github.sha }}'
52 changes: 52 additions & 0 deletions .github/workflows/p500_speckle-v2-backend-prod-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: P500 Backend

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to registry
uses: docker/login-action@v1
with:
registry: https://arupspecklev2prodacr.azurecr.io/
username: ${{ secrets.AzureAppService_ContainerUsername_ff44661e05e94e0aa89a43eaf41808c7 }}
password: ${{ secrets.AzureAppService_ContainerPassword_07bfd3cf925041cb9246f1fe66fb8d17 }}

- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_ff44661e05e94e0aa89a43eaf41808c7 }}/backend:${{ github.sha }}
file: ./packages/server/Dockerfile
build-args: SPECKLE_SERVER_VERSION=v${{ github.sha }}

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'p500-backend'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'speckle-v2-backend-prod-web'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_f2962ef2bf0146968e6b35c963f8aa43 }}
images: 'arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_ff44661e05e94e0aa89a43eaf41808c7 }}/backend:${{ github.sha }}'
55 changes: 55 additions & 0 deletions .github/workflows/p500_speckle-v2-frontend-prod-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: P500 Frontend

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to registry
uses: docker/login-action@v1
with:
registry: https://arupspecklev2prodacr.azurecr.io/
username: ${{ secrets.AzureAppService_ContainerUsername_de098371e29a46b5b05da0397be4e193 }}
password: ${{ secrets.AzureAppService_ContainerPassword_f29c00baef67447a86121de1ccf89ba5 }}

- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_de098371e29a46b5b05da0397be4e193 }}/frontend:${{ github.sha }}
file: ./packages/frontend/Dockerfile
build-args: |
VUE_APP_GRAPHQL_WS=wss://${{ secrets.P500_SPECKLE_BACKEND }}/graphql
secrets: |
"posthog_api_key=${{ secrets.POSTHOG_API_KEY }}"
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'p500-frontend'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'speckle-v2-frontend-prod-web'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_bad3a6f5559c46fc9ca24925c2190beb }}
images: 'arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_de098371e29a46b5b05da0397be4e193 }}/frontend:${{ github.sha }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy container app to Azure Web App - speckle-v2-preview-prod

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to registry
uses: docker/login-action@v1
with:
registry: https://arupspecklev2prodacr.azurecr.io/
username: ${{ secrets.AzureAppService_ContainerUsername_4cad90ecad8440b5aac524055c5fae59 }}
password: ${{ secrets.AzureAppService_ContainerPassword_30b7688af0df4df883a0e68be50b8636 }}

- name: Build and push container image to registry
uses: docker/build-push-action@v2
with:
push: true
tags: arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_4cad90ecad8440b5aac524055c5fae59 }}/arupspecklev2prodacr/arupspecklev2prodacr/preview-service:${{ github.sha }}
file: ./packages/preview-service/Dockerfile

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'p500 - Preview Service'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'speckle-v2-preview-prod'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_9db157e7b79b464dbddd000d57abd0c9 }}
images: 'arupspecklev2prodacr.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_4cad90ecad8440b5aac524055c5fae59 }}/arupspecklev2prodacr/arupspecklev2prodacr/preview-service:${{ github.sha }}'
Loading

0 comments on commit 6e066ef

Please sign in to comment.