2016-12-25 12:52:47 +01:00
# Set up c3nav using docker
2016-12-18 22:32:08 +01:00
2016-12-25 12:52:47 +01:00
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.
2016-12-18 22:32:08 +01:00
2016-12-25 12:52:47 +01:00
## 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
2016-12-18 22:32:08 +01:00
```
2016-12-25 12:52:47 +01:00
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
2016-12-18 22:32:08 +01:00
cd c3nav
docker build -t c3nav .
2016-12-25 12:52:47 +01:00
cd ..
2016-12-18 22:32:08 +01:00
```
2016-12-25 12:52:47 +01:00
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.
2016-12-18 22:32:08 +01:00
```
2016-12-25 12:52:47 +01:00
# example for the 33c3
mkdir -p 33c3-data/map/
cd 33c3-data/map/
2016-12-18 22:32:08 +01:00
git clone git@github .com:c3nav/c3nav-cch.git
git clone git@github .com:c3nav/c3nav-33c3.git
2016-12-25 12:52:47 +01:00
cd ../../
2016-12-18 22:32:08 +01:00
```
2016-12-25 12:52:47 +01:00
## 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.
2016-12-18 22:32:08 +01:00
```
2016-12-25 12:52:47 +01:00
docker run --rm --name c3nav-33c3 -v `pwd` /33c3-data:/data c3nav/c3nav build
2016-12-18 22:32:08 +01:00
```
2016-12-26 15:29:31 +01:00
## 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=*
```
2016-12-25 12:52:47 +01:00
## run c3nav
2016-12-18 22:32:08 +01:00
2016-12-25 12:57:54 +01:00
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!**
2016-12-18 22:32:08 +01:00
2016-12-25 12:52:47 +01:00
```
2016-12-26 15:29:31 +01:00
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
2016-12-25 12:52:47 +01:00
```
## after editing map data: save the map
2016-12-18 22:32:08 +01:00
2016-12-25 12:52:47 +01:00
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
```