-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from UoaWDCC/deploy
setup deployment and actions
- Loading branch information
Showing
33 changed files
with
16,518 additions
and
11,974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
name: Deploy PROD | ||
name: Deploy to Production | ||
|
||
on: [workflow_dispatch] | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
DeployFrontend: | ||
deploy-strapi: | ||
name: Deploy Strapi Prod | ||
runs-on: ubuntu-latest | ||
environment: PROD | ||
defaults: | ||
run: | ||
working-directory: ./frontend | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.17.0 | ||
|
||
- name: Create env file | ||
run: echo ${{ secrets.FRONTEND_ENV }} | base64 --decode > .env | ||
|
||
- run: npm install | ||
|
||
- run: npm run build | ||
|
||
- uses: "google-github-actions/auth@v0" | ||
with: | ||
# Credentials stored inside WDCC organisation secrets | ||
credentials_json: "${{ secrets.YOUNITE_GCP_DEPLOYMENT_SA_CREDENTIALS }}" | ||
|
||
- id: "app-engine-deploy" | ||
uses: "google-github-actions/deploy-appengine@v0" | ||
with: | ||
flags: --no-cache | ||
project_id: wdcc-younite-prod | ||
working_directory: ./frontend | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only --config strapi/fly.production.toml | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_STRAPI }} | ||
deploy-frontend: | ||
name: Deploy Frontend Prod | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only --config frontend/fly.production.toml | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_FRONTEND }} | ||
deploy-storage: | ||
name: Deploy Storage Prod | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only --config storage/fly.production.toml | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_STORAGE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Deploy to Staging | ||
|
||
on: | ||
push: | ||
branches: | ||
- staging | ||
|
||
jobs: | ||
deploy-strapi: | ||
name: Deploy Strapi Staging | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only --config strapi/fly.staging.toml | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_STRAPI_STAGING }} | ||
deploy-frontend: | ||
name: Deploy Frontend Staging | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only --config frontend/fly.staging.toml | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_FRONTEND_STAGING }} | ||
deploy-storage: | ||
name: Deploy Storage Staging | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only --config storage/fly.staging.toml | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_STORAGE_STAGING }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,3 +156,5 @@ | |
/strapi/dist | ||
/strapi/build | ||
/strapi/.strapi-updater.json | ||
|
||
/strapi/env_vars.*.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/.git | ||
/node_modules | ||
.dockerignore | ||
.env | ||
Dockerfile | ||
fly.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# syntax = docker/dockerfile:1 | ||
|
||
# Adjust NODE_VERSION as desired | ||
ARG NODE_VERSION=20.0.0 | ||
FROM node:${NODE_VERSION}-slim as base | ||
|
||
LABEL fly_launch_runtime="Next.js" | ||
|
||
# Next.js app lives here | ||
WORKDIR /app | ||
|
||
# Set production environment | ||
ENV NODE_ENV="production" | ||
|
||
# Install pnpm | ||
ARG PNPM_VERSION=8.3.1 | ||
RUN npm install -g pnpm@$PNPM_VERSION | ||
|
||
|
||
# Throw-away build stage to reduce size of final image | ||
FROM base as build | ||
|
||
# Install packages needed to build node modules | ||
RUN apt-get update -qq && \ | ||
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 | ||
|
||
# Install node modules | ||
COPY --link .npmrc package.json pnpm-lock.yaml ./ | ||
RUN pnpm install --frozen-lockfile --prod=false | ||
|
||
# Copy application code | ||
COPY --link . . | ||
|
||
# Build application | ||
RUN pnpm run build | ||
|
||
# Remove development dependencies | ||
RUN pnpm prune --prod | ||
|
||
|
||
# Final stage for app image | ||
FROM base | ||
|
||
# Copy built application | ||
COPY --from=build /app /app | ||
|
||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
CMD [ "pnpm", "run", "start" ] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# fly.toml app configuration file generated for younite on 2024-01-23T20:03:27+13:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = "younite" | ||
primary_region = "syd" | ||
|
||
[env] | ||
STRAPI_URL="https://edit.younite.wdcc.co.nz" | ||
|
||
[[vm]] | ||
memory = "1gb" | ||
vm = "performance-1x" | ||
|
||
|
||
|
||
[http_service] | ||
internal_port = 3000 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ["app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# fly.toml app configuration file generated for younite on 2024-01-23T20:03:27+13:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = "younite-staging" | ||
primary_region = "syd" | ||
|
||
[env] | ||
STRAPI_URL="https://staging.edit.younite.wdcc.co.nz" | ||
|
||
[[vm]] | ||
memory = "512mb" | ||
vm = "shared-cpu-4x" | ||
|
||
|
||
[http_service] | ||
internal_port = 3000 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ["app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.