Skip to content

Commit

Permalink
Cleaning up a bit and removing the load pieces
Browse files Browse the repository at this point in the history
  • Loading branch information
madflojo committed Jun 8, 2024
1 parent bd7835a commit 7464873
Show file tree
Hide file tree
Showing 8 changed files with 139 additions and 30 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/load.yml

This file was deleted.

10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ docker-compose:
sleep 15
docker compose up data-manager lookup

docker-compose-background:
docker compose up -d mysql redis
sleep 15
docker compose up -d data-manager lookup

loadtest-setup:
docker compose -f load-compose.yml up -d mysql
sleep 15
Expand All @@ -35,10 +40,13 @@ run: build docker-compose
run-nobuild: docker-compose
run-background: build docker-compose-background
run-stress: build loadtest-setup
sleep 600
k6 run --config tests/k6/stress.json tests/k6/script.js
run-soak: build loadtest-setup
sleep 600
k6 run --config tests/k6/soak.json tests/k6/script.js
run-steady: build loadtest-setup
run-steady: build docker-compose-background
sleep 600
k6 run --config tests/k6/steady.json tests/k6/script.js


Expand Down
40 changes: 40 additions & 0 deletions config/tarmac-data-manager.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"services": {
"airport-lookup": {
"name": "airport-lookup",
"functions": {
"init": {
"filepath": "/functions/data/init.wasm",
"pool_size": 1
},
"load": {
"filepath": "/functions/data/load.wasm",
"pool_size": 1
},
"fetch": {
"filepath": "/functions/data/fetch.wasm",
"pool_size": 1
}
},
"routes": [
{
"type": "init",
"function": "init"
},
{
"type": "scheduled_task",
"function": "load",
"frequency": 300
},
{
"type": "function",
"function": "load"
},
{
"type": "function",
"function": "fetch"
}
]
}
}
}
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- "APP_LISTEN_ADDR=0.0.0.0:8080"
- "APP_DEBUG=false"
- "APP_TRACE=false"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac-basic.json"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac-lookup.json"
- "APP_ENABLE_SQL=true"
- "APP_SQL_TYPE=mysql"
- "APP_SQL_DSN=root:example@tcp(mysql:3306)/example"
Expand Down Expand Up @@ -45,7 +45,7 @@ services:
- "APP_LISTEN_ADDR=0.0.0.0:8080"
- "APP_DEBUG=false"
- "APP_TRACE=false"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac.json"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmaci-data-manager.json"
- "APP_ENABLE_SQL=true"
- "APP_SQL_TYPE=mysql"
- "APP_SQL_DSN=root:example@tcp(mysql:3306)/example"
Expand Down
4 changes: 2 additions & 2 deletions load-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- "APP_LISTEN_ADDR=0.0.0.0:8080"
- "APP_DEBUG=false"
- "APP_TRACE=false"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac-basic.json"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac-lookup.json"
- "APP_ENABLE_SQL=true"
- "APP_SQL_TYPE=mysql"
- "APP_SQL_DSN=root:example@tcp(mysql:3306)/example"
Expand Down Expand Up @@ -43,7 +43,7 @@ services:
- "APP_LISTEN_ADDR=0.0.0.0:8080"
- "APP_DEBUG=false"
- "APP_TRACE=false"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac.json"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac-data-manager.json"
- "APP_ENABLE_SQL=true"
- "APP_SQL_TYPE=mysql"
- "APP_SQL_DSN=root:example@tcp(mysql:3306)/example"
Expand Down
86 changes: 86 additions & 0 deletions monolith-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
version: '3.8'
services:
lookup:
container_name: lookup
image: madflojo/tarmac:unstable
ports:
- 80:8080
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/ready"]
interval: 10s
timeout: 5s
retries: 3
environment:
- "APP_ENABLE_TLS=false"
- "APP_LISTEN_ADDR=0.0.0.0:8080"
- "APP_DEBUG=false"
- "APP_TRACE=false"
- "APP_WASM_FUNCTION_CONFIG=/config/tarmac-monolith.json"
- "APP_ENABLE_SQL=true"
- "APP_SQL_TYPE=mysql"
- "APP_SQL_DSN=root:example@tcp(mysql:3306)/example"
- "APP_ENABLE_KVSTORE=true"
- "APP_KVSTORE_TYPE=redis"
- "APP_REDIS_SERVER=redis:6379"
volumes:
- "./config:/config"
- "./functions/build:/functions"
depends_on:
- mysql
- redis
- grafana

# Dependencies
mysql:
container_name: mysql
image: bitnami/mysql:latest
restart: unless-stopped
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 3
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: example
ports:
- 3306:3306
redis:
container_name: redis
image: bitnami/redis:latest
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
environment:
- ALLOW_EMPTY_PASSWORD=yes
prometheus:
image: prom/prometheus
container_name: prometheus
command:
- '--config.file=/config/prometheus.yml'
ports:
- 9090:9090
restart: unless-stopped
volumes:
- ./config:/config
- prom_data:/prometheus
grafana:
image: grafana/grafana
container_name: grafana
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_PASSWORD=example
volumes:
- ./config/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasource.yml
- ./config/grafana/dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml
- ./config/grafana/dashboards:/var/lib/grafana/dashboards
depends_on:
- prometheus

volumes:
prom_data:

0 comments on commit 7464873

Please sign in to comment.