Skip to content

Commit 56a2194

Browse files
author
Johann Wagner
committed
Initial Commit
0 parents  commit 56a2194

7 files changed

+89191
-0
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.dockerignore
2+
Dockerfile
3+
README.md
4+
securitysettings.py

Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM postgres:9.6
2+
3+
RUN apt-get update && \
4+
apt-get install -y postgresql-contrib-9.6 \
5+
postgresql-9.6-postgis-2.3 \
6+
postgresql-plpython3-9.6 postgresql-plpython-9.6 \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
COPY * /
10+
11+
COPY init.sh /docker-entrypoint-initdb.d/init.sh
12+
13+
ENV POSTGRES_USER postgres
14+
ENV POSTGRES_PASSWORD postgres

README.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# oeplatform-deploy
2+
3+
## Usage
4+
5+
In this folder:
6+
`docker build -t oep_postgres .`
7+
`docker run -p "5432:5432" oep_postgres`
8+
9+
In your project folder:
10+
`python manage.py migrate`
11+
12+
## What does this?
13+
14+
This Dockerfile creates a container which is prepared for use with open_eGo. This means that all required dependencies for the database and the database schema are already included and the container is ready to use at the first start.
15+
16+
Only the migration of Django has to be executed before you can get started. If the migration has not yet been executed, Django also warns you.
17+
18+
```
19+
You have 93 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, authtoken, axes, contenttypes, dataedit, login, modelview, sessions.
20+
Run 'python manage.py migrate' to apply them.
21+
```
22+
23+
## How does I tell Django to use this container?
24+
25+
All relevant settings are stored in `/oeplatform/securitysettings.py`, which is normally created by using the `securitysettings.py.default`. We included a `securitysettings.py` in this repository, which can be used for development purposes. You can copy this to your project to `/oeplatform/securitysettings.py`. If you use this container in production, you might need to change this.
26+
27+
28+
## Which are the credentials for this container?
29+
30+
+ `POSTGRES_USER=postgres`
31+
+ `POSTGRES_PASSWORD=postgres`
32+
33+
We created two databases:
34+
35+
+ django
36+
+ Contains the django tables, which are introduced by the migration.
37+
+ dataedit
38+
+ Contains the custom tables, which are introduced by the `*.dump` files.
39+
40+
41+
## How does this work?
42+
43+
1. We inherit from the Postgres container in version 9.6.
44+
2. In addition we install the packages `postgresql-contrib-9.6 postgresql-9.6-postgis-2.3 postgresql-plpython3-9.6 postgresql-plpython-9.6 `.
45+
3. We copy all files ending with `*.dump` to `/`.
46+
4. We copy the init script to a place where Postgres finds it and executes it after starting the database. So all data in *.dump files will be executed.
47+
5. The database is ready to use.

init.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
echo "Creating Databases..."
4+
5+
createdb django
6+
createdb dataedit
7+
8+
echo "Inserting Data..."
9+
10+
for fileName in *.dump; do
11+
psql -d dataedit < $fileName
12+
done
13+

oedb_test.dump

+67,413
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)