Skip to content

Commit d3075bb

Browse files
committed
Fixing docker errors and setting up celery properly
1 parent fa84e75 commit d3075bb

7 files changed

Lines changed: 35 additions & 6 deletions

File tree

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
static/
1+

.github/workflows/publish-image.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,15 @@ jobs:
4040
image_tag: ${{ env.TAG }}
4141
github_token: ${{ secrets.GITHUB_TOKEN }}
4242
# optionally push to the Docker Hub (docker.io)
43-
# docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} # see https://hub.docker.com/settings/security
43+
# docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} # see https://hub.docker.com/settings/security
44+
45+
# https://github.com/marketplace/actions/push-to-ghcr
46+
- name: Build and publish a Docker image for ${{ github.repository }}
47+
uses: macbre/push-to-ghcr@master
48+
with:
49+
dockerfile: Dockerfile.celery
50+
image_name: ${REPO_LC}-celery-backend
51+
image_tag: ${{ env.TAG }}
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
# optionally push to the Docker Hub (docker.io)
54+
# docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} # see https://hub.docker.com/settings/security

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,6 @@ cython_debug/
176176

177177

178178
## project specific
179-
180179
postgres_data/
181180
config.json
181+
jwt.hex

Dockerfile.celery

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ COPY urNode-backend/requirements /app/requirements
1515
RUN pip install --no-cache-dir --compile -r requirements/run-requirements.txt
1616

1717
COPY urNode-backend/ /app
18+
19+
ENTRYPOINT [ "sh", "entrypoint_celery.sh" ]

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ services:
1111

1212
# Redis - result backend
1313
redis:
14-
image: redis:2.8.19
14+
container_name: redis_app_urnode
15+
image: redis:alpine
1516
hostname: redis
1617

1718
backend:
@@ -40,9 +41,10 @@ services:
4041
context: ./
4142
dockerfile: ./Dockerfile.celery
4243
container_name: celery_server
43-
command: celery -A Uturn worker --loglevel=info --without-gossip --without-mingle --without-heartbeat -Ofair --pool=solo
4444
volumes:
45-
- "./backend:/opt/uturn/backend"
45+
- "./urNode-backend:/app"
46+
env_file:
47+
- ./.env
4648
depends_on:
4749
- redis
4850
- postgres
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
cd ur_node/
3+
4+
exec celery -A ur_node worker --loglevel=info --without-gossip --without-mingle --without-heartbeat -Ofair --pool=solo
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import os
2+
3+
from celery import Celery
4+
from django.conf import settings
5+
6+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ur_node.settings")
7+
app = Celery("ur_node")
8+
9+
app.config_from_object("django.conf:settings")
10+
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

0 commit comments

Comments
 (0)