Got the site up running using docker-compose. Also added a Makefile for convenience.
This commit is contained in:
parent
e957942181
commit
44d2ce22ab
8
Dockerfile
Normal file
8
Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
FROM python:3
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
RUN mkdir /code
|
||||||
|
WORKDIR /code
|
||||||
|
ADD src/requirements.txt /code/
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get -y install wkhtmltopdf
|
19
Makefile
Normal file
19
Makefile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
all: build db_up sleep migrate bootstrap web_up
|
||||||
|
|
||||||
|
build:
|
||||||
|
docker-compose build
|
||||||
|
|
||||||
|
db_up:
|
||||||
|
docker-compose up -d db
|
||||||
|
|
||||||
|
migrate:
|
||||||
|
docker-compose run web /usr/local/bin/python src/manage.py migrate
|
||||||
|
|
||||||
|
bootstrap:
|
||||||
|
docker-compose run web /usr/local/bin/python src/manage.py bootstrap-devsite
|
||||||
|
|
||||||
|
sleep:
|
||||||
|
echo "Sleeping to ensure that the db is up."; sleep 3
|
||||||
|
|
||||||
|
web_up:
|
||||||
|
docker-compose up web
|
16
README.md
16
README.md
|
@ -4,7 +4,17 @@ Django project to power Bornhack. Features include news, villages, webshop, and
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
### Clone the repo
|
### Using docker-compose
|
||||||
|
|
||||||
|
If you have docker-compose you can use the included make file. Like so:
|
||||||
|
|
||||||
|
$ make
|
||||||
|
|
||||||
|
### Manual way
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Clone the repo
|
||||||
Clone with --recursive to include submodules:
|
Clone with --recursive to include submodules:
|
||||||
|
|
||||||
git clone --recursive https://github.com/bornhack/bornhack-website
|
git clone --recursive https://github.com/bornhack/bornhack-website
|
||||||
|
@ -13,14 +23,14 @@ If you already cloned the repository, you can add the submodules like this:
|
||||||
|
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
### Virtualenv
|
#### Virtualenv
|
||||||
Create a Python 3 virtual environment and activate it:
|
Create a Python 3 virtual environment and activate it:
|
||||||
```
|
```
|
||||||
$ virtualenv venv -p python3
|
$ virtualenv venv -p python3
|
||||||
$ source venv/bin/activate
|
$ source venv/bin/activate
|
||||||
```
|
```
|
||||||
|
|
||||||
### System libraries
|
#### System libraries
|
||||||
Install system dependencies (method depends on OS):
|
Install system dependencies (method depends on OS):
|
||||||
- postgresql headers (for psycopg2):
|
- postgresql headers (for psycopg2):
|
||||||
- Debian: libpq-dev
|
- Debian: libpq-dev
|
||||||
|
|
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
version: '2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: bornhack
|
||||||
|
POSTGRES_USER: bornhack
|
||||||
|
POSTGRES_DB: bornhack
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
command: python3 src/manage.py runserver 0.0.0.0:8000
|
||||||
|
volumes:
|
||||||
|
- .:/code
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
depends_on:
|
||||||
|
- db
|
|
@ -29,6 +29,10 @@ CHANNEL_LAYERS = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# start redirecting to the next camp instead of the previous camp after
|
||||||
|
# this much of the time between the camps has passed
|
||||||
|
CAMP_REDIRECT_PERCENT=40
|
||||||
|
|
||||||
### changes below here are only needed for production
|
### changes below here are only needed for production
|
||||||
|
|
||||||
# email settings
|
# email settings
|
||||||
|
@ -47,10 +51,6 @@ TIME_ZONE='{{ django_timezone }}'
|
||||||
MEDIA_ROOT='{{ django_media_root }}'
|
MEDIA_ROOT='{{ django_media_root }}'
|
||||||
PDF_ARCHIVE_PATH='{{ pdf_archive_path }}'
|
PDF_ARCHIVE_PATH='{{ pdf_archive_path }}'
|
||||||
|
|
||||||
# start redirecting to the next camp instead of the previous camp after
|
|
||||||
# this much of the time between the camps has passed
|
|
||||||
CAMP_REDIRECT_PERCENT=40
|
|
||||||
|
|
||||||
# PSP settings
|
# PSP settings
|
||||||
EPAY_MERCHANT_NUMBER='{{ epay_merchant_number }}'
|
EPAY_MERCHANT_NUMBER='{{ epay_merchant_number }}'
|
||||||
EPAY_MD5_SECRET='{{ epay_md5_secret }}'
|
EPAY_MD5_SECRET='{{ epay_md5_secret }}'
|
||||||
|
|
Loading…
Reference in a new issue