-
Notifications
You must be signed in to change notification settings - Fork 5
Basic Docker setup #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| FROM python:2.7 | ||
| RUN apt update | ||
| RUN apt upgrade -y | ||
| RUN apt install vim -y | ||
| RUN mkdir /sabot | ||
| WORKDIR /sabot | ||
| ADD . /sabot | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you resort this, this could save some layers: |
||
| RUN pip install -r requirements.txt | ||
| EXPOSE 8000 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is there no ENTRYPOINT or CMD in here? bash in a container is not how containers should be used |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,3 +48,24 @@ If you want to use the invoice creation functionality, it is required that | |
| you have libreoffice (or openoffice) installed on the server. | ||
|
|
||
| Here is a pretty good tutorial to run django apps with guniocorn behind an apache webserver: https://wiki.uberspace.de/cool:django (easy to adopt for SaBoT) | ||
|
|
||
| ## Docker Setup | ||
|
|
||
| You can also run the server instance inside a Docker container | ||
|
|
||
| - create the following config files: | ||
| - sabot/settings.py | ||
| - sabot/conferenceSettings.py | ||
| - sabot/localSettings.py (and sabot/prodSettings.py if you want to distinguish a development and a production version) from their example files (prodSettings.py needs the same parameters) | ||
| - Make sure that `PROJECT_ROOT = '/sabot'` is set in sabot/localSettings.py (or sabot/prodSettings.py) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please mount them using volume mounts or something like this, don't compile them into the docker image. |
||
| - create the Docker image | ||
| - docker build -t sabot:latest . | ||
| - create a container with that image | ||
| - docker run -it -p 8000:8000 sabot bash | ||
| - run the following scripts to initialize and run the server | ||
| - ./init.sh | ||
| - ./start.sh | ||
|
|
||
| If all was going well you should see the gunicorn server starting up and some logs lines | ||
| Open your webbrowser and go to http://localhost:8000 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/bash | ||
|
|
||
| ./manage.py migrate | ||
| ./manage.py createsuperuser |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,4 @@ python-rtkit>=0.7.0 | |
| requests>=2.12 | ||
| lxml>=3.7.2 | ||
| Pillow>=4.0.0 | ||
| gunicorn==19.9.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #!/bin/bash | ||
| touch gunicorn.log | ||
| touch access.log | ||
|
|
||
| tail -n 0 -f *.log & | ||
|
|
||
| echo Starting Gunicorn. | ||
| exec gunicorn sabot.wsgi:application \ | ||
| --bind 0.0.0.0:8000 \ | ||
| --name sabot \ | ||
| --workers 3 \ | ||
| --log-level=info \ | ||
| --log-file=/sabot/gunicorn.log \ | ||
| --access-logfile=/sabot/access.log \ | ||
| "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you combine this?
RUN apt update && apt upgrade -y && apt cleanAnd why vim?