remove docker stuff because it's outdated and not helpful

This commit is contained in:
Laura Klünder 2018-11-27 21:12:48 +01:00
parent 3461bb4574
commit 5106d029ae
3 changed files with 0 additions and 257 deletions

View file

@ -1,26 +0,0 @@
FROM python:slim
RUN apt-get update && apt-get install -y git build-essential netcat-openbsd \
libpq-dev libmysqlclient-dev libmemcached-dev libgeos-dev gettext \
librsvg2-bin --no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir /etc/c3nav && mkdir /data && mkdir /data/map
COPY src /c3nav/src
WORKDIR /c3nav/src
ENV DATA_DIR /data
COPY deployment/docker/c3nav.bash /usr/local/bin/c3nav
RUN pip install -r requirements.txt -r requirements/mysql.txt -r requirements/postgres.txt \
-r requirements/memcached.txt -r requirements/redis.txt gunicorn \
&& mkdir /static \
&& chmod +x /usr/local/bin/c3nav \
&& python manage.py collectstatic --no-input \
&& python manage.py compress \
&& python manage.py compilemessages
ENTRYPOINT ["c3nav"]
CMD ["all"]

View file

@ -1,146 +0,0 @@
#!/bin/bash
set -e
cd /c3nav/src
export DATA_DIR=/data/
NUM_WORKERS=10
if [ ! -d /data/logs ]; then
mkdir /data/logs;
fi
ls /data/map
if [ "$1" == "webworker" ]; then
while ! nc postgres 5432; do
>&2 echo "Postgres is unavailable! waiting…"
sleep 1
done
>&2 echo "Postgres is available! continuing…"
sleep 2
while ! nc redis 6379; do
>&2 echo "Redis is unavailable - sleeping"
sleep 1
done
>&2 echo "Redis is available! continuing…"
python manage.py migrate --noinput
python manage.py loadmap -y
mkdir -p /static.dist
cp -r /c3nav/src/c3nav/static.dist/* /static.dist/
exec gunicorn c3nav.wsgi \
--name c3nav \
--workers $NUM_WORKERS \
--max-requests 1200 \
--max-requests-jitter 50 \
--log-level=info \
--bind [::]:8000
fi
if [ "$1" == "taskworker" ]; then
while ! nc postgres 5432; do
>&2 echo "Postgres is unavailable! waiting…"
sleep 1
done
>&2 echo "Postgres is available! continuing…"
sleep 2
while ! nc redis 6379; do
>&2 echo "Redis is unavailable - sleeping"
sleep 1
done
>&2 echo "Redis is available! continuing…"
export C_FORCE_ROOT=True
exec celery -A c3nav worker -l info
fi
python manage.py migrate --noinput
if [ "$1" == "loadmap" ]; then
echo ""
echo "### loading map..."
exec python manage.py loadmap -y
fi
if [ "$1" == "dumpmap" ]; then
echo ""
echo "### dumping map..."
exec python manage.py dumpmap -y
fi
if [ "$1" == "check" ]; then
echo ""
echo "### checking map..."
exec python manage.py checkmap
fi
if [ "$1" == "load_check" ]; then
echo ""
echo "### loading map..."
python manage.py loadmap -y
echo ""
echo "### checking map..."
exec python manage.py checkmap
fi
if [ "$1" == "runlocal" ]; then
echo ""
echo "### starting editor..."
exec python manage.py runserver 0.0.0.0:8000
fi
if [ "$1" == "build" ]; then
echo ""
echo "### rendering map..."
python manage.py rendermap
echo ""
echo "### building graph..."
python manage.py buildgraph
fi
if [ "$1" == "load_build" ]; then
echo ""
echo "### loading map..."
python manage.py loadmap -y
echo ""
echo "### rendering map..."
python manage.py rendermap
echo ""
echo "### building graph..."
python manage.py buildgraph
echo ""
echo "### chowning /data/…"
USER_ID=${LOCAL_USER_ID:0}
exec chown -R $USER_ID $DATA_DIR
fi
if [ "$1" == "all" ]; then
echo ""
echo "### loading map..."
python manage.py loadmap -y
echo ""
echo "### rendering map..."
python manage.py rendermap
echo ""
echo "### building graph..."
python manage.py buildgraph
echo ""
echo "### running server..."
exec python manage.py runserver 0.0.0.0:8000
fi
echo "Specify argument: webworker|taskworker|loadmap|dumpmap|check|load_check|runlocal|build|load_build|all"
exit 1

View file

@ -1,85 +0,0 @@
# Set up c3nav using docker
The easiest way to set up c3nav. Here's how to do it. This is just a simple temporary setup. There will be more information soon about setting up a production setup with docker.
## Get the docker container
aka. how to get the latest version.
### from Dockerhub
the images on dockerhub should are automatically built by the c3nav gitlab and should always be pretty much up to date
```
docker pull c3nav/c3nav
```
### from source
if you want to make _sure_ to get the newest version.
```
git clone https://github.com/c3nav/c3nav.git
cd c3nav
docker build -t c3nav .
cd ..
```
Keep in mind that you will have to replace `c3nav/c3nav` with `c3nav` in all `docker run` commands below.
## Create data and get maps
Create a data directory somewhere and clone the mappackages you want to use into it.
```
# example for the 33c3
mkdir -p 33c3-data/map/
cd 33c3-data/map/
git clone git@github.com:c3nav/c3nav-cch.git
git clone git@github.com:c3nav/c3nav-33c3.git
cd ../../
```
## load map data
This will read all the map data into a temporary SQLite database.
```
docker run --rm --name c3nav-33c3 -v `pwd`/33c3-data:/data c3nav/c3nav loadmap
```
## render map and build graph
This will take a while. You can skip this if you dont't want routing but just want to use the editor.
```
docker run --rm --name c3nav-33c3 -v `pwd`/33c3-data:/data c3nav/c3nav build
```
## add django configuration file
You need a configuration file in the docker container for django to run correctly.
Create the file `33c3-data/c3nav.cfg` with the following content
```
[c3nav]
public_packages=de.c3nav.cch,de.c3nav.33c3
[django]
hosts=*
```
## run c3nav
This will run a development server that you can reach at [localhost:8042/](http://localhost:8042/). The editor can be found at [localhost:8042/editor/](http://localhost:8042/editor/). **Never use this server for production purposes!**
```
docker run --rm --name c3nav-33c3 -p 8042:8000 -v `pwd`/33c3-data:/data -v `pwd`/33c3-data/c3nav.cfg:/etc/c3nav/c3nav.cfg c3nav/c3nav runlocal
```
## after editing map data: save the map
After changing stuff with the editor, you may want to export the changes into the map package folders to submit a pull request. You can do so by running:
```
docker run --rm --name c3nav-33c3 -v `pwd`/33c3-data:/data c3nav/c3nav dumpmap
```