Host osmosis app static build using python server
This commit is contained in:
parent
4e14220c28
commit
1d754a7c9b
@ -3,7 +3,24 @@ version: "3.2"
|
||||
services:
|
||||
osmosis-front-end:
|
||||
image: cerc/osmosis-front-end:local
|
||||
restart: always
|
||||
restart: on-failure
|
||||
environment:
|
||||
- NEXT_PUBLIC_WEB_API_BASE_URL=${CERC_WEB_API_BASE_URL}
|
||||
working_dir: /app/packages/web
|
||||
command: ["./build-app.sh"]
|
||||
volumes:
|
||||
- ../config/osmosis/build-app.sh:/app/packages/web/build-app.sh
|
||||
- app_builds:/app-builds
|
||||
|
||||
python-server:
|
||||
image: python:3
|
||||
depends_on:
|
||||
osmosis-front-end:
|
||||
condition: service_completed_successfully
|
||||
restart: on-failure
|
||||
command: ["python3", "-m", "http.server", "-d" ,"/app-builds/osmosis/build", "4000"]
|
||||
volumes:
|
||||
- app_builds:/app-builds
|
||||
ports:
|
||||
- "3000"
|
||||
healthcheck:
|
||||
@ -12,3 +29,6 @@ services:
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
volumes:
|
||||
app_builds:
|
||||
|
||||
18
stack_orchestrator/data/config/osmosis/build-app.sh
Executable file
18
stack_orchestrator/data/config/osmosis/build-app.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Check and exit if a deployment already exists (on restarts)
|
||||
if [ -d /app-builds/osmosis/build ]; then
|
||||
echo "Build already exists, remove volume to rebuild"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
yarn build:static
|
||||
|
||||
# Move build to app-builds
|
||||
mkdir /app-builds/osmosis
|
||||
cp -r ./out /app-builds/osmosis/build
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the osmosis front end image
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/osmosis-front-end:local -f ${CERC_REPO_BASE_DIR}/osmosis-frontend/docker/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/osmosis-frontend
|
||||
docker build -t cerc/osmosis-front-end:local -f ${CERC_REPO_BASE_DIR}/osmosis-frontend/docker/Dockerfile.static ${build_command_args} ${CERC_REPO_BASE_DIR}/osmosis-frontend
|
||||
|
||||
@ -39,15 +39,14 @@ Edit `network` in spec file to map container ports to same ports in host
|
||||
```
|
||||
...
|
||||
ports:
|
||||
osmosis-front-end:
|
||||
- '3000:3000'
|
||||
ipfs:
|
||||
- 0.0.0.0:8080:8080
|
||||
- 0.0.0.0:4001:4001
|
||||
- 0.0.0.0:5001:5001
|
||||
proxy-server:
|
||||
- '4000:4000'
|
||||
python-server:
|
||||
- '3000:3000'
|
||||
```
|
||||
|
||||
### Data volumes
|
||||
|
||||
Container data volumes are bind-mounted to specified paths in the host filesystem.
|
||||
The default setup (generated by `laconic-so deploy init`) places the volumes in the `./data` subdirectory of the deployment directory. The default mappings can be customized by editing the "spec" file generated by `laconic-so deploy init`.
|
||||
|
||||
@ -58,6 +57,31 @@ Once you've made any needed changes to the spec file, create a deployment from i
|
||||
laconic-so --stack osmosis deploy create --spec-file osmosis-spec.yml --deployment-dir osmosis-deployment
|
||||
```
|
||||
|
||||
## Set env variables
|
||||
|
||||
Inside the deployment directory, open the file `config.env` and set the following env variables:
|
||||
|
||||
```bash
|
||||
# Osmosis API base URL
|
||||
# Set this to proxy server endpoint for uniswap app
|
||||
# (Eg. http://localhost:4000)
|
||||
# (Eg. https://abc.xyz.com)
|
||||
CERC_WEB_API_BASE_URL=
|
||||
|
||||
# Optional
|
||||
|
||||
# TODO: Change to CERC_ENABLE_PROXY after rebase
|
||||
# Whether to run the proxy server
|
||||
# (Disable only if proxy not required to be run) (Default: true)
|
||||
ENABLE_PROXY=
|
||||
|
||||
# Proxy server configuration
|
||||
# Used only if proxy is enabled
|
||||
|
||||
# Upstream API URL
|
||||
CERC_PROXY_UPSTREAM=https://app.osmosis.zone
|
||||
```
|
||||
|
||||
## Start the stack
|
||||
|
||||
Start the deployment:
|
||||
|
||||
@ -5,14 +5,16 @@ repos:
|
||||
- git.vdb.to/cerc-io/hosting@names-for-so
|
||||
- gitea.com/gitea/act_runner
|
||||
# For osmosis frontend
|
||||
- github.com/osmosis-labs/osmosis-frontend
|
||||
- github.com/cerc-io/osmosis-frontend@ng-export-static # TODO: Update branch after merge
|
||||
containers:
|
||||
- cerc/act-runner
|
||||
- cerc/act-runner-task-executor
|
||||
- cerc/watcher-ts
|
||||
- cerc/osmosis-front-end
|
||||
pods:
|
||||
- osmosis-front-end
|
||||
- kubo
|
||||
- proxy-server
|
||||
- osmosis-front-end
|
||||
# TODO: Fix pod config for deployment command
|
||||
# TODO: mirroring all of osmosis repos: https://git.vdb.to/cerc-io/hosting/pulls/42
|
||||
# - name: gitea
|
||||
|
||||
Loading…
Reference in New Issue
Block a user