In this README:
- Deploying locally
- Deploying new releases on stage/production
- Setup new production-like environment
- Enable agent requests
make
cp .env.dev .env
Ask Vadim or Mark for stage credentials.
GQL_QUERY_SECRET_KEY- if not set, following requests will fail:- Login with Twitter
- Login with Telegram
- Add/Remove Webhook endpoints
- Query
communitiesandpostedMessageswith more than 25 items per page
EMAILS_SENDGRID_API_KEY- if not set, requests sending emails will failEMAILS_SENDGRID_WEBHOOK_VERIFICATION_KEY- is not set, webhooks from sendgrid will fail payload verificationSEGMENT_SECRET- if not set, events will not be sent to segmentPUSHER_APP_ID- if not set, events to pusher will not be sent- Also set
PUSHER_APP_KEY,PUSHER_APP_SECRETandPUSHER_APP_CLUSTER
- Also set
POSTHOG_PERSONAL_API_KEY- if not set, requests to PostHog will failINTERCOM_IDENTITY_VERIFICATION_SECRET- if not set, intercom user id hash will not be generated correctly
If not configured, files I/O will be skipped without errors
Store the file in the root folder with the name gcs-credentials.json
For a different name and/or path change
GCS_CREDENTIALS_JSON_FILEin.env
If not configured, legacy threads views will resolve to
0
Store the file in the root folder with the name firebase-adminsdk.json
For a different name and/or path change
FIREBASE_ADMIN_SDK_FILE_PATHin.env
127.0.0.1 api.holdex.localhost
make dev
To use different port, change HTTP_SERVER_ADDR in the .env file
Deployment is done manually
After each merge into
masterbranch, a new build is launched to build a docker image from that commit.
Go to Google Cloud Build
and copy the value from the Commit column, or the docker image tag from the Artifacts column.

Provide your public ssh key to Mark/Vadim to be authorised to access the server.
ssh coreusr@SERVER_IP
cd ./backend
You can also add/update/remove any other variables at this step
- Access
backendfolder on the server. - Open the
.envfile and update theDEPLOY_VERSIONwith the image tag. Save and close the file.
make prodp - This will just pull the new docker image.
make prod - This will deploy the new docker image.
make prodc - This will deploy the new docker image, but also delete the SQLite cache on disk. Execute this command only when the SQLite schema has been updated, or a resync is required.
Instructions are for Google Cloud Platform
Create a new VM with following settings:
-
Name: core-vm
-
Zone: us-west2-a
-
Machine type: e2-medium (General purpose)
-
Disk: SSD 20gb, Debian/GNU10
-
Firewall: Enable HTTP & HTTPS traffic
Additional settings:
-
Enable deletion protection
-
Disable disk deletion when instance is deleted
Wait until the VM instance is created succesfully
- go to https://console.cloud.google.com/networking/addresses/list,
- Find the IP used by the new VM, and change from Ephemeral to Static IP.
- Assing name
core-ip
- SSH into the instance via Cloud Shell (from GCP interface)
- Switch to root user:
sudo su - Create a new user with sudo permissions and switch to it
sudo adduser coreusrsudo usermod -aG sudo coreusrsu coreusrcd ~
- Create .ssh directory:
mkdir .ssh && cd .ssh - Create a file named
authorized_keysand add inside all authorized public keys - Open the terminal, and you should be able to access the server via
ssh coreusr@SERVER_IP
To install docker, check Step 1 and Step 2 in this guide:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-10
To install docker-compose, check Step 1 in this guide:
https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-debian-10
To install build-essentials:
sudo apt-get updatesudo apt-get install build-essential
Follow the installation guide for a single VM here: https://cloud.google.com/logging/docs/agent/installation#agent-install-debian-ubuntu
- Install the latest version of google-fluentd agent and make sure the installation command includes structured logging
--also-install - Update agent config:
sudo nano /etc/google-fluentd/google-fluentd.conf - Overwrite the contents of this file with those provided in repo at
/docs/google-fluentd.conf - Save and close
- Restart to apply changes
sudo service google-fluentd restart
Follow this guide: https://github.com/holdex/cloud-proxy#setup-new-production-like-environment
-
Create the directory:
mkdir backend && cd backend -
Copy the following files from the repo via Filezilla, or manually create with
nanocommand and copy/paste the content:Makefiledc-prod.yml.env.stageor.env.prodas.env
-
Get the following files from Mark/Vadim. Copy them into the same
backendfolder.gcs-credentials.jsonstackdriver-credentials.jsonfirebase-adminsdk.jsongcp-credentials.json
-
Create
.keysfolder andwebhooksfolder inside it. Copy the following file intowebhooksfolder..keys/webhooks/key.pem
-
Return to
backendfolder. Open.envfile. Update the following env variables with values given from Mark/Vadim:GQL_QUERY_SECRET_KEYDOMAIN_EVENTS_PUB_SUB_SQL_DSNUSER_IN_APP_NOTIFICATIONS_PUB_SUB_SQL_DSNUSER_IN_APP_NOTIFICATIONS_SQL_DSNEVENT_STORE_SQL_DSNRECAPTCHA_API_KEYEMAILS_SENDGRID_API_KEYEMAILS_SENDGRID_WEBHOOK_VERIFICATION_KEYSEGMENT_SECRETINTERCOM_IDENTITY_VERIFICATION_SECRETPUSHER_APP_IDPUSHER_APP_KEYPUSHER_APP_SECRETPUSHER_APP_CLUSTERPOSTHOG_PERSONAL_API_KEY
-
Update
DEPLOY_VERSIONin.envwith the latest docker image tag (commit column) from Google Cloud Build  -
Login into registry.gitlab.com:
docker login registry.gitlab.com -u holdex-gitlab
Ask Mark/Vadim for password
make prodp - This will just pull the docker image.
make prod - This will start de container.
Make sure the Orange cloud from CloudFlare is disabled initially. Enable it after the website is accessible.
- If there is issue with website access after enabling the
Orange Cloud, disable it and try accesing the website without the option.
https://github.com/holdex/cloud-proxy#5-generate-certificates
- Create an account
- Create a
Holdexcommunity in your local environment - In the
.envfile, set theHOLDEX_COMMUNITY_ID={HoldexCommunityID} - Restart the server