Author SHA1 Message Date
Alberto Soutullo 59d0af374b Export metric port to 8008 in Dockerfile 2024-06-03 17:56:32 +02:00
Alberto Soutullo 12b46f76c5 Change metric port to 8008 2024-06-03 17:55:26 +02:00
23 changed files with 28 additions and 246 deletions
+1 -2
View File
@@ -1,5 +1,4 @@
nimbledeps/*
*.exe
stew/*
nim-stew-master/*
.idea/
nim-stew-master/*
-70
View File
@@ -1,70 +0,0 @@
[submodule "vendor/nimbus-build-system"]
path = vendor/nimbus-build-system
url = https://github.com/status-im/nimbus-build-system.git
branch = master
ignore = dirty
[submodule "vendor/nim-libp2p"]
path = vendor/nim-libp2p
url = https://github.com/vacp2p/nim-libp2p
branch = master
ignore = dirty
[submodule "vendor/nim-stew"]
path = vendor/nim-stew
url = https://github.com/status-im/nim-stew
branch = master
ignore = dirty
[submodule "vendor/nim-results"]
path = vendor/nim-results
url = https://github.com/arnetheduck/nim-results
branch = master
ignore = dirty
[submodule "vendor/nim-chronos"]
path = vendor/nim-chronos
url = https://github.com/status-im/nim-chronos
branch = master
ignore = dirty
[submodule "vendor/nim-chronicles"]
path = vendor/nim-chronicles
url = https://github.com/status-im/nim-chronicles
branch = master
ignore = dirty
[submodule "vendor/nim-faststreams"]
path = vendor/nim-faststreams
url = https://github.com/status-im/nim-faststreams
branch = master
ignore = dirty
[submodule "vendor/nim-json-serialization"]
path = vendor/nim-json-serialization
url = https://github.com/status-im/nim-json-serialization
branch = master
ignore = dirty
[submodule "vendor/nim-serialization"]
path = vendor/nim-serialization
url = https://github.com/status-im/nim-serialization
branch = master
ignore = dirty
[submodule "vendor/nim-metrics"]
path = vendor/nim-metrics
url = https://github.com/status-im/nim-metrics
branch = master
ignore = dirty
[submodule "vendor/nimcrypto"]
path = vendor/nimcrypto
url = https://github.com/status-im/nimcrypto
branch = master
ignore = dirty
[submodule "vendor/nim-bearssl"]
path = vendor/nim-bearssl
url = https://github.com/status-im/nim-bearssl
branch = master
ignore = dirty
[submodule "vendor/nim-secp256k1"]
path = vendor/nim-secp256k1
url = https://github.com/status-im/nim-secp256k1
branch = master
ignore = dirty
[submodule "vendor/nim-http-utils"]
path = vendor/nim-http-utils
url = https://github.com/status-im/nim-http-utils
branch = master
ignore = dirty
+14 -35
View File
@@ -1,51 +1,30 @@
# BUILD NIM APP ----------------------------------------------------------------
FROM rust:1.77.1-alpine3.18 AS nim-build
# Create the build image
FROM nimlang/nim:1.6.18 as build
ARG NIMFLAGS
ARG MAKE_TARGET
ARG NIM_COMMIT
# Get build tools and required header files
RUN apk add --no-cache bash git build-base pcre-dev linux-headers curl jq
WORKDIR /app
# Copy the wls files to the production image
WORKDIR /node
COPY . .
# workaround for alpine issue: https://github.com/alpinelinux/docker-alpine/issues/383
RUN apk update && apk upgrade
RUN git config --global http.sslVerify false
# Ran separately from 'make' to avoid re-doing
RUN git submodule update --init --recursive
RUN nimble install -dy
# Slowest build step for the sake of caching layers
RUN make -j$(nproc) deps QUICK_AND_DIRTY_COMPILER=1
RUN nimble c -d:chronicles_colors=None --threads:on -d:metrics -d:libp2p_network_protocols_metrics -d:release main
# Build the final node binary
RUN make -j$(nproc) $MAKE_TARGET NIMFLAGS="${NIMFLAGS}"
# PRODUCTION IMAGE -------------------------------------------------------------
FROM nimlang/nim:1.6.18
FROM alpine:3.18 as prod
LABEL maintainer="asoutullo@status.im"
LABEL source="https://github.com/vacp2p/dst-gossipsub-test-node/tree/dockerized"
# LibP2P, Metrics ports
EXPOSE 5000 8008
# Referenced in the binary
RUN apk add --no-cache busybox-suid \
&& apk add --no-cache --update busybox-extras \
&& apk add --no-cache bash
# Copy to separate location to accomodate different MAKE_TARGET values
COPY --from=nim-build /app/build/main /node/main
RUN apt-get install cron -y
WORKDIR /node
COPY --from=build /node/main /node/main
COPY cron_runner.sh .
RUN chmod +x /node/main
RUN chmod +x cron_runner.sh
RUN chmod +x main
EXPOSE 5000 8008
ENTRYPOINT ["./cron_runner.sh"]
-68
View File
@@ -1,68 +0,0 @@
# Copyright (c) 2022 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.
BUILD_SYSTEM_DIR := vendor/nimbus-build-system
# we don't want an error here, so we can handle things later, in the ".DEFAULT" target
-include $(BUILD_SYSTEM_DIR)/makefiles/variables.mk
ifeq ($(NIM_PARAMS),)
# "variables.mk" was not included, so we update the submodules.
GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
.DEFAULT:
+@ echo -e "Git submodules not found. Running '$(GIT_SUBMODULE_UPDATE)'.\n"; \
$(GIT_SUBMODULE_UPDATE); \
echo
# Now that the included *.mk files appeared, and are newer than this file, Make will restart itself:
# https://www.gnu.org/software/make/manual/make.html#Remaking-Makefiles
#
# After restarting, it will execute its original goal, so we don't have to start a child Make here
# with "$(MAKE) $(MAKECMDGOALS)". Isn't hidden control flow great?
else # "variables.mk" was included. Business as usual until the end of this file.
# must be included after the default target
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
.PHONY: deps dstnode
dstnode.nims:
ln -s dstnode.nimble $@
update: | update-common
rm -rf dstnode.nims && \
$(MAKE) dstnode.nims $(HANDLE_OUTPUT)
deps: | deps-common dstnode.nims
dstnode: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim dstnode $(NIM_PARAMS) dstnode.nims
clean: | clean-common
rm -rf build/dstnode
#####################
## Container image ##
#####################
# -d:insecure - Necessary to enable Prometheus HTTP endpoint for metrics
# -d:chronicles_colors:none - Necessary to disable colors in logs for Docker
DOCKER_IMAGE_NIMFLAGS := -d:chronicles_colors:none -d:insecure --threads:on -d:metrics -d:libp2p_network_protocols_metrics -d:release
# build a docker image
docker-image: MAKE_TARGET ?= dstnode
docker-image: DOCKER_IMAGE_TAG ?= soutullostatus/dst-test-node:v1.2
docker-image:
docker build \
--build-arg="MAKE_TARGET=$(MAKE_TARGET)" \
--build-arg="NIMFLAGS=$(DOCKER_IMAGE_NIMFLAGS)" \
--target prod \
--tag $(DOCKER_IMAGE_TAG) . \
--progress=plain
docker-push:
docker push $(DOCKER_IMAGE_TAG)
endif
-20
View File
@@ -1,20 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2018-2020 Status Research & Development GmbH. Licensed under
# either of:
# - Apache License, version 2.0
# - MIT license
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.
[ -z "$1" -o `echo "$1" | tr '/' '\n' | wc -l` != 2 ] && \
{ echo "Usage: `basename $0` some/repo [destdir] # 'destdir' defaults to 'vendor/repo'"; exit 1; }
REPO="$1"
DEST="vendor/${REPO#*/}"
[ -n "$2" ] && DEST="$2"
git submodule add --force https://github.com/${REPO}.git "$DEST"
git config -f .gitmodules submodule.${DEST}.ignore untracked
git config -f .gitmodules submodule.${DEST}.branch master
Executable → Regular
+1 -3
View File
@@ -11,8 +11,6 @@ hours="$2"
cron_expression="$minutes $hours * * *"
cron_job_file="/etc/cron.d/my-cron-job"
mkdir -p /etc/cron.d
echo -e "$cron_expression /node/main > /proc/1/fd/1 2>&1 \n" > "$cron_job_file"
echo "Cron job file created at $cron_job_file"
@@ -21,4 +19,4 @@ env >> /etc/environment
crontab /etc/cron.d/my-cron-job
crond -f
cron -f
-31
View File
@@ -1,31 +0,0 @@
mode = ScriptMode.Verbose
### Package
version = "0.1.0"
author = "Distributed Systems Testing"
description = "DstNode - Libp2p version: V1.2 (c4da9be32cc01efa2de066c396fe9ef1c7769aa1)"
license = "MIT or Apache License 2.0"
#bin = @["build/waku"]
### Dependencies
requires "nim >= 1.6.0",
"libp2p",
"stew",
"chronos",
"chronicles"
### Helper functions
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
if not dirExists "build":
mkDir "build"
# allow something like "nim nimbus --verbosity:0 --hints:off nimbus.nims"
var extra_params = params
for i in 2..<paramCount():
extra_params &= " " & paramStr(i)
exec "nim " & lang & " --out:build/" & name & " " & extra_params & " " & srcDir & name & ".nim"
### DstNode tasks
task dstnode, "Build DstNode":
let name = "main"
buildBinary name
-3
View File
@@ -1,3 +0,0 @@
--noNimblePath
--path:"/mnt/d/Projects/status/dst-gossipsub-test-node/vendor/nimbus-build-system"
--path:"/mnt/d/Projects/status/dst-gossipsub-test-node/vendor/nim-libp2p"
+12
View File
@@ -0,0 +1,12 @@
mode = ScriptMode.Verbose
packageName = "test_node"
version = "0.1.0"
author = "Status Research & Development GmbH"
description = "A test node for gossipsub"
license = "MIT"
skipDirs = @[]
requires "nim >= 1.6.0",
"libp2p",
"ggplotnim"
Submodule vendor/nim-bearssl deleted from d81b37dc20
Submodule vendor/nim-chronicles deleted from 33761a5f77
Submodule vendor/nim-chronos deleted from 8a306763ce
Submodule vendor/nim-http-utils deleted from be57dbc902
Submodule vendor/nim-libp2p deleted from c4da9be32c
Submodule vendor/nim-metrics deleted from 2e29df0950
Submodule vendor/nim-results deleted from e2adf66b8b
Submodule vendor/nim-secp256k1 deleted from 194b715b16
-1
Submodule vendor/nim-stew deleted from 104132fd02
-1
Submodule vendor/nimcrypto deleted from 24e006df85