#!/bin/bash

ROOT=`pwd`
MANAGER_PROJECT=${ROOT}/swan/manager/
CERT=${MANAGER_PROJECT}/cert
CONFIG=${MANAGER_PROJECT}/config
LOG=${MANAGER_PROJECT}/log
ASNLOG=${LOG}/swan
IAMLOG=${LOG}/iam
SERVICES=${MANAGER_PROJECT}/services
WEB=${MANAGER_PROJECT}/web


IAM_DOCKER_CERT="/etc/sapphire/cert"
IAM_DOCKER_CONFIG="/etc/sapphire/config"
IAM_VERSION="25.8.0" # need to configurate
IAM_DOCKER_TIMEZONE="Asia/Shanghai" # need to configurate

ASNC_DOCKER_CERT="/asn/cert"
ASNC_TOPO_FILE="default-topology.yml"

SWAN_MANAGER_VERSION="25.8.2" # need to configurate
SWAN_CONFIG="swan.conf"
LICENSE_ADDR="grpc.license.amianetworks.com.cn"  # default is localhost, need to configurate
LICENSE_PORT="443" # default is 20088, need to configurate

mkdir -p ${MANAGER_PROJECT}
mkdir ${CERT}
mkdir ${CONFIG}
mkdir ${LOG}
mkdir ${ASNLOG}
mkdir ${IAMLOG}
mkdir ${SERVICES}
mkdir ${WEB}

# ---------------------------------
# Generate CA for IAM service
#----------------------------------
pushd .  1>/dev/null
cd ${CERT}

#=== Generate Server CA ===
openssl genrsa -out server-ca.key 4096
openssl req -x509 -new -nodes -key server-ca.key -sha256 -days 3650 -out server-ca.crt -subj "/C=US/ST=California/L=Palo Alto/O=AmiaNetworks/OU=SapphireIAM/CN=TestServer"

#=== Generate Server Cert ===
openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr -subj "/C=US/ST=California/L=Palo Alto/O=AmiaNetworks/OU=SapphireIAM/CN=TestServer"

cat > v3.ext <<EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names

[alt_names]
DNS = localhost
EOF

openssl x509 -req -in server.csr -CA server-ca.crt -CAkey server-ca.key -CAcreateserial -out server.pem -days 825 -sha256 -extfile v3.ext

#=== Generate Client CA ===
openssl genrsa -out client-ca.key 4096
openssl req -x509 -new -nodes -key client-ca.key -sha256 -days 3650 -out client-ca.crt -subj "/C=US/ST=California/L=Palo Alto/O=Amiasys Corporation/OU=R&D/CN=iam.amiasys.com/emailAddress=contact@amiasys.com"


#=== Generate Client Cert ===
openssl genrsa -out client-swan.key 2048
openssl req -new -key client-swan.key -out client-swan.csr -subj "/C=US/ST=California/L=Palo Alto/O=Amiasys Corporation/OU=R&D/CN=swan/emailAddress=contact@amiasys.com"
openssl x509 -req -in client-swan.csr -CA client-ca.crt -CAkey client-ca.key -CAcreateserial -out client-swan.pem -days 825 -sha256

popd    1>/dev/null


# ------------------------------
# Generate iam.yml
# ------------------------------
pushd .  1>/dev/null
cd ${CONFIG}

cat > iam.yml <<EOF
# Copyright 2025 Amiasys Corporation and/or its affiliates. All rights reserved.

## Log Configurations
#log:
#  level: "info" # Supported log level: panic | fatal | error | warning | info | debug | trace. Default: info
#  file: "/var/log/iam/iam.log" # Default: "/var/log/iam/iam.log"

## Database Configurations
db:
  provider: "mongodb" # Supported: "mongodb" | "filedb". Default: "mongodb"
  url: "asn-mdb:27017" # Default: "localhost:27017"
  username: "amia" # Default: "amia"
  password: "2022" # Default: "2022"

## Services
services_provisioned: [ asn, swan, scarlette ]

