Attempt at fixing the all-in-one environment (#736)
This commit is contained in:
parent
6c655d117b
commit
4237afb1c1
11
Makefile
11
Makefile
@ -81,19 +81,20 @@ test-docker: ## Run tests in Docker
|
||||
.PHONY: all-in-one
|
||||
all-in-one: ## Deploy docker images with one storagenode locally
|
||||
if [ -z "${VERSION}" ]; then \
|
||||
$(MAKE) images -j 3 \
|
||||
$(MAKE) satellite-image storagenode-image gateway-image -j 3 \
|
||||
&& export VERSION="${TAG}"; \
|
||||
fi \
|
||||
&& docker-compose up -d storagenode \
|
||||
&& scripts/fix-mock-overlay \
|
||||
&& docker-compose up storagenode satellite uplink
|
||||
&& docker-compose up storagenode satellite gateway
|
||||
|
||||
##@ Build
|
||||
|
||||
.PHONY: images
|
||||
images: satellite-image storagenode-image uplink-image ## Build satellite, storagenode, and uplink Docker images
|
||||
images: satellite-image storagenode-image uplink-image gateway-image ## Build gateway, satellite, storagenode, and uplink Docker images
|
||||
echo Built version: ${TAG}
|
||||
|
||||
.PHONY: gateway-image
|
||||
gateway-image: ## Build gateway Docker image
|
||||
${DOCKER_BUILD} -t storjlabs/gateway:${TAG}${CUSTOMTAG} -f cmd/gateway/Dockerfile .
|
||||
.PHONY: satellite-image
|
||||
satellite-image: ## Build satellite Docker image
|
||||
${DOCKER_BUILD} -t storjlabs/satellite:${TAG}${CUSTOMTAG} -f cmd/satellite/Dockerfile .
|
||||
|
@ -16,18 +16,21 @@ following:
|
||||
Export the version of the network you want to run. Latest should be ok, but
|
||||
if you're testing something else, set the version here. ex: `c6cd912-all-in-one-go1.10`
|
||||
Usable images should be pushed to the Docker Hub:
|
||||
- https://hub.docker.com/r/storjlabs/storage-node/tags/
|
||||
- https://hub.docker.com/r/storjlabs/gateway/tags/
|
||||
- https://hub.docker.com/r/storjlabs/storagenode/tags/
|
||||
- https://hub.docker.com/r/storjlabs/satellite/tags/
|
||||
- https://hub.docker.com/r/storjlabs/uplink/tags/
|
||||
|
||||
3. `docker-compose up -d storage-node`
|
||||
Create the first storage node.
|
||||
|
||||
4. `scripts/fix-mock-overlay`
|
||||
Fix the mock-overlay flag for the satellite. This is needed until the overlay
|
||||
network is populated from kademlia correctly.
|
||||
|
||||
5. `docker-compose up satellite uplink`
|
||||
Bring up the satellite and uplink
|
||||
5. `docker-compose up satellite storagenode gateway`
|
||||
Bring up the gateway, satellite, and 1 storagenode
|
||||
|
||||
6. Visit http://localhost:7777 or use the aws tool with `--endpoint=http://localhost:7777`
|
||||
|
||||
Troubleshooting
|
||||
---------------
|
||||
|
||||
Soemtimes, the overlay cache gets confused and has old nodes in it. This will
|
||||
need to be cleared. It's easiest to just remove the redis container completely.
|
||||
```
|
||||
docker-compose stop redis
|
||||
docker-compose rm redis
|
||||
```
|
||||
|
16
cmd/gateway/Dockerfile
Normal file
16
cmd/gateway/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
ARG CGO_ENABLED=1
|
||||
ARG REPOSITORY=../storj.io/storj
|
||||
ARG PACKAGE=storj.io/storj/cmd/gateway
|
||||
FROM storjlabs/golang as build-env
|
||||
|
||||
# final stage
|
||||
FROM alpine
|
||||
ENV CONF_PATH=/root/.local/share/storj/uplink/config.yaml \
|
||||
API_KEY= \
|
||||
SATELLITE_ADDR=
|
||||
EXPOSE 7776/udp \
|
||||
7777
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app /app/gateway
|
||||
COPY cmd/gateway/entrypoint /entrypoint
|
||||
ENTRYPOINT ["/entrypoint"]
|
19
cmd/gateway/entrypoint
Executable file
19
cmd/gateway/entrypoint
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ! -f "${CONF_PATH}" ]]; then
|
||||
./gateway setup
|
||||
fi
|
||||
|
||||
RUN_PARAMS="${RUN_PARAMS:-} --config ${CONF_PATH}"
|
||||
|
||||
if [[ -n "${API_KEY}" ]]; then
|
||||
RUN_PARAMS="${RUN_PARAMS} --api-key ${API_KEY}"
|
||||
fi
|
||||
|
||||
if [ -n "${SATELLITE_ADDR:-}" ]; then
|
||||
RUN_PARAMS="${RUN_PARAMS} --overlay-addr $SATELLITE_ADDR"
|
||||
RUN_PARAMS="${RUN_PARAMS} --pointer-db-addr $SATELLITE_ADDR"
|
||||
fi
|
||||
|
||||
exec ./gateway run $RUN_PARAMS "$@"
|
@ -6,7 +6,7 @@ FROM storjlabs/golang as build-env
|
||||
# final stage
|
||||
FROM alpine
|
||||
ENV API_KEY= \
|
||||
CONF_PATH=/root/.storj/satellite/config.yaml \
|
||||
CONF_PATH=/root/.local/share/storj/satellite/config.yaml \
|
||||
OVERLAY_URL=redis://redis:6379/?db=0 \
|
||||
IDENTITY_ADDR=:7777 \
|
||||
BOOTSTRAP_ADDR=bootstrap.storj.io:8080 \
|
||||
|
@ -108,8 +108,8 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||
grpcauth.NewAPIKeyInterceptor(),
|
||||
runCfg.Kademlia,
|
||||
runCfg.PointerDB,
|
||||
runCfg.Overlay,
|
||||
runCfg.StatDB,
|
||||
runCfg.Overlay,
|
||||
runCfg.Checker,
|
||||
runCfg.Repairer,
|
||||
// runCfg.Audit,
|
||||
|
@ -5,7 +5,7 @@ FROM storjlabs/golang as build-env
|
||||
|
||||
# final stage
|
||||
FROM alpine
|
||||
ENV CONF_PATH=/root/.storj/storagenode/config.yaml \
|
||||
ENV CONF_PATH=/root/.local/share/storj/storagenode/config.yaml \
|
||||
SATELLITE_ADDR=
|
||||
EXPOSE 7776/udp \
|
||||
7777
|
||||
|
@ -15,33 +15,41 @@ services:
|
||||
- POSTGRES_USER=storj
|
||||
- POSTGRES_PASSWORD=storj-pass
|
||||
|
||||
storagenode:
|
||||
image: storjlabs/storagenode:${VERSION}
|
||||
environment:
|
||||
- SATELLITE_ADDR=satellite:7777
|
||||
- STORJ_LOG_LEVEL=info
|
||||
links:
|
||||
- satellite
|
||||
satellite:
|
||||
image: storjlabs/satellite:${VERSION}
|
||||
environment:
|
||||
- API_KEY=abc123
|
||||
- BOOTSTRAP_ADDR=localhost:8080
|
||||
- IDENTITY_ADDR=:7777
|
||||
- STORJ_MOCK_OVERLAY_NODES=INTENTIONALLY:LEFT:BLANK
|
||||
- STORJ_LOG_LEVEL=info
|
||||
- IDENTITY_ADDR=satellite:7777
|
||||
- STORJ_LOG_LEVEL=debug
|
||||
- STORJ_CHECKER_QUEUE_ADDRESS=redis://redis:6379/?db=1
|
||||
- STORJ_REPAIRER_QUEUE_ADDRESS=redis://redis:6379/?db=1
|
||||
restart: always
|
||||
links:
|
||||
- redis
|
||||
depends_on:
|
||||
- redis
|
||||
redis:
|
||||
image: redis
|
||||
uplink:
|
||||
image: storjlabs/uplink:${VERSION}
|
||||
command: --min-threshold 1 --max-threshold 1 --repair-threshold 1 --success-threshold 1
|
||||
storagenode:
|
||||
image: storjlabs/storagenode:${VERSION}
|
||||
environment:
|
||||
- SATELLITE_ADDR=satellite:7777
|
||||
- STORJ_LOG_LEVEL=debug
|
||||
- STORJ_IDENTITY_ADDRESS=storagenode:7777
|
||||
restart: always
|
||||
links:
|
||||
- satellite
|
||||
gateway:
|
||||
image: storjlabs/gateway:${VERSION}
|
||||
command: --min-threshold 1 --max-threshold 2 --repair-threshold 1 --success-threshold 1
|
||||
environment:
|
||||
- API_KEY=abc123
|
||||
- SATELLITE_ADDR=satellite:7777
|
||||
- STORJ_LOG_LEVEL=info
|
||||
- STORJ_LOG_LEVEL=debug
|
||||
ports:
|
||||
- 7777:7777
|
||||
restart: always
|
||||
links:
|
||||
- satellite
|
||||
- storagenode
|
||||
redis:
|
||||
image: redis
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/zeebo/errs"
|
||||
"go.uber.org/zap"
|
||||
"gopkg.in/spacemonkeygo/monkit.v2"
|
||||
|
||||
monkit "gopkg.in/spacemonkeygo/monkit.v2"
|
||||
"storj.io/storj/pkg/kademlia"
|
||||
"storj.io/storj/pkg/pb"
|
||||
"storj.io/storj/pkg/provider"
|
||||
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
ids="$(
|
||||
for cid in $(docker ps -a | awk '/storagenode/{print $1}'); do
|
||||
ip="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $cid)"
|
||||
id="$(docker logs $cid 2>&1 | awk '/started/{print $4; exit}')"
|
||||
echo $id:$ip:7777
|
||||
done | tr '\n' ','
|
||||
)"
|
||||
sed -i'' -e "s/NODES=.*$/NODES=${ids%,}/" docker-compose.yaml
|
Loading…
Reference in New Issue
Block a user