Hello.
i finally able to use cockroachdb with my go modules. now i have problem with logging to file . the problem is for using go module within cockroachdb i need to remove
volumes:
- ./data:/nakama/data
from my docker-compose file thanks to this topic, and after that everything worked perfectly and i could add my go modules. but now if i want to log to file using logger configuration when i try because there is no volume for that it will not log to file and even there is no error for that. so what should i do ? thanks
docker compose
version: '3'
services:
cockroachdb:
image: cockroachdb/cockroach:latest-v23.1
command: start-single-node --insecure --store=attrs=ssd,path=/var/lib/cockroach/
restart: "no"
volumes:
- data:/var/lib/cockroach
expose:
- "8080"
- "26257"
ports:
- "26257:26257"
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"]
interval: 3s
timeout: 3s
retries: 5
nakama:
build: .
entrypoint:
- "/bin/sh"
- "-ecx"
- >
/nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
exec /nakama/nakama --config /nakama/data/nakama-config.yml --name nakama1 --database.address root@cockroachdb:26257 --logger.level DEBUG --session.token_expiry_sec 7200 --metrics.prometheus_port 9100
restart: "no"
links:
- "cockroachdb:db"
depends_on:
cockroachdb:
condition: service_healthy
prometheus:
condition: service_started
expose:
- "7349"
- "7350"
- "7351"
- "9100"
ports:
- "7349:7349"
- "7350:7350"
- "7351:7351"
healthcheck:
test: ["CMD", "/nakama/nakama", "healthcheck"]
interval: 10s
timeout: 5s
retries: 5
prometheus:
image: prom/prometheus
entrypoint: /bin/sh -c
command: |
'sh -s <<EOF
cat > ./prometheus.yml <<EON
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: nakama
metrics_path: /
static_configs:
- targets: ['nakama:9100']
EON
prometheus --config.file=./prometheus.yml
EOF'
ports:
- '9090:9090'
volumes:
data:
dockerfile
FROM heroiclabs/nakama-pluginbuilder:3.22.0 AS go-builder
ENV GO111MODULE on
ENV CGO_ENABLED 1
WORKDIR /backend
COPY . .
RUN go build --trimpath --mod=vendor --buildmode=plugin -o ./backend.so
FROM registry.heroiclabs.com/heroiclabs/nakama:3.22.0
COPY --from=go-builder /backend/backend.so /nakama/data/modules/
COPY nakama-config.yml /nakama/data
config file
name: nakama-node-1
data_dir: "./data/"
console:
port: 7351
username: "admin"
password: "12345678"
logger:
file: "/nakama/data/logs/logfile.log"
thanks