Skip to content

Commit

Permalink
feat: add docker compose deployment configuration
Browse files Browse the repository at this point in the history
feat: update ci-docker-deployment.yaml

feat: update ci-docker-deployment.yaml
  • Loading branch information
wojtekzyla committed Mar 5, 2024
1 parent d26ba44 commit 85e338b
Show file tree
Hide file tree
Showing 26 changed files with 1,095 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/ci-docker-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: create-compose-files
on:
push:
branches:
- feat/docker-compose-deployment

jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
strategy:
matrix:
python-version:
- 3.9
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Zip docker_compose directory and upload
run: |
zip -r docker_compose.zip docker_compose
gh release upload $VERSION docker_compose.zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: docker_compose.zip
env:
ARTIFACT_NAME: docker_compose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ celerybeat.pid

# Environments
.env
!docker_compose/.env
.venv
env/
venv/
Expand Down
30 changes: 29 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,34 @@
}
],
"countMatches": true
},
{
"files": ["docker_compose/.env"],
"from": "^SC4SNMP_TAG=.*",
"to": "SC4SNMP_TAG=\"${nextRelease.version}\"",
"results": [
{
"file": "pyproject.toml",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
},
{
"files": ["docker_compose/.env"],
"from": "^SC4SNMP_VERSION=.*",
"to": "SC4SNMP_VERSION=\"${nextRelease.version}\"",
"results": [
{
"file": "pyproject.toml",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}
],
"countMatches": true
}
]
}
Expand All @@ -66,7 +94,7 @@
[
"@semantic-release/git",
{
"assets": ["NOTICE", "charts/splunk-connect-for-snmp/Chart.yaml", "pyproject.toml", "splunk_connect_for_snmp/__init__.py"],
"assets": ["NOTICE", "charts/splunk-connect-for-snmp/Chart.yaml", "pyproject.toml", "splunk_connect_for_snmp/__init__.py", "docker_compose/.env"],
"message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}",
},
],
Expand Down
66 changes: 66 additions & 0 deletions docker_compose/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Deployment configuration
SC4SNMP_IMAGE=ghcr.io/splunk/splunk-connect-for-snmp/container
SC4SNMP_TAG=latest
SCHEDULER_CONFIG_FILE_ABSOLUTE_PATH=
TRAPS_CONFIG_FILE_ABSOLUTE_PATH=
INVENTORY_FILE_ABSOLUTE_PATH=
COREFILE_ABS_PATH=
COREDNS_ADDRESS=172.28.0.255
SC4SNMP_VERSION=1.10.0-beta.4

# Dependencies images
COREDNS_IMAGE=coredns/coredns
COREDNS_TAG=1.11.1
MIBSERVER_IMAGE=ghcr.io/pysnmp/mibs/container
MIBSERVER_TAG=latest
REDIS_IMAGE=docker.io/bitnami/redis
REDIS_TAG=7.2.1-debian-11-r0
MONGO_IMAGE=docker.io/bitnami/mongodb
MONGO_TAG=6.0.9-debian-11-r5

# Splunk instance configuration
SPLUNK_HEC_HOST=
SPLUNK_HEC_PROTOCOL=https
SPLUNK_HEC_PORT=8088
SPLUNK_HEC_TOKEN=
SPLUNK_HEC_INSECURESSL=false
SPLUNK_SOURCETYPE_TRAPS=sc4snmp:traps
SPLUNK_SOURCETYPE_POLLING_EVENTS=sc4snmp:event
SPLUNK_SOURCETYPE_POLLING_METRICS=sc4snmp:metric
SPLUNK_HEC_INDEX_EVENTS=netops
SPLUNK_HEC_INDEX_METRICS=netmetrics
SPLUNK_HEC_PATH=/services/collector
SPLUNK_AGGREGATE_TRAPS_EVENTS=false
IGNORE_EMPTY_VARBINDS=false