## LDAP Configurations
#ldap:
#  enabled: false # Default: false
#  interval: 15 # Sync interval in minutes, Default: 15
#  url: "ldap://localhost:389" # Default: "ldap://localhost:389"
#  base_dn: "dc=amianetworks,dc=com" # Default: "dc=amianetworks,dc=com"
#  password_cn: "cn=admin" # Default: "cn=admin"
#  password: "2022" # Default: "2022"
#  ous:
#    account: "People"
#    group: "Group"
#  defaults:
#    account_shadow_warning: "7" # Default: "7"
#    account_shadow_max: "99999" # Default: "99999"
#    account_home_directory_prefix: "/home/" # Default: "/home/"
#    account_login_shell: "/bin/bash" # Default: "/bin/bash"

## API Configurations
api:
  grpc:
    port: 17930 # gRPC API port. Default:17930
    tls:
      enabled: false # Default: false
      root_ca: "${IAM_DOCKER_CERT}/client-ca.crt"
      pem_file: "${IAM_DOCKER_CERT}/server.pem"
      key_file: "${IAM_DOCKER_CERT}/server.key"

# Lock
#
# Default mode is standalone.
# To config "distributed" mode, uncomment "redis" config section.
#   - Redis "standard" is a single-instance locker
#   - Redis "redlock" is used to implement distributed locks with multiple Redis instance.
#lock:
#  mode: "standalone" # (standalone | distributed) Default: "standalone"
#  waiting_limit: 10 # Default: 10 (Seconds)
#  holding_limit: 5 # Default: 5 (Seconds)
#  redis: # used only in distributed mode
#    mode: "standard" # (standard | redlock) Default: "standard"
#    nodes: # list of redis nodes. Only the first one is used in standard mode
#      urls:
#        - "localhost:6379" # Default: "localhost:6379"
#      passwords:
#        - "2023"
#      dbs:
#        - 0 # index: 0 ~ 15 (Default: 0)

## Email Service
#smtp: # SMTP email server config
#  enabled: false # Default: false
#  tls: true
#  host: "smtp.office365.com"
#  email: "email@amiasys.com"
#  username: "email@amiasys.com"
#  password: ""
#  port: 587

## Account Configurations
account:
#  special_key: "SpecialAccount@AmiaNetworks2025" # Used to create special accounts which skips MFA.
#  password_algo: argon2id # argon2id | bcrypt | md5 | pbkdf2 | scrypt | sha1 | sha256 | sha512, Default: argon2id
#
#  # Some fields can be set to unique. These fields can also be used as login identifier (similar to a username).
#  # Note that if a field is set to NOT UNIQUE, and later on changed to UNIQUE, IAM will not check for existing records.
#  # However, these accounts cannot log in with duplicate identifiers.
#  unique_fields:
#    email: true # Default: true
#    phone: false # Default: true
#
#  # Some services require the mandatory filling of mobile phone and email.
#  # Mode is strict, when user apply IAM, input phone/email depends on whether phone/email is true, need to be verified by code
#  # Mode is compatible, when manager create user account(or user apply)
#  # input phone/email depends on whether phone/email is true, no need to be verified by code
#  # user can set phone/email when user first login.
#  required_fields:
#    mode: compatible  # compatible
#    email: false # Default: false
#    phone: false # Default: false
#
#  # Regular expressions are used here to specify the format of username, password, and user group.
#  # ^, $: start-of-line and end-of-line respectively.
#  # [...]: Accept ANY ONE of the character within the square bracket, e.g., [aeiou] matches "a", "e", "i", "o" or "u".
#  # [.-.] (Range Expression): Accept ANY ONE of the character in the range, e.g., [0-9] matches any digit; [A-Za-z] matches any uppercase or lowercase letters.
#  # {m,n}: m to n (both inclusive)
#  # If you need to customize the format, please refer to the regular expression syntax.
  format:
#    name: "^[0-9a-zA-Z\u4e00-\u9fa5!@$._-]{2,36}$"
    password: "^[0-9a-zA-Z!-~]{6,128}$"
#    email: "^(?:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,})?$"
#    country_code: "^(?:\\d{1,3})?$"
#    phone: "^(?:$|[\\d\\s\\-\\(\\)\\.]{6,15})$"
#
#  # You can recover the account through email or SMS(TBD).
#  # If none of the above methods are available, the admin can reset the account through the cli command line.
#  # TBD: recover account by SMS
#  recovery:
#    email: # Sending a code to your recovery email # Code format:  "^[0-9a-zA-Z-:.]{6,128}$"
#      expire: 5 # Expiration time in minutes. Default 5 minutes.
#      resend_interval: 1 # Resending interval in minutes. Default 1 minute

