Sign inSign up

sclabio/sclab-agent

By sclabio

•Updated 8 months ago

SCLAB Agent docker image

Image
API management
0

2.7K

sclabio/sclab-agent repository overview

⁠sclab-agent

asciicast

⁠installation

⁠.env

create .env file and paste this env vars

#LOG_DIR="/data/logs"
PORT=7890
NODE_ENV=production
LOG_LEVEL=debug

# TOKEN
SECRET_KEY=sclab-agent-key
JWT_PRIVATE_KEY_PATH=/data/jwt/jwtRS256.key
JWT_PUBLIC_KEY_PATH=/data/jwt/jwtRS256.key.pub

# SSL
TLS_CERT=/data/cert/cert.pem
TLS_KEY=/data/cert/privkey.pem

# Agent Managed DB Path
AGENT_DB_PATH=/data/agent.db

# Use mybatis mapper
USE_MYBATIS=1

# ORACLE_CLIENT_DIR
#ORACLE_CLIENT_DIR=

#MSSQL_IDLE_TIMEOUT_MS=30000
TUNNEL_KEEP_ALIVE_INTERVAL_MS=3600000
#USE_SQL_ENV=1
#USE_AWS_SECRET_MANAGER=1
#AWS_REGION=ap-northeast-2
#AWS_SECRET_KEY_ID=
#AWS_SECRET_ACCESS_KEY=
#REMOVE_KEYWORD_INJECTION_CHECK=1

⁠create JWT key

mkdir -p ./data/jwt
ssh-keygen -t rsa -b 4096 -m PEM -f ./data/jwt/jwtRS256.key
  • empty passphrase - just press enter
openssl rsa -in ./data/jwt/jwtRS256.key -pubout -outform PEM -out ./data/jwt/jwtRS256.key.pub

⁠create SSL key

mkdir ./data/cert
openssl genrsa -out ./data/cert/privkey.pem 2048
openssl req -new -sha256 -key ./data/cert/privkey.pem -out ./data/cert/csr.pem
openssl x509 -req -in ./data/cert/csr.pem -signkey ./data/cert/privkey.pem -out ./data/cert/cert.pem

⁠create docker-compose.yml

services:
  sclab-agent:
    image: "sclabio/sclab-agent:latest"
    restart: always
    logging:
      driver: "json-file"
      options:
        max-size: "20m"
        max-file: "10"
    ports:
      - "7890:7890"
    volumes:
      - ./data:/data
    env_file:
      - ./.env
    extra_hosts:
      - "host.docker.internal:host-gateway"
    networks:
      - sclab-network

networks:
  sclab-network:
    external: true

⁠create network

docker network create sclab-network

⁠start agent

docker compose up -d

⁠stop agent

docker compose down

⁠logs

docker compose logs

⁠connection test

  • You have to use -k option for avoid self signed certificate problem.
  • You can replace your certificate files from CA.
curl https://localhost:7890/ -k -H 'authorization: your key from console log'
  • Reponse
{"status":"ok","result":"Authentication complete."}

⁠source code

Tag summary

Content type

Image

Digest

sha256:54ef9e747…

Size

482.8 MB

Last updated

8 months ago

docker pull sclabio/sclab-agent