Skip to content

Commit 9c248df

Browse files
Add Laravel queue worker to startup (#613)
Co-authored-by: Dave Earley <[email protected]>
1 parent 1836ada commit 9c248df

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

docker/all-in-one/.env

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ VITE_STRIPE_PUBLISHABLE_KEY=pk_test_123456789
1313
# Please refer to the documentation for more information on how to configure these values
1414
# https://hi.events/docs/getting-started/deploying
1515
LOG_CHANNEL=stderr
16-
QUEUE_CONNECTION=sync
16+
QUEUE_CONNECTION=redis
1717

1818
# Application settings
1919
APP_CDN_URL=http://localhost:8123/storage
@@ -45,3 +45,8 @@ DATABASE_URL=postgresql://postgres:secret@postgres:5432/hi-events
4545
STRIPE_PUBLIC_KEY=pk_test_123456789
4646
STRIPE_SECRET_KEY=sk_test_123456789
4747
STRIPE_WEBHOOK_SECRET=whsec_test_123456789
48+
49+
# Redis settings
50+
REDIS_HOST=redis
51+
REDIS_PASSWORD=
52+
REDIS_PORT=6379

docker/all-in-one/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ JWT_SECRET=your_generated_jwt_secret
5050
### Step 4: Start the Docker Containers
5151

5252
```bash
53-
docker-compose up -d
53+
docker compose up -d
5454
```
5555

5656
### Step 5: Create an Account

docker/all-in-one/docker-compose.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ services:
66
container_name: all-in-one
77
ports:
88
- "8123:80"
9+
networks:
10+
- hi-events-network
911
environment:
1012
- VITE_FRONTEND_URL=${VITE_FRONTEND_URL}
1113
- VITE_API_URL_CLIENT=${VITE_API_URL_CLIENT}
@@ -35,17 +37,40 @@ services:
3537
- FILESYSTEM_PUBLIC_DISK=${FILESYSTEM_PUBLIC_DISK}
3638
- FILESYSTEM_PRIVATE_DISK=${FILESYSTEM_PRIVATE_DISK}
3739
- DATABASE_URL=postgresql://postgres:secret@postgres:5432/hi-events
40+
- REDIS_HOST=redis
41+
- REDIS_PASSWORD=
42+
- REDIS_PORT=6379
3843
- STRIPE_PUBLIC_KEY=${STRIPE_PUBLIC_KEY}
3944
- STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY}
4045
- STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET}
46+
- WEBHOOK_QUEUE_NAME=webhook-queue
4147

4248
depends_on:
4349
postgres:
4450
condition: service_healthy
51+
redis:
52+
condition: service_healthy
53+
54+
redis:
55+
image: redis:latest
56+
container_name: redis
57+
networks:
58+
- hi-events-network
59+
healthcheck:
60+
test: [ "CMD", "redis-cli", "ping" ]
61+
interval: 10s
62+
timeout: 5s
63+
retries: 5
64+
ports:
65+
- "6379:6379"
66+
volumes:
67+
- redisdata:/data
4568

4669
postgres:
4770
image: postgres:latest
4871
container_name: postgres
72+
networks:
73+
- hi-events-network
4974
healthcheck:
5075
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
5176
interval: 10s
@@ -58,5 +83,12 @@ services:
5883
volumes:
5984
- pgdata:/var/lib/postgresql/data
6085

86+
networks:
87+
hi-events-network:
88+
driver: bridge
89+
6190
volumes:
6291
pgdata:
92+
driver: local
93+
redisdata:
94+
driver: local

docker/all-in-one/supervisor/supervisord.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,14 @@ redirect_stderr=true
3535
stdout_logfile_maxbytes = 0
3636
stderr_logfile_maxbytes = 0
3737
environment=NODE_ENV="production",VITE_API_URL_CLIENT="%(ENV_VITE_API_URL_CLIENT)s",VITE_API_URL_SERVER="http://localhost:80/api",VITE_FRONTEND_URL="%(ENV_VITE_FRONTEND_URL)s",VITE_STRIPE_PUBLISHABLE_KEY="%(ENV_VITE_STRIPE_PUBLISHABLE_KEY)s"
38+
39+
[program:laravel-queue-worker]
40+
command=php /app/backend/artisan queue:work --queue=default,webhook-queue --sleep=3 --tries=3 --timeout=60
41+
autostart=true
42+
autorestart=true
43+
user=www-data
44+
stdout_logfile=/dev/stdout
45+
stderr_logfile=/dev/stderr
46+
redirect_stderr=true
47+
stdout_logfile_maxbytes=0
48+
stderr_logfile_maxbytes=0

0 commit comments

Comments
 (0)