Skip to content

Commit 4e00df8

Browse files
committed
update dev environment
1 parent 54096c7 commit 4e00df8

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

development/docker-compose.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ services:
55
env_file: "creds.env"
66
redis:
77
image: "redis:latest"
8+
proxy:
9+
image: "haproxy:latest"
10+
volumes:
11+
- ./haproxy:/usr/local/etc/haproxy
12+
ports:
13+
- "80:80"
14+
links:
15+
- "app"
816
worker:
917
build:
1018
context: ../
@@ -19,13 +27,13 @@ services:
1927
- "db"
2028
- "redis"
2129
command: ["celery", "-A", "netopsio", "worker", "-l", "INFO"]
22-
frontend:
30+
app:
2331
build:
2432
context: ../
2533
dockerfile: ./development/Dockerfile
2634
env_file: "creds.env"
2735
ports:
28-
- "80:8000"
36+
- "8000:8000"
2937
volumes:
3038
- ../netopsio:/opt/netopsio
3139
depends_on:

development/haproxy/haproxy.cfg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
defaults
2+
timeout connect 10s
3+
timeout client 30s
4+
timeout server 30s
5+
log global
6+
mode http
7+
option httplog
8+
maxconn 3000
9+
10+
frontend http_server
11+
bind 0.0.0.0:80
12+
default_backend app_server
13+
14+
backend app_server
15+
balance roundrobin
16+
option forwardfor
17+
server app1 app:8000

tasks.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def linting(context):
9393

9494

9595
@task
96-
def unittest(context, container="frontend"):
96+
def unittest(context, container="app"):
9797
"""Execute Unit Tests."""
9898
command = "python manage.py test"
9999
docker_compose(context, f"exec {container} {command}", pty=True)
@@ -151,18 +151,18 @@ def destroy(context):
151151

152152

153153
@task(help={"container": "Name of the container to shell into"})
154-
def cli(context, container="frontend"):
154+
def cli(context, container="app"):
155155
"""Launch a bash shell inside the running NetOps.io container."""
156156
docker_compose(context, f"exec {container} bash", pty=True)
157157

158158

159159
@task(
160160
help={
161161
"user": "Name of the superuser to create. (Default: admin)",
162-
"container": "Name of the container to run the 'createsuperuser' command on. (Default: frontend)",
162+
"container": "Name of the container to run the 'createsuperuser' command on. (Default: app)",
163163
}
164164
)
165-
def createsuperuser(context, user="admin", container="frontend"):
165+
def createsuperuser(context, user="admin", container="app"):
166166
"""Create a new NetOps.io superuser account (default: "admin"), will prompt for password."""
167167
command = f"python manage.py createsuperuser --username {user}"
168168
docker_compose(context, f"exec {container} {command}", pty=True)
@@ -171,10 +171,10 @@ def createsuperuser(context, user="admin", container="frontend"):
171171
@task(
172172
help={
173173
"name": "Use this name for migration file(s). If unspecified, a name will be generated.",
174-
"container": "Name of the container to run the 'makemigrations' command on. (Default: frontend)",
174+
"container": "Name of the container to run the 'makemigrations' command on. (Default: app)",
175175
}
176176
)
177-
def makemigrations(context, name="", container="frontend"):
177+
def makemigrations(context, name="", container="app"):
178178
"""Perform makemigrations operation in Django."""
179179
command = "python manage.py makemigrations"
180180

@@ -185,10 +185,10 @@ def makemigrations(context, name="", container="frontend"):
185185

186186
@task(
187187
help={
188-
"container": "Name of the container to run the 'migrate' command on. (Default: frontend)"
188+
"container": "Name of the container to run the 'migrate' command on. (Default: app)"
189189
}
190190
)
191-
def migrate(context, container="frontend"):
191+
def migrate(context, container="app"):
192192
"""Perform migrate operation in Django."""
193193
command = "python manage.py migrate"
194194
docker_compose(context, f"exec {container} {command}", pty=True)

0 commit comments

Comments
 (0)