From 1b30ff93519f6eaf62269f82aa1179af23caa828 Mon Sep 17 00:00:00 2001 From: Brad Koehn Date: Sat, 24 Nov 2018 19:10:11 -0600 Subject: [PATCH] added compose config; updated compose file to use it; updated README to match --- README.md | 15 +++++++++++++-- config.ini.docker-compose | 28 ++++++++++++++++++++++++++++ docker-compose.yml | 7 +++---- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 config.ini.docker-compose diff --git a/README.md b/README.md index 6467555..d8ef989 100644 --- a/README.md +++ b/README.md @@ -120,8 +120,19 @@ will shut down your environment without destroying your data. ### Using Docker for Production -Write Freely doesn't yet provide an official Docker pathway to production. We're -working on it, though! +A Docker image is available at [`writeas/writefreely`](https://hub.docker.com/r/writeas/writefreely/); you can use it with the included +[`docker-compose.yml`](https://github.com/writeas/writefreely/blob/master/docker-compose.yml). + +To setup the compose environment, +1. Modify a copy of [`config.ini.docker-compose`](https://github.com/writeas/writefreely/blob/master/config.ini.docker-compose) and +put it in the same directory as your `docker-compose.yml`. Edit it as appropriate (the database configuration is already setup for the compose file). +2. Modify the `docker-compose.yml` file with a secure mysql password. Make the `config.ini.docker-compose` database patchword match. +3. Run `docker-compose run --rm web /bin/sh` to get a shell inside a running instance of the web container. +5. Run `bin/writefreely -init-db` to setup the database. +6. Run `bin/writefreely -gen-keys` to setup your instance-specific keys. +7. Run `exit` to exit and remove the container. +8. Run `docker-compose up -d` to launch the server. +9. Point your browser to http://localhost:8080 (or whatever URL you set up) to test your instance. ## Contributing diff --git a/config.ini.docker-compose b/config.ini.docker-compose new file mode 100644 index 0000000..06b9282 --- /dev/null +++ b/config.ini.docker-compose @@ -0,0 +1,28 @@ +[server] +hidden_host = 0.0.0.0 +port = 8080 +tls_cert_path = +tls_key_path = + +[database] +type = mysql +username = root +password = changeme +database = writefreely +host = db +port = 3306 + +[app] +site_name = Write Freely Example Blog! +host = http://localhost:8080 +theme = write +disable_js = false +webfonts = true +single_user = true +open_registration = false +min_username_len = 3 +max_blogs = 1 +federation = true +public_stats = true +private = false + diff --git a/docker-compose.yml b/docker-compose.yml index 29a841e..be12d05 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,10 @@ version: "3" services: web: - build: . + image: "writeas/writefreely" volumes: - - "web-data:/go/src/app" - - "./config.ini.example:/go/src/app/config.ini" + - "web-data:/go/keys" + - "./config.ini.docker-compose:/go/config.ini" ports: - "8080:8080" networks: @@ -15,7 +15,6 @@ services: db: image: "mariadb:latest" volumes: - - "./schema.sql:/tmp/schema.sql" - db-data:/var/lib/mysql/data networks: - writefreely