From 613ceb5bc76de506dde7d41c51db216a708005e9 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 27 Oct 2014 21:32:28 +0100 Subject: [PATCH] Added Docker help (@renfredxh, #252) --- docs/Docker.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 docs/Docker.md diff --git a/docs/Docker.md b/docs/Docker.md new file mode 100644 index 0000000..3efc684 --- /dev/null +++ b/docs/Docker.md @@ -0,0 +1,41 @@ +### Installation Using Docker + +*Note: pre-installation of the latest version of [Git](http://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [Docker](https://docs.docker.com/installation/) is required to deploy Lychee using Docker.* + +First, clone the latest version of Lychee and build it using the Dockerfile included in the repository. + +```bash +git clone https://github.com/electerious/Lychee.git +cd Lychee +sudo docker build -t lychee . +``` + +Once this is finished, remember to set the proper permissions on the `uploads` and `data` directories, so the container can mount these directories as volumes. + +``` +chmod -R 777 uploads/ data/ +``` + +Now you can use the `docker run` command to run your Lychee container. + +```bash +sudo docker run -v /var/lib/mysql --name lychee_data \ + -v $(pwd)/data:/app/data \ + -v $(pwd)/uploads:/app/uploads \ + -i -t -d -p 8000:80 lychee +``` + +Browse to [localhost:8000](http://localhost:8000/) (the port can be specified via the `-p` flag) and you will see Lychee's configuration page. The default database username is `root` with no password (you can manage MySQL users by running `docker exec -i -t mysql`). After submitting your database configuration, you can sign in and create a new username and password and start using Lychee. + +*Note: if you are deploying on a server, you might want to forward your container to port `80` instead of `8000` so it'll be publicly accessible.* + +### Managing Data + +Running the container with the options above mounts three Docker [data volumes](https://docs.docker.com/userguide/dockervolumes/). The first is a named "data" volume used to store the MySQL database. The last two will mount the `/data` and `/uploads` from the container to your host `Lychee` directory. If you would like to upgrade or redeploy Lychee while preserving your data, you can kill the container and the volumes will persist. Just rebuild your new container and run it using a similar command: + +```bash +sudo docker run --volumes-from lychee_data \ + -v $(pwd)/data:/app/data \ + -v $(pwd)/uploads:/app/uploads \ + -i -t -d -p 8000:80 lychee +``` \ No newline at end of file