Skip to content

Commit

Permalink
incorporate container and management changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-nork committed Jul 13, 2023
1 parent 6949635 commit e5bd41e
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 35 deletions.
33 changes: 14 additions & 19 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"name": "Python 3",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers-contrib/features/rabbitmq-asdf:1": {
"version": "latest",
"erlangVersion": "latest"
},
"ghcr.io/devcontainers-contrib/features/vault-asdf:2": {
"version": "latest"
}
},
"settings": {
"terminal.integrated.defaultProfile.linux": "/usr/bin/fish"
},
"remoteUser": "vscode"
}
"name": "Python 3",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers-contrib/features/rabbitmq-asdf:1": {},
"ghcr.io/devcontainers-contrib/features/vault-asdf:2": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"forwardPorts": [4369, 5672, 6379, 8000],
"postCreateCommand": "docker-compose up -d",
"runServices": ["redis", "celery", "rabbitmq", "vault"]
}
77 changes: 64 additions & 13 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
version: '3.8'

services:
app:
image: mcr.microsoft.com/devcontainers/python:0-3.11
volumes:
- ..:/workspace:cached
command: sleep infinity

redis:
image: redis-stack:latest
ports:
- 6379:6379
version: '3.8'

services:
app:
image: mcr.microsoft.com/devcontainers/python:0-3.11
volumes:
- ..:/workspace:cached
command: sleep infinity
depends_on:
- redis
- celery
- rabbitmq
- vault
networks:
default:
aliases:
- localhost

celery:
build:
context: .
dockerfile: Dockerfile.celery
volumes:
- .:/workspace:cached
depends_on:
- rabbitmq
networks:
default:
aliases:
- localhost

redis:
image: redis/redis-stack:latest
ports:
- 6379:6379
networks:
default:
aliases:
- localhost

rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
- 15672:15672
networks:
default:
aliases:
- localhost

vault:
image: hashicorp/vault:latest
ports:
- 8200:8200
environment:
VAULT_DEV_ROOT_TOKEN_ID: myroot
VAULT_DEV_LISTEN_ADDRESS: 0.0.0.0:8200
networks:
default:
aliases:
- localhost

networks:
default:
6 changes: 3 additions & 3 deletions chirps/base_app/management/commands/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def add_arguments(self, parser):
def handle(self, *args, **options):
"""Handle redis command"""
if options['start']:
os.system('redis-server --daemonize yes')
os.system('docker-compose -f /workspace/.devcontainer/docker-compose.yml up -d redis')
elif options['stop']:
os.system('redis-cli shutdown')
os.system('docker-compose -f /workspace/.devcontainer/docker-compose.yml down')
elif options['status']:
os.system('redis-cli ping')
os.system('docker-compose -f /workspace/.devcontainer/docker-compose.yml ps')

0 comments on commit e5bd41e

Please sign in to comment.