forked from cerc-io/stack-orchestrator
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88db2ff766 | ||
|
|
5f556e127a | ||
|
|
926997b21c | ||
|
|
0d91a62f84 | ||
|
|
7d27eaef0f | ||
|
|
8ad2b692ec | ||
|
|
54cc993fa4 |
@@ -2,7 +2,7 @@ version: "3.2"
|
|||||||
# See: https://docs.ipfs.tech/install/run-ipfs-inside-docker/#set-up
|
# See: https://docs.ipfs.tech/install/run-ipfs-inside-docker/#set-up
|
||||||
services:
|
services:
|
||||||
ipfs:
|
ipfs:
|
||||||
image: ipfs/kubo:master-2023-02-20-714a968
|
image: ipfs/kubo:v0.24.0
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./ipfs/import:/import
|
- ./ipfs/import:/import
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
version: "3.2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
osmosis-front-end:
|
||||||
|
image: cerc/osmosis-front-end:local
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "3002:3002" #TODO make `3000` when using the deployment feature
|
||||||
@@ -39,4 +39,4 @@ EXPOSE 3000
|
|||||||
COPY /scripts /scripts
|
COPY /scripts /scripts
|
||||||
|
|
||||||
# Default command sleeps forever so docker doesn't kill it
|
# Default command sleeps forever so docker doesn't kill it
|
||||||
ENTRYPOINT ["/scripts/start-serving-app.sh"]
|
CMD ["/scripts/start-serving-app.sh"]
|
||||||
|
|||||||
@@ -11,19 +11,3 @@ CERC_CONTAINER_BUILD_DOCKERFILE=${CERC_CONTAINER_BUILD_DOCKERFILE:-$SCRIPT_DIR/D
|
|||||||
CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/nextjs-base:local}
|
CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/nextjs-base:local}
|
||||||
|
|
||||||
docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR
|
docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR
|
||||||
|
|
||||||
if [ $? -eq 0 ] && [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/nextjs-base:local" ]; then
|
|
||||||
cat <<EOF
|
|
||||||
|
|
||||||
#################################################################
|
|
||||||
|
|
||||||
Built host container for $CERC_CONTAINER_BUILD_WORK_DIR with tag:
|
|
||||||
|
|
||||||
$CERC_CONTAINER_BUILD_TAG
|
|
||||||
|
|
||||||
To test locally run:
|
|
||||||
|
|
||||||
docker run -p 3000:3000 --env-file /path/to/environment.env $CERC_CONTAINER_BUILD_TAG
|
|
||||||
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ for f in $(find "$TRG_DIR" -regex ".*.[tj]sx?$" -type f | grep -v 'node_modules'
|
|||||||
orig_name=$(echo -n "${e}" | sed 's/"//g')
|
orig_name=$(echo -n "${e}" | sed 's/"//g')
|
||||||
cur_name=$(echo -n "${orig_name}" | sed 's/CERC_RUNTIME_ENV_//g')
|
cur_name=$(echo -n "${orig_name}" | sed 's/CERC_RUNTIME_ENV_//g')
|
||||||
cur_val=$(echo -n "\$${cur_name}" | envsubst)
|
cur_val=$(echo -n "\$${cur_name}" | envsubst)
|
||||||
if [ "$CERC_RETAIN_ENV_QUOTES" != "true" ]; then
|
|
||||||
cur_val=$(sed "s/^[\"']//" <<< "$cur_val" | sed "s/[\"']//")
|
|
||||||
fi
|
|
||||||
esc_val=$(sed 's/[&/\]/\\&/g' <<< "$cur_val")
|
esc_val=$(sed 's/[&/\]/\\&/g' <<< "$cur_val")
|
||||||
echo "$f: $cur_name=$cur_val"
|
echo "$f: $cur_name=$cur_val"
|
||||||
sed -i "s/$orig_name/$esc_val/g" $f
|
sed -i "s/$orig_name/$esc_val/g" $f
|
||||||
|
|||||||
+7
-25
@@ -3,16 +3,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
CERC_MAX_GENERATE_TIME=${CERC_MAX_GENERATE_TIME:-60}
|
|
||||||
tpid=""
|
|
||||||
|
|
||||||
ctrl_c() {
|
|
||||||
kill $tpid $(ps -ef | grep node | grep next | awk '{print $2}') 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
trap ctrl_c INT
|
|
||||||
|
|
||||||
CERC_BUILD_TOOL="${CERC_BUILD_TOOL}"
|
CERC_BUILD_TOOL="${CERC_BUILD_TOOL}"
|
||||||
if [ -z "$CERC_BUILD_TOOL" ]; then
|
if [ -z "$CERC_BUILD_TOOL" ]; then
|
||||||
@@ -34,27 +25,18 @@ if [ "$CERC_NEXTJS_SKIP_GENERATE" != "true" ]; then
|
|||||||
jq -e '.scripts.cerc_generate' package.json >/dev/null
|
jq -e '.scripts.cerc_generate' package.json >/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
npm run cerc_generate > gen.out 2>&1 &
|
npm run cerc_generate > gen.out 2>&1 &
|
||||||
tail -f gen.out &
|
tail -n0 -f gen.out | sed '/rendered as static HTML/ q'
|
||||||
tpid=$!
|
|
||||||
|
|
||||||
count=0
|
count=0
|
||||||
generate_done="false"
|
while [ $count -lt 10 ]; do
|
||||||
while [ $count -lt $CERC_MAX_GENERATE_TIME ] && [ "$generate_done" == "false" ]; do
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
ps -ef | grep 'node' | grep 'next' | grep 'generate' >/dev/null
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
break
|
||||||
|
else
|
||||||
count=$((count + 1))
|
count=$((count + 1))
|
||||||
grep 'rendered as static HTML' gen.out > /dev/null
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
generate_done="true"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
kill $(ps -ef |grep node | grep next | grep generate | awk '{print $2}') 2>/dev/null
|
||||||
if [ $generate_done != "true" ]; then
|
|
||||||
echo "ERROR: 'npm run cerc_generate' not successful within CERC_MAX_GENERATE_TIME" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
kill $tpid $(ps -ef | grep node | grep next | grep generate | awk '{print $2}') 2>/dev/null
|
|
||||||
tpid=""
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +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
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# self-hosted osmosis
|
||||||
|
|
||||||
|
Build and deploy:
|
||||||
|
- 1) self-hosted gitea,
|
||||||
|
- 2) an ipfs node,
|
||||||
|
- 3) the osmosis front end,
|
||||||
|
- 4) a laconicd chain
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
# support image for the gitea package registry
|
||||||
|
laconic-so --stack build-support build-containers
|
||||||
|
|
||||||
|
# todo: pre-run clone
|
||||||
|
|
||||||
|
# clones and builds several things
|
||||||
|
laconic-so --stack osmosis setup-repositories
|
||||||
|
laconic-so --stack osmosis build-containers
|
||||||
|
laconic-so --stack osmosis deploy up
|
||||||
|
```
|
||||||
|
|
||||||
|
Setup a test chain:
|
||||||
|
```
|
||||||
|
export CERC_NPM_REGISTRY_URL=https://git.vdb.to/api/packages/cerc-io/npm/
|
||||||
|
|
||||||
|
laconic-so --stack fixturenet-laconic-loaded setup-repositories --include git.vdb.to/cerc-io/laconicd,git.vdb.to/cerc-io/laconic-sdk,git.vdb.to/cerc-io/laconic-registry-cli,git.vdb.to/cerc-io/laconic-console
|
||||||
|
|
||||||
|
laconic-so --stack fixturenet-laconic-loaded build-containers
|
||||||
|
|
||||||
|
export LACONIC_HOSTED_ENDPOINT=http://<your-IP>
|
||||||
|
|
||||||
|
laconic-so --stack fixturenet-laconic-loaded deploy up
|
||||||
|
```
|
||||||
|
|
||||||
|
then `docker exec` into the `laconicd` container and either export the private key or create a new one and send funds to it. Use that private key for `LACONIC_HOTWALLET_KEY`.
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
version: "0.1"
|
||||||
|
name: osmosis
|
||||||
|
repos:
|
||||||
|
# these are for gitea
|
||||||
|
- git.vdb.to/cerc-io/hosting@names-for-so
|
||||||
|
- gitea.com/gitea/act_runner
|
||||||
|
# add the osmosis FE
|
||||||
|
- github.com/osmosis-labs/osmosis-frontend
|
||||||
|
containers:
|
||||||
|
- cerc/act-runner
|
||||||
|
- cerc/act-runner-task-executor
|
||||||
|
# note: osmosis builds but doesn't run
|
||||||
|
- cerc/osmosis-front-end
|
||||||
|
pods:
|
||||||
|
- name: gitea
|
||||||
|
repository: cerc-io/hosting
|
||||||
|
path: gitea
|
||||||
|
pre_start_command: "run-this-first.sh"
|
||||||
|
post_start_command: "initialize-gitea.sh"
|
||||||
|
# todo, e.g., mirroring all of osmosis repos: https://git.vdb.to/cerc-io/hosting/pulls/42
|
||||||
|
- name: act-runner
|
||||||
|
repository: cerc-io/hosting
|
||||||
|
path: act-runner
|
||||||
|
pre_start_command: "pre_start.sh"
|
||||||
|
post_start_command: "post_start.sh"
|
||||||
|
- osmosis-front-end
|
||||||
|
- kubo
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Dump environment variables for debugging
|
# Dump environment variables for debugging
|
||||||
echo "Environment variables:"
|
echo "Environment variables:"
|
||||||
env
|
env
|
||||||
@@ -30,18 +28,16 @@ CHECK="SPECIAL_01234567890_TEST_STRING"
|
|||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
CONTAINER_ID=$(docker run -p 3000:3000 -d -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG cerc/test-progressive-web-app:local)
|
CONTAINER_ID=$(docker run -p 3000:3000 -d cerc/test-progressive-web-app:local)
|
||||||
sleep 3
|
sleep 3
|
||||||
wget -t 7 -O test.before -m http://localhost:3000
|
wget -O test.before -m http://localhost:3000
|
||||||
|
|
||||||
docker logs $CONTAINER_ID
|
|
||||||
docker remove -f $CONTAINER_ID
|
docker remove -f $CONTAINER_ID
|
||||||
|
|
||||||
CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -e CERC_SCRIPT_DEBUG=$CERC_SCRIPT_DEBUG -d cerc/test-progressive-web-app:local)
|
CONTAINER_ID=$(docker run -p 3000:3000 -e CERC_WEBAPP_DEBUG=$CHECK -d cerc/test-progressive-web-app:local)
|
||||||
sleep 3
|
sleep 3
|
||||||
wget -t 7 -O test.after -m http://localhost:3000
|
wget -O test.after -m http://localhost:3000
|
||||||
|
|
||||||
docker logs $CONTAINER_ID
|
|
||||||
docker remove -f $CONTAINER_ID
|
docker remove -f $CONTAINER_ID
|
||||||
|
|
||||||
echo "###########################################################################"
|
echo "###########################################################################"
|
||||||
|
|||||||
Reference in New Issue
Block a user