Skip to content

Commit

Permalink
Fixed docker docs + ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
malteos committed Jan 28, 2019
1 parent 6358211 commit d4b8f56
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,6 +1,9 @@
# IDEA
.idea/*

# Docker
docker/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Expand Up @@ -8,13 +8,12 @@ WORKDIR /app
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install -y nodejs


# copy our project code
COPY . /app

ENV DJANGO_SETTINGS_MODULE=oldp.settings
ENV DJANGO_CONFIGURATION=Dev
ENV DATABASE_URL="mysql://oldp:oldp@127.0.0.1/oldp"
ENV DATABASE_URL="sqlite:///dev.db"
ENV DJANGO_SECRET_KEY=foobar12

# install our dependencies
Expand All @@ -32,6 +31,5 @@ RUN python manage.py collectstatic --no-input
EXPOSE 8000

# define the default command to run when starting the container
CMD ["gunicorn", "--bind", ":8000", "oldp.wsgi:application"]

CMD ["gunicorn", "--bind", ":8000", " --log-file", "-", "--log-level", "debug", "oldp.wsgi:application"]

15 changes: 15 additions & 0 deletions docs/docker.md
Expand Up @@ -16,6 +16,11 @@ docker exec -it oldp_app_1 python manage.py migrate
# Import some demo data (from fixtures)
docker exec -it oldp_app_1 python manage.py loaddata locations/
# Create superuser (admin, pw: admin)
docker exec -it oldp_app_1 python manage.py shell -c \
"from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'admin')"
```

Sometimes Elasticsearch has problems writing to its data directory. To solve this, set access rights:
Expand All @@ -36,4 +41,14 @@ docker build -t oldp .
# Tag image as latest
docker tag oldp:latest
docker tag oldp openlegaldata/oldp:latest
# Push to hub
docker push openlegaldata/oldp:latest
# Override environment variables
docker run -e DATABASE_URL="sqlite:///db/db.sqlite" -it oldp python manage.py runserver
```

0 comments on commit d4b8f56

Please sign in to comment.