## Authentication Configurations
authentication:
  service:
    mtls: false # Default: false
    client_ca: "${IAM_DOCKER_CERT}/client-ca.crt"
    name: "^[0-9a-zA-Z_-]{2,36}$"
#
#  # Attempt frequency can limit the frequency of user attempts to log in.
#  attempt_frequency:
#    wait_min: 1 # Minimum wait time after an attempt in second. Default: 1 Seconds
#    wait_max: 43200 # Maximum waiting time after an attempt in second. Default: 43200 Seconds
#    amp_factor: 2 # The waiting time after each failure will be extended according to the amplification factor. Default: 3
#
#  # Config the concurrent authentication to limit the number of concurrent authentication entity allowed per user.
#  # You can configure the maximum number of entities allowed to log in, and if exceeded, it will be handled according to the auto replacement policy.
#  # Supported auto replacement policies: disable | random | oldest | latest. Default: disable
#  concurrent_authentication:
#    entity_allowed: 3 # maximum number of entities allowed, 0 means disable;  less than 0 means login is prohibited. Default: 3
#    auto_replacement: "disable"
#
#  # Configure MFA(Multi-Factor Authentication) information
#  # By using the TOTP(Time-Based One Time Password) method, one time password is created on the user side through a smartphone application.
#  # Applications that are known to work with TOTP： Microsoft Authenticator、Google Authenticator）
#  # TBD: SMS
#  mfa:
#    totp:
#      # The issuer indicates the provider or service this account is associated with, URL-encoded according to RFC 3986.
#      issuer: "Amianetworks"

## Authorization Configurations
#authorization:
#  # JWT（JSON Web Token）is an open source standard (RFC 7519) that defines the format for how communicating parties can exchange information securely.
#  # TBD: JWT provides different token strategies for different entity types
#  jwt:
#    issuer: "amianetworks.com"
#    # RS256 Key Set for JWT signature.
#    # [NOT RECOMMENDED!!!] If either is set to empty, a random set will be used.
#    public_key_file: ""
#    private_key_file: ""
#    access_token:
#      expire: 60   # Access token expiration time in minutes. Default: 60 minutes.
#    refresh_token:
#      enabled: true # Support automatically obtaining access token through refresh token. Default: true
#      expire: 600  # Refresh token expiration time in minutes. Default: 600 minutes.
#
#  access_control:
#    format:
#      role:
#        name: "^[0-9a-zA-Z!@$._-]{6,128}$"
#      policy:
#        name: "^[0-9a-zA-Z\u4e00-\u9fa5!@$._-]{2,36}$"
#        scope: "^[0-9a-zA-Z!@$._-/*?%&]{6,128}$"
#        operation: "^[0-9a-zA-Z!@$._-]{6,128}$"
#        time: "^[0-9a-zA-Z-:.]{6,128}$"

## Group Configurations
group:
  name: "^[0-9a-zA-Z\u4e00-\u9fa5!@$._-]{2,36}$"

## Role Configurations
role:
  name: "^[0-9a-zA-Z\u4e00-\u9fa5!@$._-]{2,36}$"

## Policy Configurations
policy:
  name: "^[0-9a-zA-Z\u4e00-\u9fa5!@$._-]{2,36}$"
EOF

popd    1>/dev/null


#--------------------------------
#--------------------------------
# Create Influxdbv2
#--------------------------------
#--------------------------------

USERNAME_FILE="~/.env.influxdb2-admin-username"
PASSWORD_FILE="~/.env.influxdb2-admin-password"
TOKEN_FILE="~/.env.influxdb2-admin-token"


INFLUXDBV2_USERNAME="amia"
INFLUXDBV2_PASSWORD="amia2022" # 8~72
INFLUXDBV2_TOKEN="MyInitialAmiaToken0=="

echo ${INFLUXDBV2_USERNAME} > $HOME/.env.influxdb2-admin-username
echo ${INFLUXDBV2_PASSWORD} > $HOME/.env.influxdb2-admin-password
echo ${INFLUXDBV2_TOKEN} > $HOME/.env.influxdb2-admin-token



# ---------------------
# ---------------------
# Create ASNC config
# ---------------------
# ---------------------
pushd .  1>/dev/null
cd ${CONFIG}

