Skip to content

Commit 3fa7510

Browse files
committed
Normalize event-manager compose; add to install-chaos Tier 2
apps/event-manager/docker-compose.yml: - IMAGE_TAG -> IMAGE_VERSION; add ${REDIS_IMAGE_VERSION:-7-alpine} for redis - Add container_name/hostname to redis (event-manager-redis) and sidekiq (event-manager-sidekiq) - restart: always -> unless-stopped on redis and sidekiq - Internal redis network em-redis -> event-manager-redis-net - Use service_healthy condition on depends_on - Remove proxy network from sidekiq (background worker, no HTTP) - Unify sidekiq log volume to ../../log/event-manager (same as web) - Rename network alias mailer -> mail to match project convention - Delete backup file docker-compose.yml~ - Add .env.example, README.md, .rsync-exclude bin/install-chaos.sh: - Add event-manager to Tier 2 (needs proxy, db, mail/postfix-net) Made-with: Cursor
1 parent 44e475a commit 3fa7510

5 files changed

Lines changed: 172 additions & 0 deletions

File tree

apps/event-manager/.env.example

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Rails environment
2+
RAILS_ENV=production
3+
SECRET_KEY_BASE=
4+
5+
# Database (connects via postgres-net)
6+
DATABASE_URL=postgresql://event_manager:password@postgresql:5432/event_manager_production
7+
8+
# Redis (internal event-manager-redis container)
9+
REDIS_URL=redis://event-manager-redis:6379/0
10+
11+
# Outbound email via postfix (connects via postfix-net)
12+
SMTP_HOST=postfix
13+
SMTP_PORT=587
14+
SMTP_FROM=noreply@example.com
15+
16+
# Application URL
17+
APP_HOST=events.example.com
18+
19+
# Image versions (optional, defaults shown)
20+
#IMAGE_VERSION=latest
21+
#REDIS_IMAGE_VERSION=7-alpine

apps/event-manager/.rsync-exclude

Whitespace-only changes.

apps/event-manager/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# event-manager
2+
3+
PDX Hackerspace event management application. Rails web app with a Sidekiq
4+
background job worker and a private Redis instance for job queuing.
5+
6+
Image: [romkey/pdxhackerspace-eventmanager](https://github.com/romkey/pdxhackerspace-eventmanager)
7+
8+
## Services
9+
10+
| Container | Role |
11+
|-----------|------|
12+
| `event-manager` | Rails web server (port 3000, behind reverse proxy) |
13+
| `event-manager-sidekiq` | Sidekiq background job worker |
14+
| `event-manager-redis` | Private Redis instance for job queuing (not shared) |
15+
16+
## Network dependencies
17+
18+
| Network | Provided by | Purpose |
19+
|---------|-------------|---------|
20+
| `nginx-proxy-net` | nginx-proxy-manager | Reverse proxy access |
21+
| `postgres-net` | postgresql | Database |
22+
| `postfix-net` | postfix | Outbound email |
23+
24+
## Configuration
25+
26+
### Environment Variables
27+
28+
Copy `.env.example` to `.env` and configure:
29+
30+
```bash
31+
cp .env.example .env
32+
```
33+
34+
| Variable | Description |
35+
|----------|-------------|
36+
| `RAILS_ENV` | Rails environment (`production`) |
37+
| `SECRET_KEY_BASE` | Rails secret key — generate with `openssl rand -hex 64` |
38+
| `DATABASE_URL` | PostgreSQL connection URL |
39+
| `REDIS_URL` | Redis connection URL (points to internal `event-manager-redis`) |
40+
| `SMTP_HOST` | SMTP server hostname (default: `postfix` via postfix-net) |
41+
| `SMTP_PORT` | SMTP port |
42+
| `SMTP_FROM` | From address for outgoing mail |
43+
| `APP_HOST` | Public hostname for URL generation |
44+
| `IMAGE_VERSION` | Web/sidekiq image tag (optional, defaults to `latest`) |
45+
| `REDIS_IMAGE_VERSION` | Redis image tag (optional, defaults to `7-alpine`) |
46+
47+
## Usage
48+
49+
### Starting the service
50+
51+
```bash
52+
docker compose up -d
53+
```
54+
55+
### Stopping the service
56+
57+
```bash
58+
docker compose down
59+
```
60+
61+
### Viewing logs
62+
63+
```bash
64+
docker compose logs -f
65+
```
66+
67+
### Running Rails tasks
68+
69+
```bash
70+
docker compose exec web bundle exec rails <task>
71+
```
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
services:
2+
web:
3+
image: ghcr.io/romkey/pdxhackerspace-eventmanager:${IMAGE_VERSION:-latest}
4+
container_name: event-manager
5+
hostname: event-manager
6+
restart: unless-stopped
7+
command: bash -c "rm -f tmp/pids/server.pid && bundle exec puma -C config/puma.rb"
8+
env_file:
9+
- .env
10+
networks:
11+
- db
12+
- proxy
13+
- redis
14+
- mail
15+
volumes:
16+
- ../../lib/event-manager/storage:/app/storage
17+
- ../../log/event-manager:/app/log
18+
depends_on:
19+
redis:
20+
condition: service_healthy
21+
healthcheck:
22+
test: ["CMD-SHELL", "curl -f http://localhost:3000/health/liveness || exit 1"]
23+
interval: 30s
24+
timeout: 10s
25+
retries: 3
26+
start_period: 40s
27+
28+
redis:
29+
image: redis:${REDIS_IMAGE_VERSION:-7-alpine}
30+
container_name: event-manager-redis
31+
hostname: event-manager-redis
32+
restart: unless-stopped
33+
volumes:
34+
- ../../lib/event-manager/redis:/data
35+
networks:
36+
- redis
37+
healthcheck:
38+
test: ["CMD", "redis-cli", "ping"]
39+
interval: 10s
40+
timeout: 5s
41+
retries: 5
42+
43+
sidekiq:
44+
image: ghcr.io/romkey/pdxhackerspace-eventmanager:${IMAGE_VERSION:-latest}
45+
container_name: event-manager-sidekiq
46+
hostname: event-manager-sidekiq
47+
restart: unless-stopped
48+
command: bundle exec sidekiq -C config/sidekiq.yml
49+
env_file:
50+
- .env
51+
networks:
52+
- db
53+
- redis
54+
- mail
55+
volumes:
56+
- ../../log/event-manager:/app/log
57+
depends_on:
58+
redis:
59+
condition: service_healthy
60+
healthcheck:
61+
test: ["CMD-SHELL", "bundle exec rails runner 'exit(Sidekiq::ProcessSet.new.size > 0 ? 0 : 1)' || exit 1"]
62+
interval: 30s
63+
timeout: 10s
64+
retries: 3
65+
start_period: 30s
66+
67+
networks:
68+
redis:
69+
name: event-manager-redis-net
70+
proxy:
71+
external: true
72+
name: nginx-proxy-net
73+
db:
74+
external: true
75+
name: postgres-net
76+
mail:
77+
external: true
78+
name: postfix-net

bin/install-chaos.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
3434
# peanut needs: proxy
3535
#
3636
# Tier 2 - needs proxy + db, mariadb, mqtt, llama, or mail
37+
# event-manager needs: proxy, db, mail
3738
# invidious needs: proxy, db
3839
# member-manager needs: proxy, db, mail
3940
# partdb needs: proxy, db
@@ -76,6 +77,7 @@ dozzle
7677
glances
7778
cyberchef
7879
peanut
80+
event-manager
7981
invidious
8082
member-manager
8183
partdb

0 commit comments

Comments
 (0)