# Workers configration
WALK_RETRY_MAX_INTERVAL=180
WALK_MAX_RETRIES=5
METRICS_INDEXING_ENABLED=false
POLL_BASE_PROFILES=true
IGNORE_NOT_INCREASING_OIDS=
WORKER_LOG_LEVEL=INFO
UDP_CONNECTION_TIMEOUT=3
MAX_OID_TO_PROCESS=70
WORKER_POLLER_CONCURRENCY=4
WORKER_SENDER_CONCURRENCY=4
WORKER_TRAP_CONCURRENCY=4
PREFETCH_POLLER_COUNT=1
PREFETCH_SENDER_COUNT=30
PREFETCH_TRAP_COUNT=30
RESOLVE_TRAP_ADDRESS=false
MAX_DNS_CACHE_SIZE_TRAPS=500
TTL_DNS_CACHE_TRAPS=1800

# Inventory configuration
INVENTORY_LOG_LEVEL=INFO
CHAIN_OF_TASKS_EXPIRY_TIME=500

# Traps configuration
SNMP_V3_SECURITY_ENGINE_ID=80003a8c04
TRAPS_PORT=162

# Scheduler configuration
SCHEDULER_LOG_LEVEL=INFO

#Secrets
7 changes: 7 additions & 0 deletions docker_compose/Corefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.:53 {
log
errors
auto
reload
forward . 8.8.8.8
}
15 changes: 15 additions & 0 deletions docker_compose/docker-compose-coredns.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.8'
services:
coredns:
image: ${COREDNS_IMAGE}:${COREDNS_TAG:-latest}
command: ["-conf", "/Corefile"]
container_name: coredns
restart: on-failure
expose:
- '53'
- '53/udp'
volumes:
- '${COREFILE_ABS_PATH}:/Corefile'
networks:
my_network:
ipv4_address: ${COREDNS_ADDRESS}
40 changes: 40 additions & 0 deletions docker_compose/docker-compose-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: '3.8'
services:
snmp-mibserver:
image: ${MIBSERVER_IMAGE}:${MIBSERVER_TAG:-latest}
container_name: snmp-mibserver
environment:
- NGINX_ENTRYPOINT_QUIET_LOGS=${NGINX_ENTRYPOINT_QUIET_LOGS:-1}
volumes:
- snmp-mibserver-tmp:/tmp/
depends_on:
- coredns
networks:
my_network:
dns:
- ${COREDNS_ADDRESS}

redis:
image: ${REDIS_IMAGE}:${REDIS_TAG:-latest}
container_name: redis
restart: always
environment:
- ALLOW_EMPTY_PASSWORD=yes
depends_on:
- coredns
networks:
my_network:
dns:
- ${COREDNS_ADDRESS}
mongo:
image: ${MONGO_IMAGE}:${MONGO_TAG:-latest}
container_name: mongo
restart: always
depends_on:
- coredns
networks:
my_network:
dns:
- ${COREDNS_ADDRESS}
volumes:
snmp-mibserver-tmp:
36 changes: 36 additions & 0 deletions docker_compose/docker-compose-inventory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: '3.8'
services:
inventory:
image: ${SC4SNMP_IMAGE}:${SC4SNMP_TAG:-latest}
container_name: sc4snmp-inventory
command: ["inventory"]
environment:
- CONFIG_PATH=/app/config/config.yaml
- REDIS_URL=redis://redis:6379/1
- CELERY_BROKER_URL=redis://redis:6379/0
- MONGO_URI=mongodb://mongo:27017/
- MIB_SOURCES=http://snmp-mibserver:8000/asn1/@mib@
- MIB_INDEX=http://snmp-mibserver:8000/index.csv
- MIB_STANDARD=http://snmp-mibserver:8000/standard.txt

