-
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 #179 from supportingami/feat/eu-west1-deployment
Feat/eu west1 deployment
- Loading branch information
Showing
79 changed files
with
550 additions
and
301 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
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,14 @@ | ||
# Generate static site preview for production site | ||
name: Production Preview | ||
on: | ||
repository_dispatch: | ||
types: [production_preview] | ||
jobs: | ||
run_if_failure: | ||
if: ${{ !github.event.client_payload.passed }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- env: | ||
MESSAGE: ${{ github.event.client_payload.message }} | ||
run: echo $MESSAGE | ||
# TODO - trigger preview build |
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,91 @@ | ||
# Generate static site preview for production site | ||
name: Production Preview | ||
on: | ||
workflow_call: | ||
push: | ||
branches: main | ||
# Only keep one active build per ref (e.g. pr branch, push branch, triggering workflow ref) | ||
concurrency: | ||
group: preview-${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
preview: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
lfs: true | ||
- name: Setup Node 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
|
||
############################################################################# | ||
# Node Modules | ||
# Manually restore any previous cache to speed install | ||
# As immutable install will not change cache only save new cache if not hit | ||
# Uses fine-grained methods from https://github.com/actions/cache | ||
############################################################################# | ||
|
||
- uses: actions/cache/restore@v3 | ||
id: cache | ||
with: | ||
path: ./.yarn/cache | ||
key: ${{ runner.os }}-node-modules-yarn-v1-${{ hashFiles('yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-modules-yarn-v1- | ||
- name: Install node modules | ||
run: yarn install --immutable && npm i -g vercel | ||
- uses: actions/cache/save@v3 | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ./.yarn/cache | ||
key: ${{ runner.os }}-node-modules-yarn-v1-${{ hashFiles('yarn.lock') }} | ||
|
||
############################################################################# | ||
# Gcloud Setup | ||
# Populate service account credentials to file | ||
# Authenticate to google servers | ||
# Initialize gcloud cli | ||
############################################################################# | ||
- name: Setup Credentials | ||
id: service-account | ||
run: | | ||
echo ${{secrets.GCP_SA_KEY_B64}} | base64 --decode > ./service-account.json | ||
- name: GCP Auth | ||
uses: "google-github-actions/auth@v2" | ||
with: | ||
project_id: "sami-website-365718" | ||
credentials_json: ${{secrets.GCP_SA_KEY_B64}} | ||
token_format: "access_token" | ||
- name: "Set up Cloud SDK" | ||
uses: "google-github-actions/setup-gcloud@v2" | ||
with: | ||
version: ">= 363.0.0" | ||
|
||
############################################################################# | ||
# Export production | ||
############################################################################# | ||
# TODO - refactor actions - reusable build, export, deploy, hooks, pr generate etc. | ||
|
||
# Export production and rename to match dev configuration (production-local) | ||
- name: Import production data locally | ||
run: | | ||
echo "STRAPI_READONLY_TOKEN=${{secrets.STRAPI_READONLY_TOKEN}}" > config/docker.local.env | ||
yarn scripts strapi export --environment docker --ci | ||
cp config/docker.local.env config/development.local.env | ||
cp data/db/sami-production.db data/db/sami-dev.db | ||
- name: Build | ||
run: yarn scripts cli build --environment=development --no-export --no-preview --no-deploy | ||
# HACK - split build-deploy above for easier debugging | ||
- name: Deploy | ||
run: | | ||
cd frontend | ||
vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | ||
vercel build --token=${{ secrets.VERCEL_TOKEN }} | ||
vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | ||
# NOTE - also possible to do without intermediate but requires interaction with live cloud-run api | ||
# - name: Generate preview | ||
# run: yarn scripts cli build --environment=docker --export --no-backend --no-preview --deploy |
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 |
---|---|---|
|
@@ -33,4 +33,4 @@ scripts/input | |
scripts/output | ||
.vercel | ||
|
||
service.yaml | ||
service*.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
config: | ||
gcp:project: sami-website-365718 | ||
gcp:region: europe-west2 | ||
sami-website:GCS_STORAGE_BUCKET: sami_website_uploads | ||
gcp:region: europe-west1 | ||
sami-website:GCS_STORAGE_BUCKET: sami_website_public |
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,4 +1,4 @@ | ||
config: | ||
gcp:project: sami-website-365718 | ||
gcp:region: europe-west2 | ||
sami-website:GCS_STORAGE_BUCKET: sami_website_uploads_staging | ||
gcp:region: europe-west1 | ||
sami-website:GCS_STORAGE_BUCKET: sami_website_public_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
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
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
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,5 @@ | ||
# Additional env required when running via docker-compose | ||
|
||
# Domain pointed at server to generate https certs | ||
PUBLIC_DOMAIN=next.sami.local | ||
LETS_ENCRYPT_EMAIL=[email protected] |
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ DATABASE_URL=postgres://wspestjk:[email protected] | |
# If using a service worker will require access to bucket | ||
|
||
GOOGLE_APPLICATION_CREDENTIALS=./service-account.json | ||
GCS_BUCKET_NAME=sami_website_uploads_staging-bf0d161 | ||
GCS_BUCKET_NAME=sami_website_public_staging-bf0d161 | ||
GCS_PUBLIC_FILES=true | ||
GCS_UNIFORM=false | ||
|
||
|
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,6 +1,4 @@ | ||
# Domain pointed at server to generate https certs | ||
PUBLIC_DOMAIN=next.sami.local | ||
LETS_ENCRYPT_EMAIL=[email protected] | ||
|
||
|
||
# Strapi Configuration | ||
# NOTE - changes to these will require new strapi build (?) | ||
|
@@ -22,13 +20,13 @@ DATABASE_FILENAME=sami-production.db | |
# Or exporting locally | ||
GCP_PROJECT=sami-website-365718 | ||
GCS_DB_BUCKET_NAME=sami_website_db | ||
GCS_PUBLIC_BUCKET_NAME=sami_website_uploads | ||
GCS_PUBLIC_BUCKET_NAME=sami_website_public | ||
|
||
# Paseed from compose | ||
# STRAPI_READONLY_TOKEN=TO_BE_GENERATED | ||
|
||
# Connect to API directly but serve image from public url | ||
NEXT_PUBLIC_API_URL=http://backend:1337 | ||
NEXT_PUBLIC_API_URL=https://admin.samicharity.co.uk | ||
|
||
# Images uploaded in backed are shared directly with frontend via volumes | ||
# So just load from self | ||
|
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
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 |
---|---|---|
|
@@ -112,11 +112,11 @@ | |
"id": 29 | ||
}, | ||
{ | ||
"html": "<h2 style=\"margin-left:0px;\">Background</h2><p><span style=\"color:hsl(0,0%,0%);font-family:"Open Sans", Helvetica, Arial, Lucida, sans-serif;\">The African Data Initiative (ADI) is an on-going effort to help design and build statistical software that can easily be used throughout the developing world. It started through a crowd-funding campaign in November 2015, where close to £33,000 was raised to fund the initial development.</span></p><h2 style=\"margin-left:0px;\">Current Progress</h2><p style=\"margin-left:0px;\">The team in Kenya has been incredibly busy working on the software, and had their first <a href=\"http://www.africanmathsinitiative.net/blog/initiatives/african-data-initiative/\">beta release</a> in November 2016, one year on from the project start. Since then it has been showcased at numerous workshops and conferences, and received additional funding to support specific development to help explore climatic modelling and combat corruption.</p><p style=\"margin-left:0px;\"> </p><p style=\"margin-left:0px;\"><img src=\"https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-danny-kisumu.png?resize=300%2C169&ssl=1\" alt=\"Danny presents the software at a conference in Kenya\" srcset=\"https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-danny-kisumu.png?resize=300%2C169&ssl=1 300w, https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-danny-kisumu.png?resize=768%2C432&ssl=1 768w, https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-danny-kisumu.png?w=943&ssl=1 943w\" sizes=\"(max-width: 300px) 100vw, 300px\" width=\"300\" loading=\"eager\"></p><p style=\"margin-left:0px;text-align:center;\">Danny presents the software at a conference in Kenya</p><p style=\"margin-left:0px;\"> </p><p style=\"margin-left:0px;\"><img src=\"https://i2.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-dev-tanzania.png?resize=300%2C169&ssl=1\" alt=\"The ADI team working together in Tanzania\" srcset=\"https://i2.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-dev-tanzania.png?resize=300%2C169&ssl=1 300w, https://i2.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-dev-tanzania.png?resize=768%2C432&ssl=1 768w, https://i2.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/ADI-dev-tanzania.png?w=944&ssl=1 944w\" sizes=\"(max-width: 300px) 100vw, 300px\" width=\"300\" loading=\"eager\"></p><p style=\"margin-left:0px;text-align:center;\">The ADI team working together in Tanzania</p><p style=\"margin-left:0px;\"> </p><h2 style=\"margin-left:0px;\">Future Plans</h2><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">R-Instat is looking towards its official release in July 2017 at the World Statistics Congress in Morocco.</span></p>", | ||
"html": "<h2 style=\"margin-left:0px;\">Background</h2><p><span style=\"color:hsl(0,0%,0%);font-family:"Open Sans", Helvetica, Arial, Lucida, sans-serif;\">The African Data Initiative (ADI) is an on-going effort to help design and build statistical software that can easily be used throughout the developing world. It started through a crowd-funding campaign in November 2015, where close to £33,000 was raised to fund the initial development.</span></p><h2 style=\"margin-left:0px;\">Current Progress</h2><p style=\"margin-left:0px;\">The team in Kenya has been incredibly busy working on the software, and had their first <a href=\"http://www.africanmathsinitiative.net/blog/initiatives/african-data-initiative/\">beta release</a> in November 2016, one year on from the project start. Since then it has been showcased at numerous workshops and conferences, and received additional funding to support specific development to help explore climatic modelling and combat corruption.</p>", | ||
"id": 30 | ||
}, | ||
{ | ||
"html": "<h1 style=\"margin-left:0px;\">Background</h1><p style=\"margin-left:0px;\"><img src=\"https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/DCI.png?resize=300%2C217&ssl=1\" alt=\"The Digital Communities Initiative uses technology to support across diverse areas including schools, agriculture and women in enterprise.\" srcset=\"https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/DCI.png?resize=300%2C217&ssl=1 300w, https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/DCI.png?resize=768%2C555&ssl=1 768w, https://i1.wp.com/samicharity.co.uk/wp-content/uploads/2016/03/DCI.png?w=874&ssl=1 874w\" sizes=\"(max-width: 300px) 100vw, 300px\" width=\"300\" loading=\"eager\"></p><p style=\"margin-left:0px;text-align:center;\">The Digital Communities Initiative uses technology to support across diverse areas including schools, agriculture and women in enterprise.</p><p style=\"margin-left:0px;\"> </p><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">In 2016 SAMI applied for a small grant from the Economist Charitable Trust to pilot a new project aimed at using technology to improve livelihoods across a community.</span></p><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">We initially started with a set of 20 android tablets that were taken out to the Kitale region of Western Kenya. We’ve been hard at work to find innovative and effective ways that the technology can be used to support people, with an initial focus on schools, agriculture and enterprising women.</span></p><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">Since then the project has expanded to include more than 60 devices, and we are working with organisations and institutions around the world to provide real impact, with costs involved kept to a minimum. You can see the first update report published by the DCI team below:</span></p><h1 style=\"margin-left:0px;\">Updates May 2017</h1><p style=\"margin-left:auto;\"> </p><p style=\"margin-left:0px;\">Page <span style=\"background-color:transparent;\">1</span> / <span style=\"background-color:transparent;\">26</span></p><p style=\"margin-left:0px;\"> </p><p style=\"margin-left:0px;\">Zoom <span style=\"background-color:transparent;\">100%</span></p><p style=\"margin-left:0px;\"> </p><h1 style=\"margin-left:0px;\">Future Plans</h1><p style=\"margin-left:0px;\">We have been incredibly excited to see the huge impact seen through DCI, and are currently looking for ways to extend the project through 2017-2018.</p>", | ||
"html": "<h1 style=\"margin-left:0px;\">Background</h1>", | ||
"id": 31 | ||
}, | ||
{ | ||
|
@@ -142,5 +142,13 @@ | |
{ | ||
"html": "<p style=\"margin-left:0px;\">For each camp we aim to have at least one experienced volunteer. Further, we aim to have at least one international teacher at each camp, either a current teacher or a retired teacher. We aim to also have two to three student international volunteers participate in each of the AMI camps, with the volunteers being a mixture of undergrads and postgrads/researchers. We would be happy to hear from people in other walks of life who feel they have something to contribute, and we would consider recommending high school students for this experience.</p><p style=\"margin-left:0px;\">The recruitment of international volunteers has begun and we will be considering applications on a rolling basis until the start of the camps. You can mention a preference for a camp in your application, but you don’t have to. Decisions on applications will be made by the SAMI Trustees, who then recommend suitable candidates to the local organisers of the respective camps. Note: all camps are run through local partners. As such, dates and venues are subject to change. </p><p style=\"margin-left:0px;\"><strong>Do not make any flight or accommodation booking until you have confirmed the camp dates with the local organiser</strong>. </p><p style=\"margin-left:0px;\">SAMI cannot accept responsibility for any financial loss occurred due to the changes in dates or venues for any of the camps.</p><p style=\"margin-left:0px;\">FAQs can be found below. If you would like to know more please write to <a href=\"mailto:[email protected]\">[email protected]</a>. We’re happy to give you more information by email and would be happy to meet you in person.</p>", | ||
"id": 37 | ||
}, | ||
{ | ||
"html": "<h2 style=\"margin-left:0px;\">Future Plans</h2><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">R-Instat is looking towards its official release in July 2017 at the World Statistics Congress in Morocco.</span></p>", | ||
"id": 38 | ||
}, | ||
{ | ||
"html": "<p style=\"margin-left:0px;text-align:center;\">The Digital Communities Initiative uses technology to support across diverse areas including schools, agriculture and women in enterprise.</p><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">In 2016 SAMI applied for a small grant from the Economist Charitable Trust to pilot a new project aimed at using technology to improve livelihoods across a community.</span></p><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">We initially started with a set of 20 android tablets that were taken out to the Kitale region of Western Kenya. We’ve been hard at work to find innovative and effective ways that the technology can be used to support people, with an initial focus on schools, agriculture and enterprising women.</span></p><p style=\"margin-left:0px;\"><span style=\"background-color:transparent;\">Since then the project has expanded to include more than 60 devices, and we are working with organisations and institutions around the world to provide real impact, with costs involved kept to a minimum. You can see the first update report published by the DCI team below:</span></p><h1 style=\"margin-left:0px;\">Updates May 2017</h1><p style=\"margin-left:auto;\"> </p><p style=\"margin-left:0px;\"> </p><h1 style=\"margin-left:0px;\">Future Plans</h1><p style=\"margin-left:0px;\">We have been incredibly excited to see the huge impact seen through DCI, and are currently looking for ways to extend the project through 2017-2018.</p>", | ||
"id": 39 | ||
} | ||
] |
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.