-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: supervisord files for dal * feat: add task * feat: add example env file * fix: update based on feedbacks
- Loading branch information
1 parent
99409d4
commit 1f8c521
Showing
4 changed files
with
118 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DAL_API_PORT= | ||
KAIA_PROVIDER_URL= | ||
KAIA_WEBSOCKET_URL= | ||
SUBMISSION_PROXY_CONTRACT= | ||
REDIS_HOST= | ||
REDIS_PORT= | ||
SUB_REDIS_HOST= | ||
SUB_REDIS_PORT= | ||
CHAIN= | ||
POST_TO_LOGSCRIBE= | ||
LOGSCRIBE_ENDPOINT= | ||
DATABASE_URL= | ||
API_KEY= |
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,94 @@ | ||
# Supervisor | ||
|
||
## Knowledge base | ||
|
||
- All binaries are stored in `~/bin` directory (directory is automatically created during build step) | ||
- All environment files are stored in `~/bin` directory | ||
- All logs are stores in `~/log` directory (directory must be manually created) | ||
|
||
## Prerequisities | ||
|
||
All prerequisities are supposed to be done only once when setting up the VM. | ||
|
||
### Install gcc | ||
|
||
```shell | ||
sudo apt install gcc | ||
``` | ||
|
||
### Install Go (go1.21.5) | ||
|
||
```shell | ||
cd ~ | ||
mkdir go | ||
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz | ||
|
||
sudo rm -rf /usr/local/go | ||
sudo tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz | ||
``` | ||
|
||
Set path to go binary | ||
|
||
```shell | ||
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc | ||
``` | ||
|
||
### Install supervisor | ||
|
||
Ubuntu | ||
|
||
```shell | ||
sudo apt install supervisor | ||
``` | ||
|
||
MacOS | ||
|
||
```shell | ||
brew install supervisor | ||
``` | ||
|
||
### Create log directory | ||
|
||
```shell | ||
mkdir ~/log | ||
``` | ||
|
||
## First-time deployment | ||
|
||
1. Fetch git tag representing the version of the service you are going to deploy. | ||
|
||
```shell | ||
git fetch --all --tags --prune | ||
git checkout tags/<tag_name> | ||
``` | ||
|
||
2. Build binary of the service to be deployed (e.g. call `task local:dal-build` to create `dal` in `~/bin/`) | ||
3. Create symlink from `supervisor/*.conf` file to `/etc/supervisor/conf.d/*.conf` (MacOS uses `/opt/homebrew/etc/supervisor.d/*.conf`) | ||
4. Create symlink to (or copy) `.env.*` file (`.env` file is in format `.env.service_name`) to `~/bin` | ||
5. Launch service through supervisor | ||
|
||
```shell | ||
supervisorctl | ||
reread | ||
update | ||
``` | ||
|
||
## Update | ||
|
||
1. Fetch git tag representing the version of the service you are going to deploy. | ||
|
||
```shell | ||
git fetch --all --tags --prune | ||
git checkout tags/<tag_name> | ||
``` | ||
|
||
2. Build binary of the service to be deployed (e.g. call `task local:dal-build` to create `dal` in `~/bin/`) | ||
3. Update `*.conf` if necessary | ||
4. Update `.env.*` if necessary | ||
5. Launch service through supervisor | ||
|
||
```shell | ||
supervisorctl | ||
reread | ||
update | ||
``` |
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,7 @@ | ||
[program:dal] | ||
command=%(HOME)s/bin/dal -env %(HOME)s/bin/.env.dal | ||
directory=%(HOME)s/bin | ||
autostart=true | ||
autorestart=true | ||
stderr_logfile=%(HOME)s/log/dal.err.log | ||
stdout_logfile=%(HOME)s/log/dal.out.log |