Skip to content

Commit

Permalink
docker: cleanup volumes, revert textile volume naming (#224)
Browse files Browse the repository at this point in the history
Signed-off-by: Sander Pick <[email protected]>
  • Loading branch information
sanderpick authored Jun 1, 2020
1 parent 32aeffc commit c24ebbe
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 32 deletions.
20 changes: 10 additions & 10 deletions cmd/buckd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ EXPOSE 4006
EXPOSE 8006

# Create the repo directory and switch to a non-privileged user.
ENV HUB_PATH /data/buck
RUN mkdir -p $HUB_PATH \
&& mkdir -p $HUB_PATH/logstore \
&& mkdir -p $HUB_PATH/eventstore \
&& mkdir -p $HUB_PATH/ipfslite \
&& adduser -D -h $HUB_PATH -u 1000 -G users buck \
&& chown -R buck:users $HUB_PATH
ENV BUCKETS_PATH /data/buckets
RUN mkdir -p $BUCKETS_PATH \
&& mkdir -p $BUCKETS_PATH/logstore \
&& mkdir -p $BUCKETS_PATH/eventstore \
&& mkdir -p $BUCKETS_PATH/ipfslite \
&& adduser -D -h $BUCKETS_PATH -u 1000 -G users buckets \
&& chown -R buckets:users $BUCKETS_PATH

# Switch to a non-privileged user
USER buck
USER buckets

# Expose the repo as a volume.
# Important this happens after the USER directive so permission are correct.
VOLUME $HUB_PATH
VOLUME $BUCKETS_PATH

ENTRYPOINT ["/sbin/tini", "--", "buckd"]

CMD ["--repo=/data/buck"]
CMD ["--repo=/data/buckets"]
5 changes: 4 additions & 1 deletion cmd/buckd/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "3"
services:
buck:
buckets:
build: .
environment:
- BUCK_ADDR_API=/ip4/0.0.0.0/tcp/3006
Expand All @@ -9,7 +9,10 @@ services:
- BUCK_ADDR_GATEWAY_HOST=/ip4/0.0.0.0/tcp/8006
- BUCK_ADDR_MONGO_URI=mongodb://mongo:27017
- BUCK_ADDR_IPFS_API=/dns4/ipfs/tcp/5001
- BUCK_ADDR_POWERGATE_API
- BUCK_GATEWAY_SUBDOMAINS
- BUCK_LOG_DEBUG=true
- BUCK_LOG_FILE
ports:
- "127.0.0.1:3006:3006"
- "3007:3007"
Expand Down
6 changes: 3 additions & 3 deletions cmd/buckd/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: "3"
services:
buck:
buckets:
image: textile/textile:buckets
restart: always
volumes:
- "${REPO_PATH}/buck:/data/buck"
- "${REPO_PATH}/buckets:/data/buckets"
environment:
- BUCK_ADDR_API=/ip4/0.0.0.0/tcp/3006
- BUCK_ADDR_API_PROXY=/ip4/0.0.0.0/tcp/3007
Expand All @@ -13,8 +13,8 @@ services:
- BUCK_ADDR_GATEWAY_URL
- BUCK_ADDR_MONGO_URI
- BUCK_ADDR_IPFS_API=/dns4/ipfs/tcp/5001
- BUCK_ADDR_POWERGATE_API
- BUCK_GATEWAY_SUBDOMAINS
- BUCK_EMAIL_API_KEY
- BUCK_DNS_DOMAIN
- BUCK_DNS_ZONE_ID
- BUCK_DNS_TOKEN
Expand Down
20 changes: 10 additions & 10 deletions cmd/hubd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ EXPOSE 4006
EXPOSE 8006

# Create the repo directory and switch to a non-privileged user.
ENV HUB_PATH /data/hub
RUN mkdir -p $HUB_PATH \
&& mkdir -p $HUB_PATH/logstore \
&& mkdir -p $HUB_PATH/eventstore \
&& mkdir -p $HUB_PATH/ipfslite \
&& adduser -D -h $HUB_PATH -u 1000 -G users hub \
&& chown -R hub:users $HUB_PATH
ENV TEXTILE_PATH /data/textile
RUN mkdir -p $TEXTILE_PATH \
&& mkdir -p $TEXTILE_PATH/logstore \
&& mkdir -p $TEXTILE_PATH/eventstore \
&& mkdir -p $TEXTILE_PATH/ipfslite \
&& adduser -D -h $TEXTILE_PATH -u 1000 -G users textile \
&& chown -R textile:users $TEXTILE_PATH

# Switch to a non-privileged user
USER hub
USER textile

# Expose the repo as a volume.
# Important this happens after the USER directive so permission are correct.
VOLUME $HUB_PATH
VOLUME $TEXTILE_PATH

ENTRYPOINT ["/sbin/tini", "--", "hubd"]

CMD ["--repo=/data/hub"]
CMD ["--repo=/data/textile"]
5 changes: 4 additions & 1 deletion cmd/hubd/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "3"
services:
hub:
textile:
build: .
environment:
- HUB_ADDR_API=/ip4/0.0.0.0/tcp/3006
Expand All @@ -9,8 +9,11 @@ services:
- HUB_ADDR_GATEWAY_HOST=/ip4/0.0.0.0/tcp/8006
- HUB_ADDR_MONGO_URI=mongodb://mongo:27017
- HUB_ADDR_IPFS_API=/dns4/ipfs/tcp/5001
- HUB_ADDR_POWERGATE_API
- HUB_GATEWAY_SUBDOMAINS
- HUB_EMAIL_SESSION_SECRET=hubsession
- HUB_LOG_DEBUG=true
- HUB_LOG_FILE
ports:
- "127.0.0.1:3006:3006"
- "3007:3007"
Expand Down
5 changes: 3 additions & 2 deletions cmd/hubd/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: "3"
services:
hub:
textile:
image: textile/textile:latest
restart: always
volumes:
- "${REPO_PATH}/hub:/data/hub"
- "${REPO_PATH}/textile:/data/textile"
environment:
- HUB_ADDR_API=/ip4/0.0.0.0/tcp/3006
- HUB_ADDR_API_PROXY=/ip4/0.0.0.0/tcp/3007
Expand All @@ -13,6 +13,7 @@ services:
- HUB_ADDR_GATEWAY_URL
- HUB_ADDR_MONGO_URI
- HUB_ADDR_IPFS_API=/dns4/ipfs/tcp/5001
- HUB_ADDR_POWERGATE_API
- HUB_GATEWAY_SUBDOMAINS
- HUB_EMAIL_API_KEY
- HUB_DNS_DOMAIN
Expand Down
10 changes: 5 additions & 5 deletions cmd/hubd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ var (
Key: "addr.ipfs.api",
DefValue: "/ip4/127.0.0.1/tcp/5001",
},
"addrFilecoinApi": {
Key: "addr.filecoin.api",
"addrPowergateApi": {
Key: "addr.powergate.api",
DefValue: "",
},
"addrMongoUri": {
Expand Down Expand Up @@ -259,14 +259,14 @@ var rootCmd = &cobra.Command{
addrThreadsHost := cmd.AddrFromStr(config.Viper.GetString("addr.threads.host"))
addrIpfsApi := cmd.AddrFromStr(config.Viper.GetString("addr.ipfs.api"))

addrGatewayHost := cmd.AddrFromStr(config.Viper.GetString("addr.gateway.host"))
addrGatewayUrl := config.Viper.GetString("addr.gateway.url")

var addrPowergateApi ma.Multiaddr
if str := config.Viper.GetString("addr.powergate.api"); str != "" {
addrPowergateApi = cmd.AddrFromStr(str)
}

addrGatewayHost := cmd.AddrFromStr(config.Viper.GetString("addr.gateway.host"))
addrGatewayUrl := config.Viper.GetString("addr.gateway.url")

addrMongoUri := config.Viper.GetString("addr.mongo_uri")

dnsDomain := config.Viper.GetString("dns.domain")
Expand Down

0 comments on commit c24ebbe

Please sign in to comment.