diff --git a/Dockerfile.dev b/Dockerfile.dev index 6a493072..2827e8a2 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM --platform=linux/amd64 golang:alpine as build +FROM --platform=linux/amd64 golang:alpine AS build RUN apk add --no-cache gcc musl-dev @@ -11,25 +11,19 @@ ENV DEST=volumes/modules RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_set/module_set.so ./internal/volumes/modules/module_set/module_set.go RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -o $DEST/module_get/module_get.so ./internal/volumes/modules/module_get/module_get.go -ENV DEST=bin/linux/x86_64 +ENV DEST=bin RUN CGO_ENABLED=$CGO_ENABLED CC=$CC GOOS=$GOOS GOARCH=$GOARCH go build -o $DEST/server . -FROM --platform=linux/amd64 alpine:latest as server - -RUN mkdir -p /usr/local/lib/echovault -RUN mkdir -p /opt/echovault/bin -RUN mkdir -p /etc/ssl/certs/echovault/echovault -RUN mkdir -p /etc/ssl/certs/echovault/client +FROM --platform=linux/amd64 alpine:latest AS server COPY --from=build /build/volumes/modules /opt/echovault/bin/modules -COPY --from=build /build/bin/linux/x86_64/server /opt/echovault/bin - +COPY --from=build /build/bin/server /usr/echovault/bin COPY ./openssl/server /etc/ssl/certs/echovault/server COPY ./openssl/client /etc/ssl/certs/echovault/client -WORKDIR /opt/echovault/bin +WORKDIR /usr/echovault/bin CMD "./server" \ "--bind-addr" "${BIND_ADDR}" \ diff --git a/Dockerfile.prod b/Dockerfile.prod index 04cb3fbc..1a7db699 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -1,34 +1,11 @@ -FROM homebrew/brew:latest +FROM --platform=linux/amd64 golang:alpine AS build +RUN apk add --no-cache gcc musl-dev +WORKDIR /build +COPY . ./ +RUN CGO_ENABLED=1 CC=gcc GOOS=linux GOARCH=amd64 go build -o bin/server . -RUN brew tap echovault/echovault -RUN brew install echovault/echovault/echovault - -ENV PORT=7480 -ENV RAFT_PORT=8000 -ENV ML_PORT=7946 -ENV SERVER_ID=1 -ENV PLUGIN_DIR=/usr/local/lib/echovault -ENV DATA_DIR=/var/lib/echovault -ENV TLS=false -ENV MTLS=false -ENV BOOTSTRAP_CLUSTER=false -ENV ACL_CONFIG=/etc/echovault/config/acl.yml -ENV REQUIRE_PASS=false -ENV PASSWORD=password1 -ENV FORWARD_COMMAND=false -ENV SNAPSHOT_THRESHOLD=1000 -ENV SNAPSHOT_INTERVAL=5m30s -ENV RESTORE_SNAPSHOT=true -ENV RESTORE_AOF=false -ENV AOF_SYNC_STRATEGY=everysec -ENV MAX_MEMORY=2000kb -ENV EVICTION_POLICY=noeviction -ENV EVICTION_SAMPLE=20 -ENV EVICTION_INTERVAL=100ms -# List of echovault cert/key pairs -ENV CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/echovault/server1.crt,/etc/ssl/certs/echovault/echovault/server1.key -ENV CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/echovault/server2.crt,/etc/ssl/certs/echovault/echovault/server2.key -# List of client certificate authorities -ENV CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt - -ENTRYPOINT ["EchoVault"] +FROM --platform=linux/amd64 alpine:latest AS server +RUN mkdir -p /usr/echovault/bin +COPY --from=build /build/bin/server /usr/echovault/bin +WORKDIR /usr/echovault/bin +ENTRYPOINT ["./server"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index c6e4815e..33ab5c94 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '3.8' - networks: testnet: driver: bridge @@ -34,8 +32,8 @@ services: - EVICTION_SAMPLE=20 - EVICTION_INTERVAL=100ms # List of echovault cert/key pairs - - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/echovault/server1.crt,/etc/ssl/certs/echovault/echovault/server1.key - - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/echovault/server2.crt,/etc/ssl/certs/echovault/echovault/server2.key + - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/server/server1.crt,/etc/ssl/certs/echovault/server/server1.key + - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/server/server2.crt,/etc/ssl/certs/echovault/server/server2.key # List of client certificate authorities - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt # List of shared object plugins to load on startup @@ -50,222 +48,222 @@ services: networks: - testnet - cluster_node_1: - container_name: cluster_node_1 - build: - context: . - dockerfile: Dockerfile.dev - environment: - - BIND_ADDR=0.0.0.0 - - PORT=7480 - - DISCOVERY_PORT=7946 - - SERVER_ID=1 - - JOIN_ADDR=2/cluster_node_2:7946 - - DATA_DIR=/var/lib/echovault - - TLS=false - - MTLS=false - - BOOTSTRAP_CLUSTER=true - - ACL_CONFIG=/etc/echovault/config/acl.yml - - REQUIRE_PASS=false - - FORWARD_COMMAND=true - - SNAPSHOT_THRESHOLD=1000 - - SNAPSHOT_INTERVAL=5m30s - - RESTORE_SNAPSHOT=false - - RESTORE_AOF=false - - AOF_SYNC_STRATEGY=everysec - - MAX_MEMORY=100mb - - EVICTION_POLICY=noeviction - - EVICTION_SAMPLE=20 - - EVICTION_INTERVAL=100ms - # List of echovault cert/key pairs - - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/echovault/server1.crt,/etc/ssl/certs/echovault/echovault/server1.key - - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/echovault/server2.crt,/etc/ssl/certs/echovault/echovault/server2.key - # List of client certificate authorities - - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt - # List of shared object plugins to load on startup - - MODULE_1=./modules/module_set/module_set.so - - MODULE_2=./modules/module_get/module_get.so - ports: - - "7481:7480" - - "7945:7946" - volumes: - - ./internal/volumes/config:/etc/echovault/config - - ./internal/volumes/nodes/cluster_node_1:/var/lib/echovault - networks: - - testnet - - cluster_node_2: - container_name: cluster_node_2 - build: - context: . - dockerfile: Dockerfile.dev - environment: - - BIND_ADDR=0.0.0.0 - - PORT=7480 - - DISCOVERY_PORT=7946 - - SERVER_ID=2 - - JOIN_ADDR=3/cluster_node_3:7946 - - DATA_DIR=/var/lib/echovault - - TLS=false - - MTLS=false - - BOOTSTRAP_CLUSTER=false - - ACL_CONFIG=/etc/echovault/config/acl.yml - - REQUIRE_PASS=false - - FORWARD_COMMAND=true - - SNAPSHOT_THRESHOLD=1000 - - SNAPSHOT_INTERVAL=5m30s - - RESTORE_SNAPSHOT=false - - RESTORE_AOF=false - - AOF_SYNC_STRATEGY=everysec - - MAX_MEMORY=100mb - - EVICTION_POLICY=noeviction - - EVICTION_SAMPLE=20 - - EVICTION_INTERVAL=100ms - # List of echovault cert/key pairs - - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/echovault/server1.crt,/etc/ssl/certs/echovault/echovault/server1.key - - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/echovault/server2.crt,/etc/ssl/certs/echovault/echovault/server2.key - # List of client certificate authorities - - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt - # List of shared object plugins to load on startup - - MODULE_1=./modules/module_set/module_set.so - - MODULE_2=./modules/module_get/module_get.so - ports: - - "7482:7480" - - "7947:7946" - volumes: - - ./internal/volumes/config:/etc/echovault/config - - ./internal/volumes/nodes/cluster_node_2:/var/lib/echovault - networks: - - testnet - - cluster_node_3: - container_name: cluster_node_3 - build: - context: . - dockerfile: Dockerfile.dev - environment: - - BIND_ADDR=0.0.0.0 - - PORT=7480 - - DISCOVERY_PORT=7946 - - SERVER_ID=3 - - JOIN_ADDR=4/cluster_node_4:7946 - - DATA_DIR=/var/lib/echovault - - TLS=false - - MTLS=false - - BOOTSTRAP_CLUSTER=false - - ACL_CONFIG=/etc/echovault/config/acl.yml - - REQUIRE_PASS=false - - FORWARD_COMMAND=true - - SNAPSHOT_THRESHOLD=1000 - - SNAPSHOT_INTERVAL=5m30s - - RESTORE_SNAPSHOT=false - - RESTORE_AOF=false - - AOF_SYNC_STRATEGY=everysec - - MAX_MEMORY=100mb - - EVICTION_POLICY=noeviction - - EVICTION_SAMPLE=20 - - EVICTION_INTERVAL=100ms - # List of echovault cert/key pairs - - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/echovault/server1.crt,/etc/ssl/certs/echovault/echovault/server1.key - - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/echovault/server2.crt,/etc/ssl/certs/echovault/echovault/server2.key - # List of client certificate authorities - - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt - # List of shared object plugins to load on startup - - MODULE_1=./modules/module_set/module_set.so - - MODULE_2=./modules/module_get/module_get.so - ports: - - "7483:7480" - - "7948:7946" - volumes: - - ./internal/volumes/config:/etc/echovault/config - - ./internal/volumes/nodes/cluster_node_3:/var/lib/echovault - networks: - - testnet - - cluster_node_4: - container_name: cluster_node_4 - build: - context: . - dockerfile: Dockerfile.dev - environment: - - BIND_ADDR=0.0.0.0 - - PORT=7480 - - DISCOVERY_PORT=7946 - - SERVER_ID=4 - - JOIN_ADDR=5/cluster_node_5:7946 - - DATA_DIR=/var/lib/echovault - - TLS=false - - MTLS=false - - BOOTSTRAP_CLUSTER=false - - ACL_CONFIG=/etc/echovault/config/acl.yml - - REQUIRE_PASS=false - - FORWARD_COMMAND=true - - SNAPSHOT_THRESHOLD=1000 - - SNAPSHOT_INTERVAL=5m30s - - RESTORE_SNAPSHOT=false - - RESTORE_AOF=false - - AOF_SYNC_STRATEGY=everysec - - MAX_MEMORY=100mb - - EVICTION_POLICY=noeviction - - EVICTION_SAMPLE=20 - - EVICTION_INTERVAL=100ms - # List of echovault cert/key pairs - - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/echovault/server1.crt,/etc/ssl/certs/echovault/echovault/server1.key - - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/echovault/server2.crt,/etc/ssl/certs/echovault/echovault/server2.key - # List of client certificate authorities - - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt - # List of shared object plugins to load on startup - - MODULE_1=./modules/module_set/module_set.so - - MODULE_2=./modules/module_get/module_get.so - ports: - - "7484:7480" - - "7949:7946" - volumes: - - ./internal/volumes/config:/etc/echovault/config - - ./internal/volumes/nodes/cluster_node_4:/var/lib/echovault - networks: - - testnet - - cluster_node_5: - container_name: cluster_node_5 - build: - context: . - dockerfile: Dockerfile.dev - environment: - - BIND_ADDR=0.0.0.0 - - PORT=7480 - - DISCOVERY_PORT=7946 - - SERVER_ID=5 - - JOIN_ADDR=1/cluster_node_1:7946 - - DATA_DIR=/var/lib/echovault - - TLS=false - - MTLS=false - - BOOTSTRAP_CLUSTER=false - - ACL_CONFIG=/etc/echovault/config/acl.yml - - REQUIRE_PASS=false - - FORWARD_COMMAND=true - - SNAPSHOT_THRESHOLD=1000 - - SNAPSHOT_INTERVAL=5m30s - - RESTORE_SNAPSHOT=false - - RESTORE_AOF=false - - AOF_SYNC_STRATEGY=everysec - - MAX_MEMORY=100mb - - EVICTION_POLICY=noeviction - - EVICTION_SAMPLE=20 - - EVICTION_INTERVAL=100ms - # List of echovault cert/key pairs - - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/echovault/server1.crt,/etc/ssl/certs/echovault/echovault/server1.key - - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/echovault/server2.crt,/etc/ssl/certs/echovault/echovault/server2.key - # List of client certificate authorities - - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt - # List of shared object plugins to load on startup - - MODULE_1=./modules/module_set/module_set.so - - MODULE_2=./modules/module_get/module_get.so - ports: - - "7485:7480" - - "7950:7946" - volumes: - - ./internal/volumes/config:/etc/echovault/config - - ./internal/volumes/nodes/cluster_node_5:/var/lib/echovault - networks: - - testnet \ No newline at end of file +# cluster_node_1: +# container_name: cluster_node_1 +# build: +# context: . +# dockerfile: Dockerfile.dev +# environment: +# - BIND_ADDR=0.0.0.0 +# - PORT=7480 +# - DISCOVERY_PORT=7946 +# - SERVER_ID=1 +# - JOIN_ADDR=2/cluster_node_2:7946 +# - DATA_DIR=/var/lib/echovault +# - TLS=false +# - MTLS=false +# - BOOTSTRAP_CLUSTER=true +# - ACL_CONFIG=/etc/echovault/config/acl.yml +# - REQUIRE_PASS=false +# - FORWARD_COMMAND=true +# - SNAPSHOT_THRESHOLD=1000 +# - SNAPSHOT_INTERVAL=5m30s +# - RESTORE_SNAPSHOT=false +# - RESTORE_AOF=false +# - AOF_SYNC_STRATEGY=everysec +# - MAX_MEMORY=100mb +# - EVICTION_POLICY=noeviction +# - EVICTION_SAMPLE=20 +# - EVICTION_INTERVAL=100ms +# # List of echovault cert/key pairs +# - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/server/server1.crt,/etc/ssl/certs/echovault/server/server1.key +# - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/server/server2.crt,/etc/ssl/certs/echovault/server/server2.key +# # List of client certificate authorities +# - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt +# # List of shared object plugins to load on startup +# - MODULE_1=./modules/module_set/module_set.so +# - MODULE_2=./modules/module_get/module_get.so +# ports: +# - "7481:7480" +# - "7945:7946" +# volumes: +# - ./internal/volumes/config:/etc/echovault/config +# - ./internal/volumes/nodes/cluster_node_1:/var/lib/echovault +# networks: +# - testnet +# +# cluster_node_2: +# container_name: cluster_node_2 +# build: +# context: . +# dockerfile: Dockerfile.dev +# environment: +# - BIND_ADDR=0.0.0.0 +# - PORT=7480 +# - DISCOVERY_PORT=7946 +# - SERVER_ID=2 +# - JOIN_ADDR=3/cluster_node_3:7946 +# - DATA_DIR=/var/lib/echovault +# - TLS=false +# - MTLS=false +# - BOOTSTRAP_CLUSTER=false +# - ACL_CONFIG=/etc/echovault/config/acl.yml +# - REQUIRE_PASS=false +# - FORWARD_COMMAND=true +# - SNAPSHOT_THRESHOLD=1000 +# - SNAPSHOT_INTERVAL=5m30s +# - RESTORE_SNAPSHOT=false +# - RESTORE_AOF=false +# - AOF_SYNC_STRATEGY=everysec +# - MAX_MEMORY=100mb +# - EVICTION_POLICY=noeviction +# - EVICTION_SAMPLE=20 +# - EVICTION_INTERVAL=100ms +# # List of echovault cert/key pairs +# - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/server/server1.crt,/etc/ssl/certs/echovault/server/server1.key +# - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/server/server2.crt,/etc/ssl/certs/echovault/server/server2.key +# # List of client certificate authorities +# - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt +# # List of shared object plugins to load on startup +# - MODULE_1=./modules/module_set/module_set.so +# - MODULE_2=./modules/module_get/module_get.so +# ports: +# - "7482:7480" +# - "7947:7946" +# volumes: +# - ./internal/volumes/config:/etc/echovault/config +# - ./internal/volumes/nodes/cluster_node_2:/var/lib/echovault +# networks: +# - testnet +# +# cluster_node_3: +# container_name: cluster_node_3 +# build: +# context: . +# dockerfile: Dockerfile.dev +# environment: +# - BIND_ADDR=0.0.0.0 +# - PORT=7480 +# - DISCOVERY_PORT=7946 +# - SERVER_ID=3 +# - JOIN_ADDR=4/cluster_node_4:7946 +# - DATA_DIR=/var/lib/echovault +# - TLS=false +# - MTLS=false +# - BOOTSTRAP_CLUSTER=false +# - ACL_CONFIG=/etc/echovault/config/acl.yml +# - REQUIRE_PASS=false +# - FORWARD_COMMAND=true +# - SNAPSHOT_THRESHOLD=1000 +# - SNAPSHOT_INTERVAL=5m30s +# - RESTORE_SNAPSHOT=false +# - RESTORE_AOF=false +# - AOF_SYNC_STRATEGY=everysec +# - MAX_MEMORY=100mb +# - EVICTION_POLICY=noeviction +# - EVICTION_SAMPLE=20 +# - EVICTION_INTERVAL=100ms +# # List of echovault cert/key pairs +# - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/server/server1.crt,/etc/ssl/certs/echovault/server/server1.key +# - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/server/server2.crt,/etc/ssl/certs/echovault/server/server2.key +# # List of client certificate authorities +# - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt +# # List of shared object plugins to load on startup +# - MODULE_1=./modules/module_set/module_set.so +# - MODULE_2=./modules/module_get/module_get.so +# ports: +# - "7483:7480" +# - "7948:7946" +# volumes: +# - ./internal/volumes/config:/etc/echovault/config +# - ./internal/volumes/nodes/cluster_node_3:/var/lib/echovault +# networks: +# - testnet +# +# cluster_node_4: +# container_name: cluster_node_4 +# build: +# context: . +# dockerfile: Dockerfile.dev +# environment: +# - BIND_ADDR=0.0.0.0 +# - PORT=7480 +# - DISCOVERY_PORT=7946 +# - SERVER_ID=4 +# - JOIN_ADDR=5/cluster_node_5:7946 +# - DATA_DIR=/var/lib/echovault +# - TLS=false +# - MTLS=false +# - BOOTSTRAP_CLUSTER=false +# - ACL_CONFIG=/etc/echovault/config/acl.yml +# - REQUIRE_PASS=false +# - FORWARD_COMMAND=true +# - SNAPSHOT_THRESHOLD=1000 +# - SNAPSHOT_INTERVAL=5m30s +# - RESTORE_SNAPSHOT=false +# - RESTORE_AOF=false +# - AOF_SYNC_STRATEGY=everysec +# - MAX_MEMORY=100mb +# - EVICTION_POLICY=noeviction +# - EVICTION_SAMPLE=20 +# - EVICTION_INTERVAL=100ms +# # List of echovault cert/key pairs +# - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/server/server1.crt,/etc/ssl/certs/echovault/server/server1.key +# - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/server/server2.crt,/etc/ssl/certs/echovault/server/server2.key +# # List of client certificate authorities +# - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt +# # List of shared object plugins to load on startup +# - MODULE_1=./modules/module_set/module_set.so +# - MODULE_2=./modules/module_get/module_get.so +# ports: +# - "7484:7480" +# - "7949:7946" +# volumes: +# - ./internal/volumes/config:/etc/echovault/config +# - ./internal/volumes/nodes/cluster_node_4:/var/lib/echovault +# networks: +# - testnet +# +# cluster_node_5: +# container_name: cluster_node_5 +# build: +# context: . +# dockerfile: Dockerfile.dev +# environment: +# - BIND_ADDR=0.0.0.0 +# - PORT=7480 +# - DISCOVERY_PORT=7946 +# - SERVER_ID=5 +# - JOIN_ADDR=1/cluster_node_1:7946 +# - DATA_DIR=/var/lib/echovault +# - TLS=false +# - MTLS=false +# - BOOTSTRAP_CLUSTER=false +# - ACL_CONFIG=/etc/echovault/config/acl.yml +# - REQUIRE_PASS=false +# - FORWARD_COMMAND=true +# - SNAPSHOT_THRESHOLD=1000 +# - SNAPSHOT_INTERVAL=5m30s +# - RESTORE_SNAPSHOT=false +# - RESTORE_AOF=false +# - AOF_SYNC_STRATEGY=everysec +# - MAX_MEMORY=100mb +# - EVICTION_POLICY=noeviction +# - EVICTION_SAMPLE=20 +# - EVICTION_INTERVAL=100ms +# # List of echovault cert/key pairs +# - CERT_KEY_PAIR_1=/etc/ssl/certs/echovault/server/server1.crt,/etc/ssl/certs/echovault/server/server1.key +# - CERT_KEY_PAIR_2=/etc/ssl/certs/echovault/server/server2.crt,/etc/ssl/certs/echovault/server/server2.key +# # List of client certificate authorities +# - CLIENT_CA_1=/etc/ssl/certs/echovault/client/rootCA.crt +# # List of shared object plugins to load on startup +# - MODULE_1=./modules/module_set/module_set.so +# - MODULE_2=./modules/module_get/module_get.so +# ports: +# - "7485:7480" +# - "7950:7946" +# volumes: +# - ./internal/volumes/config:/etc/echovault/config +# - ./internal/volumes/nodes/cluster_node_5:/var/lib/echovault +# networks: +# - testnet \ No newline at end of file