-
Notifications
You must be signed in to change notification settings - Fork 2
feature/deployment #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kdv1995
wants to merge
2
commits into
main
Choose a base branch
from
feature/deployment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,99 @@ | ||
| # How to deploy the Provider Backend Daemon with Postgres Database | ||
|
|
||
| This guide contains instructions on how to deploy the Provider Backend Daemon with a PostgreSQL database. | ||
| [Video Tutorial](https://drive.google.com/file/d/1QQN2bseW8NDRFpTBmCsek5xYWT37UfaC/view?usp=drive_link) | ||
|
|
||
| 1. [Create an account on Koyeb](#1-create-an-account-on-koyeb), | ||
| 2. [Create an account on Supabase](#2-create-an-account-on-supabase), | ||
| 1. [Enforce SSL connection](#21-enforce-ssl-connection), | ||
| 2. [Download the cert from Supabase](#22-download-the-cert-from-supabase), | ||
| 3. [Construct the connection string](#23-construct-the-connection-string), | ||
| 3. [Deploy the Provider Backend Daemon](#3-deploy-the-provider-backend-daemon). | ||
| 1. [Push current repo to your own GitHub account](#31-push-current-repo-to-your-own-github-account), | ||
| 2. [Deploy the Provider Backend Daemon on Koyeb](#32-deploy-the-provider-backend-daemon-on-koyeb). | ||
|
|
||
| ### 1. Create an account on Koyeb | ||
|
|
||
| > You can skip this part if you are already registered in Koyeb. | ||
|
|
||
| 1. Sign In / Sign Up to [Koyeb](https://www.koyeb.com/). | ||
|
|
||
| ### 2. Create an account on Supabase | ||
|
|
||
| 1. Sign In / Sign Up to [Supabase](https://supabase.io/). | ||
| 2. Create a project with Postgres database default configuration and with nearest region for you. | ||
|
|
||
| #### 2.1 Enforce SSL connection | ||
|
|
||
| 1. Choose your created project, go to the project settings and go to the configuration section to choose a database. Inside the database configuration page, go to | ||
| the SSL configuration section and **Enforce SSL on incoming connections** toggle to **ON** to allow secure connections to the database. | ||
|
|
||
|
kdv1995 marked this conversation as resolved.
|
||
| #### 2.2 Download the cert from Supabase | ||
|
|
||
| 2. Download the certificate from the SSL configuration section. | ||
| 3. Move this certificate in your forked provider-template repository into the /data folder. | ||
|
|
||
| - Example of how path should looks like: `[forked-template-name]/data/prod-ca-2021.cert` | ||
|
|
||
| #### 2.3 Construct the connection string | ||
|
|
||
| 1. Construct the connection string. For getting wide information you can go to [Supabase documentation](https://supabase.com/docs/guides/database/psql) | ||
|
|
||
| Example of how connection string should looks like: | ||
|
|
||
| ```env | ||
| postgresql://postgres.<supabase project ref>:<password>@aws-0-<region>.pooler.supabase.com:5432/postgres?sslmode=verify-full&sslrootcert=<docker container path to the cert> | ||
| ``` | ||
|
|
||
| > Since this file will be included within the container, the path should represents the container directory structure. | ||
|
|
||
| The ssl root cert path will be looking like this : | ||
|
|
||
| ```env | ||
| sslrootcert=/daemon/data/prod-ca-2021.crt | ||
| ``` | ||
|
|
||
| 2. Update the default DATABASE_URL in the `.env` file with the connection string. | ||
|
|
||
| Example of how connection string should looks like within .env: | ||
|
|
||
| ```env | ||
| DATABASE_URL=postgresql://postgres.<supabase project ref>:<password>@aws-0-<region>.pooler.supabase.com:5432/postgres?sslmode=verify-full&sslrootcert=<docker container path to the cert> | ||
| ``` | ||
|
|
||
| ### 3. Deploy the Provider Backend Daemon | ||
|
|
||
| #### 3.1 Push current repo to your own GitHub account | ||
|
|
||
| 1. Push the forked repository to your own GitHub account. | ||
|
|
||
| #### 3.2 Deploy the Provider Backend Daemon on Koyeb | ||
|
|
||
| 1. After sign in, hit the create service button | ||
| 2. Chose create web service with github | ||
| 3. Select the forked repository from the list | ||
| 4. Choose CPU Eco tab with a free tier deployment and hit next | ||
| 5. Choose the builder dropdown and select the Dockerfile | ||
| 6. Then go to the environment tab, click on raw editor and paste full config from .env file you have. | ||
|
kdv1995 marked this conversation as resolved.
|
||
|
|
||
| > Config depends on the variables that you would have defined for the current Protocol. For example: | ||
|
|
||
| ```env | ||
| NODE_ENV=production | ||
| RPC_HOST="" | ||
| CHAIN=optimism-sepolia | ||
| DATABASE_URL=<your connection string> | ||
| API_ENDPOINT=<> | ||
| API_KEY=<> | ||
| PROVIDER_PRIVATE_KEY_main=<your private key> | ||
| BILLING_PRIVATE_KEY_main=<your private key> | ||
| OPERATOR_PRIVATE_KEY_main=<your private key> | ||
| PORT=3000 | ||
| ``` | ||
|
|
||
| 7. Go to the expose ports, set 3000 as the port and path should be /health | ||
| 8. Than hit deploy and wait until finishing | ||
|
|
||
| > You can check the logs to see if the deployment was successful. | ||
|
|
||
| Congratulations! You have successfully deployed the Provider Backend Daemon with a PostgreSQL database. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.