# Inventory configuration
- LOG_LEVEL=${INVENTORY_LOG_LEVEL:-INFO}
- CHAIN_OF_TASKS_EXPIRY_TIME=${CHAIN_OF_TASKS_EXPIRY_TIME:-500}
- CONFIG_FROM_MONGO=${CONFIG_FROM_MONGO:-false}
depends_on:
- redis
- mongo
- coredns
volumes:
- ${SCHEDULER_CONFIG_FILE_ABSOLUTE_PATH}:/app/config/config.yaml
- ${INVENTORY_FILE_ABSOLUTE_PATH}:/app/inventory/inventory.csv
- inventory-pysnmp-cache-volume:/.pysnmp/
- inventory-tmp:/tmp/
restart: on-failure
networks:
my_network:
dns:
- ${COREDNS_ADDRESS}
volumes:
inventory-tmp:
inventory-pysnmp-cache-volume:
7 changes: 7 additions & 0 deletions docker_compose/docker-compose-network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3.8'
networks:
my_network:
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
34 changes: 34 additions & 0 deletions docker_compose/docker-compose-scheduler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.8'
services:
scheduler:
image: ${SC4SNMP_IMAGE}:${SC4SNMP_TAG:-latest}
container_name: sc4snmp-scheduler
command: ["celery", "beat"]
environment:
- CONFIG_PATH=/app/config/config.yaml
- REDIS_URL=redis://redis:6379/1
- CELERY_BROKER_URL=redis://redis:6379/0
- MONGO_URI=mongodb://mongo:27017/
- MIB_SOURCES=http://snmp-mibserver:8000/asn1/@mib@
- MIB_INDEX=http://snmp-mibserver:8000/index.csv
- MIB_STANDARD=http://snmp-mibserver:8000/standard.txt
- INVENTORY_REFRESH_RATE=${INVENTORY_REFRESH_RATE:-600}

# Scheduler configuration
- LOG_LEVEL=${SCHEDULER_LOG_LEVEL:-INFO}
depends_on:
- redis
- mongo
- coredns
volumes:
- ${SCHEDULER_CONFIG_FILE_ABSOLUTE_PATH}:/app/config/config.yaml
- scheduler-pysnmp-cache-volume:/.pysnmp/
- scheduler-tmp:/tmp/
restart: on-failure
networks:
my_network:
dns:
- ${COREDNS_ADDRESS}
volumes:
scheduler-tmp:
scheduler-pysnmp-cache-volume:
2 changes: 2 additions & 0 deletions docker_compose/docker-compose-secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
secrets: {}
version: '3.8'
46 changes: 46 additions & 0 deletions docker_compose/docker-compose-traps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
services:
traps:
command:
- trap
container_name: sc4snmp-traps
depends_on:
- redis
- mongo
- coredns
dns:
- ${COREDNS_ADDRESS}
environment:
- CONFIG_PATH=/app/config/config.yaml
- REDIS_URL=redis://redis:6379/1
- CELERY_BROKER_URL=redis://redis:6379/0
- MONGO_URI=mongodb://mongo:27017/
- MIB_SOURCES=http://snmp-mibserver:8000/asn1/@mib@
- MIB_INDEX=http://snmp-mibserver:8000/index.csv
- MIB_STANDARD=http://snmp-mibserver:8000/standard.txt
- LOG_LEVEL=${SCHEDULER_LOG_LEVEL:-INFO}
- INVENTORY_REFRESH_RATE=${INVENTORY_REFRESH_RATE:-600}
- SPLUNK_HEC_HOST=${SPLUNK_HEC_HOST}
- SPLUNK_HEC_SCHEME=${SPLUNK_HEC_PROTOCOL:-https}
- SPLUNK_HEC_PORT=${SPLUNK_HEC_PORT}
- SPLUNK_HEC_TOKEN=${SPLUNK_HEC_TOKEN}
- SPLUNK_HEC_INSECURESSL=${SPLUNK_HEC_INSECURESSL:-false}
- SPLUNK_HEC_PATH=${SPLUNK_HEC_PATH:-/services/collector}
- SNMP_V3_SECURITY_ENGINE_ID=${SNMP_V3_SECURITY_ENGINE_ID:-80003a8c04}
image: ${SC4SNMP_IMAGE}:${SC4SNMP_TAG:-latest}
networks:
my_network: null
ports:
- mode: host
protocol: udp
published: ${TRAPS_PORT}
target: 2162
restart: on-failure
secrets: []
volumes:
- ${TRAPS_CONFIG_FILE_ABSOLUTE_PATH}:/app/config/config.yaml
- traps-pysnmp-cache-volume:/.pysnmp/
- traps-tmp:/tmp/
version: '3.8'
volumes:
traps-pysnmp-cache-volume: null
traps-tmp: null
Loading

0 comments on commit 85e338b

Please sign in to comment.