cat > asn.conf <<EOF
# Copyright 2025 Amiasys Corporation and/or its affiliates. All rights reserved.

##
# ASN Controller Configurations
#
# - Mode
# - APIs
# - DBs
# - IAM
# - Lock # UNUSED
# - Log
# - Network
# - Service Node
# - Service

# NOTES:
# 1. Default values are available for those with "Default:" comments.
# 2. Mandatory Configs SHOULD NOT be commented out.
# 3. For "FIRST-TIME" Deployment or a major upgrade, please carefully check all effective configs.


##
# Mode
#
# Just a flag.
# Configurations should be set accordingly with caution.
mode: "dev" # Mandatory: "dev": development; "pro": production.

# API Service Ports
#
# API Service Ports should be configured properly for the deployment purpose.
# grpc_c: Controller gRPC for Service Node
# grpc_m: Internal used for RESTful API
# restful: RESTful API for ASN Portal
api:
  grpc_c: ":12762" # e.g. dev:12762, pro:52762 (Default: :12762)
  grpc_m: "localhost:12766" # e.g. dev:12766, pro:52766 (Default: localhost:12766)
  restful: ":12760" # e.g. dev:12760, pro:52760 (Default: :12760)

# OBSOLETED. TO BE DELETED.
#management:
#  grpc: 50052
#  restful: 58080


# Databases
#
# The "default" DB must always be configured.
#
# Single-purpose DBs can be configured with caution.
# CAUTION: DO NOT comment/uncomment a DB below for a running server.
default_dbs:
  doc:
    provider: "mongodb"
    url: "localhost:27017"
    username: "amia"
    password: "2022"
    asn_db: "asn"
  ts:
    provider: "influxdbv2"
    url: "localhost:8086"
    username: ${INFLUXDBV2_USERNAME}
    password: ${INFLUXDBV2_PASSWORD}
    organization: "amia" # only needed for influxDB v2
    token: "${INFLUXDBV2_TOKEN}" # only needed for influxDB v2
    asn_db: "asn"

# OBSOLETED. TO BE DELETED.
#db:
#  mongodb:
#    host: localhost
#    port: 27017
#    database_name: asnData
#    username: amia
#    password: 2022
#  influxdbv1:
#    host: localhost
#    port: 8086
#    database_name: asn
#    username: amia
#    password: 2022
#

# IAM
#
# Sapphire IAM
iam:
  host: localhost # ignore if using local
  port: 17930 # ignore if using local
  mfa: false # force enable mfa authorization, default false
  mtls:
    enabled: false # Default: false
    ca_cert: ${ASNC_DOCKER_CERT}/server-ca.crt # ignore if using local or not using TLS
    cert_pem: ${ASNC_DOCKER_CERT}/client-swan.pem # ignore if using local or not using TLS
    key_pem: ${ASNC_DOCKER_CERT}/client-swan.key # ignore if using local or not using TLS


# Log
#
# Default Log Level is "info", but can be changed for each log.
#log:
#  path: "./log" # Default: "/var/log/asn/"
#  prefix: "asn" # Default: "asn"
#  api_log:
#    filename: "api.log" # Default: "api.log"
#    level: "info"
#  entity_log:
#    filename: "entity.log" # Default: "entity.log"
#    level: "info"
#  perf_log:
#    filename: "perf.log" # Default: "perf.log"
#    level: "info"
#  runtime_log:
#    filename: "runtime.log" # Default: "runtime.log"
#    level: "info"

# Network Topology
#
# Topology-based verification is optional, while a specified topology file is always loaded.
#   standard: SEnd Device is not restricted,
#   strict: Any node, including End Device, must be specified in the "network topology".
#   free: Any node
#
# Topo Verification:
#  - network: verify the presence of root network
#  - parent: verify the presence of parent (network)
#  - node: verify the presence of the service node. Default setting for all node types. Can be overwritten.
#  - router|switch|appliance|server|*: overwriting "node" verification for THE SPECIFIED TYPE of nodes.
network:
  topo_file: "config/${ASNC_TOPO_FILE}"  # network topology description file path
  topo_verification:
    network: true # Default: true
    parent: true # Default: true
    node: true # Default: true
    server: false # Default: true
    device: false # Default: false

