From a9ac5484e0f7602d46f4a23a41faa6d6eb88afe4 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Wed, 21 Jun 2017 15:09:49 +0200 Subject: [PATCH] Rework Docker image and add some doc. Thanks @bnjbvr for the contribution! This closes #15. --- README.md | 3 ++- doc/0.getting_started.md | 2 ++ doc/2.docker.md | 38 +++++++++++++++++++++++++++ Dockerfile => docker/Dockerfile | 2 +- docker_run.sh => docker/docker_run.sh | 4 +-- 5 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 doc/2.docker.md rename Dockerfile => docker/Dockerfile (95%) rename docker_run.sh => docker/docker_run.sh (85%) diff --git a/README.md b/README.md index 8c08494..2d47f4d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ This code is not restricted to handling flats only! ## Getting started -See the [getting started guide](doc/0.getting_started.md). +See the [getting started guide](doc/0.getting_started.md). If you want to give +it a try quickly, you can have a look at the [Docker image](doc/2.docker.md). ## Documentation diff --git a/doc/0.getting_started.md b/doc/0.getting_started.md index a5e55e0..7d0e8ff 100644 --- a/doc/0.getting_started.md +++ b/doc/0.getting_started.md @@ -12,6 +12,8 @@ yet been merged. ## TL;DR +An alternative method is available using Docker. See [2.docker.md](2.docker.md). + 1. Clone the repository. 2. Install required Python modules: `pip install -r requirements.txt`. 3. Init a configuration file: `python -m flatisfy init-config > config.json`. diff --git a/doc/2.docker.md b/doc/2.docker.md new file mode 100644 index 0000000..83b5206 --- /dev/null +++ b/doc/2.docker.md @@ -0,0 +1,38 @@ +Testing Flatisfy using Docker +============================= + +A basic `Dockerfile` is available for rapid testing. It is still really hacky +and should not be used in production. + + +1. First, build the docker image: + +``` +cd docker +docker build -t bnjbvr/flatisfy . +``` + +2. Then, create some folder to store your Flatisfy data in a permanent way (it + will be mount as a Docker volume in next steps), and initialize an empty + config: + +``` +mkdir flatisfy +cd flatisfy +FLATISFY_VOLUME=$(pwd) +docker run -P -v $FLATISFY_VOLUME:/flatisfy -p 8080:8080 bnjbvr/flatisfy sh -c "cd /home/user/app && python -m flatisfy init-config > /flatisfy/config.json" +``` + + +3. Then, edit the generated `config.json` file according to your needs. See + [0.getting_started.md](0.getting_started.md) for more infos on the + configuration file format. + + +4. Finally, run the docker image to fetch flats and serve the web UI: + +``` +docker run -P -v $FLATISFY_VOLUME:/flatisfy -p 8080:8080 bnjbvr/flatisfy +``` + +Your Flatisfy instance is now available at `localhost:8080`! diff --git a/Dockerfile b/docker/Dockerfile similarity index 95% rename from Dockerfile rename to docker/Dockerfile index 5feeba7..2e433e6 100644 --- a/Dockerfile +++ b/docker/Dockerfile @@ -31,7 +31,7 @@ VOLUME /flatisfy # Install Flatisfy. RUN cd /home/user \ - && git clone https://git.phyks.me/bnjbvr/flatisfy/ ./app \ + && git clone https://git.phyks.me/Phyks/flatisfy/ ./app \ && cd ./app \ && pip install -r requirements.txt \ && npm install \ diff --git a/docker_run.sh b/docker/docker_run.sh similarity index 85% rename from docker_run.sh rename to docker/docker_run.sh index 175d95f..ffeb386 100644 --- a/docker_run.sh +++ b/docker/docker_run.sh @@ -15,6 +15,6 @@ do cd /home/user/app python -m flatisfy import -v --config /flatisfy/config.json - echo "Done, sleeping for 5 minutes." - sleep 300 + echo "Done, sleeping for 30 minutes." + sleep 1800 done