Build-in SeaweedFS support
This commit is contained in:
parent
f288e97760
commit
71034fbc7f
26
Dockerfile
26
Dockerfile
|
@ -1,4 +1,4 @@
|
||||||
FROM alpine:3.14 as intermediate
|
FROM alpine:3.15 as intermediate
|
||||||
|
|
||||||
RUN mkdir /src
|
RUN mkdir /src
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
@ -6,27 +6,31 @@ WORKDIR /src
|
||||||
# Install the build tools
|
# Install the build tools
|
||||||
RUN apk add git go make
|
RUN apk add git go make
|
||||||
|
|
||||||
# Fetch the source
|
# Fetch the Nebula source
|
||||||
RUN git clone https://github.com/slackhq/nebula.git
|
RUN git clone https://github.com/slackhq/nebula.git
|
||||||
|
|
||||||
# Compile the Linux binaries for all platforms
|
# Compile the Nebula GNU/Linux binaries for all platforms
|
||||||
WORKDIR /src/nebula
|
WORKDIR /src/nebula
|
||||||
RUN echo 'bin-linux: $(ALL_LINUX:%=build/%/nebula) $(ALL_LINUX:%=build/%/nebula-cert)' >> Makefile
|
RUN make bin
|
||||||
RUN make bin-linux
|
|
||||||
|
RUN go get github.com/chrislusf/seaweedfs/weed
|
||||||
|
|
||||||
# Start from a clean image
|
# Start from a clean image
|
||||||
FROM alpine:3.14
|
FROM alpine:3.15
|
||||||
|
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy over the compiled binaries
|
# Copy over the compiled binaries
|
||||||
COPY --from=intermediate /src/nebula/build ./
|
COPY --from=intermediate /src/nebula/nebula ./
|
||||||
|
COPY --from=intermediate /src/nebula/nebula-cert ./
|
||||||
|
COPY --from=intermediate /root/go/bin/weed ./
|
||||||
|
|
||||||
# Rename the directories from `go env` format to `uname` format
|
COPY nebula-start.sh ./
|
||||||
RUN mv linux-amd64 linux-x86_64
|
COPY seaweedfs-start.sh ./
|
||||||
|
COPY docker-entrypoint.sh ./entrypoint.sh
|
||||||
COPY docker-entrypoint.sh entrypoint.sh
|
|
||||||
|
|
||||||
EXPOSE 4242/udp
|
EXPOSE 4242/udp
|
||||||
|
EXPOSE 9333/tcp
|
||||||
|
EXPOSE 8080/tcp
|
||||||
ENTRYPOINT [ "/bin/sh", "/app/entrypoint.sh" ]
|
ENTRYPOINT [ "/bin/sh", "/app/entrypoint.sh" ]
|
||||||
|
|
|
@ -6,13 +6,14 @@ services:
|
||||||
image: dcr.wallace.sh/scott/infranet:latest
|
image: dcr.wallace.sh/scott/infranet:latest
|
||||||
volumes:
|
volumes:
|
||||||
- /path/to/infranet/config:/etc/nebula
|
- /path/to/infranet/config:/etc/nebula
|
||||||
|
- /path/to/infranet/filestore:/storage
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
devices:
|
devices:
|
||||||
- /dev/net/tun
|
- /dev/net/tun
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/London
|
- TZ=UTC
|
||||||
# A Lighthouse should be listening for incoming connections; but not nodes
|
- LIGHTHOUSE=true
|
||||||
# ports:
|
ports:
|
||||||
# - 4242:4242/udp
|
- 4242:4242/udp
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
17
docker-compose-node.yaml
Normal file
17
docker-compose-node.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
---
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
infranet:
|
||||||
|
container_name: infranet
|
||||||
|
image: dcr.wallace.sh/scott/infranet:latest
|
||||||
|
volumes:
|
||||||
|
- /path/to/infranet/config:/etc/nebula
|
||||||
|
- /path/to/infranet/filestore:/storage
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
devices:
|
||||||
|
- /dev/net/tun
|
||||||
|
environment:
|
||||||
|
- TZ=UTC
|
||||||
|
- LIGHTHOUSE=false
|
||||||
|
restart: unless-stopped
|
|
@ -1,24 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
ARCH=$(uname -m)
|
set -e
|
||||||
BIN_DIR=/app/linux-${ARCH}
|
|
||||||
DATA_DIR=/etc/nebula
|
|
||||||
|
|
||||||
# Build host certs if they don't exist
|
/app/nebula-start.sh
|
||||||
if ! test -f ${DATA_DIR}/host.crt; then
|
/app/seaweedfs-start.sh
|
||||||
cd ${DATA_DIR} || exit 1
|
|
||||||
# Generate a CSR if it doesn't already exist
|
|
||||||
if ! test -d ${DATA_DIR}/host.csr; then
|
|
||||||
"${BIN_DIR}/nebula-cert" keygen -out-key host.key -out-pub host.csr
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
echo 'You will need to get the `host.csr` file signed by a cluster admin'
|
|
||||||
exit 3
|
|
||||||
else
|
|
||||||
# shellcheck disable=SC2016
|
|
||||||
echo 'Awaiting for `host.csr` to be signed by a cluster admin'
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the platform-specific binary
|
|
||||||
"${BIN_DIR}/nebula" -config ${DATA_DIR}/config.yaml
|
|
||||||
|
|
23
nebula-start.sh
Normal file
23
nebula-start.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
BIN_DIR=/app
|
||||||
|
DATA_DIR=/etc/nebula
|
||||||
|
|
||||||
|
# Build host certs if they don't exist
|
||||||
|
if ! test -f ${DATA_DIR}/host.crt; then
|
||||||
|
cd ${DATA_DIR} || exit 1
|
||||||
|
# Generate a CSR if it doesn't already exist
|
||||||
|
if ! test -d ${DATA_DIR}/host.csr; then
|
||||||
|
"${BIN_DIR}/nebula-cert" keygen -out-key host.key -out-pub host.csr
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
echo 'You will need to get the `host.csr` file signed by a cluster admin'
|
||||||
|
exit 3
|
||||||
|
else
|
||||||
|
# shellcheck disable=SC2016
|
||||||
|
echo 'Awaiting for `host.csr` to be signed by a cluster admin'
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run the platform-specific binary
|
||||||
|
"${BIN_DIR}/nebula" -config ${DATA_DIR}/config.yaml
|
10
seaweedfs-start.sh
Normal file
10
seaweedfs-start.sh
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
NEBULA_IP=$(ip -f inet addr show nebula1 | awk '/inet / {print $2}' | cut -f1 -d'/')
|
||||||
|
SEAWEEDFS_MASTERS=10.10.100.1:9333 # Need an odd number #,10.10.100.21:9333
|
||||||
|
|
||||||
|
if test "${LIGHTHOUSE}" == "true"; then
|
||||||
|
weed master -ip="${NEBULA_IP}" -port=9333 -mdir=/storage -peers=${SEAWEEDFS_MASTERS}
|
||||||
|
else
|
||||||
|
weed volume -dir=/storage -port=8080 -mserver=${SEAWEEDFS_MASTERS}
|
||||||
|
fi
|
Loading…
Reference in a new issue