# Service Node
servicenode:
  #  keepalive: 5  # Heartbeat Rate in Second. Default: 5
  mtls:
    enabled: false
    server_ca: "cert/server.crt"
    server_cert: "cert/server.pem"
    server_key: "cert/server.key"
    node_ca: "cert/client.crt"

# Services
#
# Listed service will be loaded at starting.
# The default service file is servicename.so, if not specified.
# TBD: Dynamic loading if needed.
#
# Listed service uses controller's default DBs if not specified.
service:
  - name: swan
    plugin: "swan.so" # Default: $NAME.so
    auto_start: false # Default: false
    auto_stop: true # Default: true
    db:
      doc:
        provider: "mongodb"
        url: localhost:27017
        dbname: swan
        username: amia
        password: "2022"
      ts:
        provider: "influxdbv2"
        url: localhost:8086
        dbname: swan
        username: ${INFLUXDBV2_USERNAME}
        password: ${INFLUXDBV2_PASSWORD}
        organization: "amia" # only needed for influxDB v2
        token: "${INFLUXDBV2_TOKEN}" # only needed for influxDB v2
EOF


cat > cli.conf <<EOF
# Copyright 2025 Amiasys Corporation and/or its affiliates. All rights reserved.

server: localhost
port: "50051"
token: ""

EOF

cat > ${ASNC_TOPO_FILE} <<EOF
networks:
  - name: network1
    desc: "My Test Network"
    networks:
      - name: subnetwork1
        location:
          address: "xxx street"
          coordinates: { latitude: 40.2539 , longitude: 116.4551 }
        nodes:
          - s1-switch1
          - s1-server1
      - name: subnetwork2
        location:
          address: "yyy street"
          coordinates: { latitude: 32.084999, longitude: 118.800887 }
        nodes:
          - s2-switch1

nodes:
  s1-switch1:
    type: switch
    managed: true
  s1-server1:
    type: server
    managed: true
  s2-switch1:
    type: switch
    managed: true

links:
  - from: { node: s1-switch1 }
    to: { node: s1-server1 }
    bandwidth: 100000
    desc: "subnetwork1 server1 to switch1"
  - from: { node: s1-switch1 }
    to: { node: s2-switch1 }
    bandwidth: 100000
    desc: "subnetwork1 switch1 to subnetwork2 switch1"
EOF


cat > ${SWAN_CONFIG} <<EOF
# Copyright 2025 Amiasys Corporation and/or its affiliates. All rights reserved.

# general provides the gRPC access address of SWAN Manager service.
grpc:
  host: 0.0.0.0
  port: 7926
  # the minimum amount of seconds a client should wait before sending a keepalive ping.
  keepalive: 5

data:
  logaudit:
    # There are two log audit modes: 
    # local: data is obtained from the local database; 
    # sccm: data is obtained from the sccm service.
    provider: local
    sccmurl:  # ignore if using local
  systemstatus:
    # There are two modes for obtaining system status data: 
    # local: data is obtained from the local database; 
    # sccm: data is obtained from the sccm service.
    provider: local
    sccmurl:   # ignore if using local

# The tunnel encryption algorithm supported by SWAN Manager is configured in the configuration file in advance.
tunnelencryption:
  aes128-gcm: # encryption algorithm
    - ssh     # tunnel protocol
    - openvpn
  aes256-gcm:
    - ssh
    - openvpn
  chacha20-poly1305:
    - wireguard
    - ssh
  gm:
    - gm

# udp listening port range for gm tunnel
gm:
  portstart: 30000
  portend: 31000

# License authorization service address
license:
  address: ${LICENSE_ADDR}
  port: ${LICENSE_PORT}

# Send Mail Service
email:
  tls: true
  host: "smtp.office365.com"
  email: "email@amiasys.com"
  username: "email@amiasys.com"
  password: "#EmailFromEventorSince2022"
  port: 587
  code_verify_expire: 300 # Email verification code expiration time in seconds (e.g., 300 = 5 minutes)
  send_rate_limit: 50 # Email sending rate limit in seconds (e.g., 50 = 1 email per minute)

# Application Configurations
application:
  device_limit_min: 1                # The minimum number of endpoints that the system allows a user to log in
  admin_access_token_expire: 60      # Admin access token expiration time in minutes (e.g., 60 = 1 hour)
  admin_refresh_token_expire: 1440   # Admin refresh token expiration time in minutes (e.g., 1440 = 1 day)
  client_access_token_expire: 1440   # Client access token expiration time in minutes (e.g., 1440 = 1 day)
  client_refresh_token_expire: 43200 # Client refresh token expiration time in minutes (e.g., 43200 = 30 day)
  snode_port_change_time: 120        # Service node port change time in minutes (e.g., 120 = 2 hour)

service:
  timeout: 10
EOF

popd    1>/dev/null


#-----------------------------
#-----------------------------
# SWAN_MANAGER yaml
#-----------------------------
#-----------------------------
pushd .  1>/dev/null
cd ${MANAGER_PROJECT}

cat > swan-manager.yml <<EOF
# Copyright 2025 Amiasys Corporation and/or its affiliates. All rights reserved.

services:
  asn-mdb:
    container_name: asn-mdb
    image: mongo:8  # the mongodb version
    restart: always   # auto restart the container if it fails
    ulimits:
      nofile: 100000
    environment:
      MONGO_INITDB_ROOT_USERNAME: amia  # db root username,
      MONGO_INITDB_ROOT_PASSWORD: 2022  # db root user password
    ports:
      - "27017:27017"  # port forwarding (localPort:containerPort)
    volumes:
      - mongodb_data:/data/db  # data volumes, (localDirectory:containerDirectory)
      - /etc/localtime:/etc/localtime
    command: --bind_ip_all --auth
    networks:
      - swan-network
  asn-idb:
    image: influxdb:2.7
    container_name: asn-idb
    ports:
      - 8086:8086
    environment:
      DOCKER_INFLUXDB_INIT_MODE: setup
      DOCKER_INFLUXDB_INIT_USERNAME_FILE: /run/secrets/influxdb2-admin-username
      DOCKER_INFLUXDB_INIT_PASSWORD_FILE: /run/secrets/influxdb2-admin-password
      DOCKER_INFLUXDB_INIT_ADMIN_TOKEN_FILE: /run/secrets/influxdb2-admin-token
      DOCKER_INFLUXDB_INIT_ORG: amia
      DOCKER_INFLUXDB_INIT_BUCKET: asn
    secrets:
      - influxdb2-admin-username
      - influxdb2-admin-password
      - influxdb2-admin-token
    volumes:
      - type: volume
        source: influxdb2-data
        target: /var/lib/influxdb2
      - type: volume
        source: influxdb2-config
        target: /etc/influxdb2
      - /etc/localtime:/etc/localtime
    networks:
      - swan-network
  sapphire-iam:
    image: registry.amiasys.com/sapphire.iam:${IAM_VERSION}
    container_name: sapphire-iam
    privileged: true
    restart: always
    environment:
      - TZ=${IAM_DOCKER_TIMEZONE}
    depends_on:
      - "asn-mdb"
    ports:
      - "17930:17930"
      - "17931:17931"
    volumes:
      - ./cert/:${IAM_DOCKER_CERT}
      - ./config/:${IAM_DOCKER_CONFIG}
      - ./log/iam/:/var/log/sapphire/
    networks:
      - swan-network
  swan-manager:
    image: registry.amianetworks.com.cn/swan/swan-manager:${SWAN_MANAGER_VERSION}
    container_name: swan-manager
    restart: always
    network_mode: host
    depends_on:
      - "asn-mdb"
      - "asn-idb"
      - "sapphire-iam"
    volumes:
      - ./cert/:${ASNC_DOCKER_CERT}
      - ./config/:/asn/config
      - ./log/asn/:/var/log/asn/controller
      - /usr/local/swan-manager:/usr/local/swan-manager
      - /etc/localtime:/etc/localtime

secrets:
  influxdb2-admin-username:
    file: ~/.env.influxdb2-admin-username
  influxdb2-admin-password:
    file: ~/.env.influxdb2-admin-password
  influxdb2-admin-token:
    file: ~/.env.influxdb2-admin-token

volumes:
  mongodb_data:
    driver: local
  influxdb2-data:
    driver: local
  influxdb2-config:

networks:
  swan-network:
    driver: bridge
    ipam:
      config:
        - subnet: "172.33.0.0/24"
          gateway: "172.33.0.1"
EOF

popd    1>/dev/null
