From 756a9792804c7204d6daf65c3f8b3a88a2e939ce Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Wed, 11 Apr 2018 12:34:26 +0300 Subject: [PATCH] Added docker-compose.yml for Friend. --- friend/README.md | 92 ++++++++++++++++++++++++ friend/docker-compose.yml | 144 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 236 insertions(+) create mode 100644 friend/README.md create mode 100644 friend/docker-compose.yml diff --git a/friend/README.md b/friend/README.md new file mode 100644 index 0000000..d17a3cd --- /dev/null +++ b/friend/README.md @@ -0,0 +1,92 @@ +# Docker: Wekan <=> MongoDB for Friend + +* [Wekan kanban board, made with Meteor.js framework, running on + Node.js](https://wekan.io) -- [GitHub](https://github.com/wekan/wekan) +* [MongoDB NoSQL database](https://www.mongodb.com) + +## Screenshot + +![Screenshot of Wekan][screenshot] + +## Install + +1) Install docker-compose. + +2) Clone this repo. + +```bash +git clone https://github.com/wekan/wekan-mongodb.git +cd wekan-mongodb +git checkout friend +``` + +3a) Detached mode: + +```bash +docker-compose up -d +``` + +3b) Running attached to console, so Ctrl-c stops it: + +```bash +docker-compose up +``` + +4) Wekan is at http://localhost (port 80) + +5) MongoDB is at 127.0.0.1:27017 + +6) Wekan and databases bind to address 0.0.0.0 so could be also available to other + computers in network. I have not tested this. + +7) [Restore your MongoDB data](https://github.com/wekan/wekan/wiki/Export-Docker-Mongo-Data). + +## Backup before upgrading + +[Backup all data from MongoDB](https://github.com/wekan/wekan/wiki/Export-Docker-Mongo-Data) + +## Upgrading Wekan + +1) In wekan-mongodb directory, stop Wekan: + +```bash +docker-compose stop +``` + +2) Check what is CONTAINER ID of wekanteam/wekan:latest container. Then remove container. + +```bash +docker ps +docker rm CONTAINER-ID-HERE +``` + +3) Check Docker images, what is IMAGE ID of wekanteam/wekan:latest, and remove wekanteam/wekan:latest image: + +```bash +docker images +docker rmi IMAGE-ID-HERE +``` + +4) If you have made backups of MongoDB container to outside of Docker, and want to upgrade MongoDB, you could also delete MongoDB container and image. + +5) Start Wekan again in background: + +```bash +docker-compose up -d +``` + +6) You can also check container logs: + +```bash +docker ps +docker logs CONTAINER-ID-OF-Wekan-or-MongoDB-HERE +``` + +7) Restore MongoDB data if needed. + +## Feedback + +[Create GitHub issue](https://github.com/wekan/wekan/issues) + +[screenshot]: https://wekan.github.io/screenshot.png + diff --git a/friend/docker-compose.yml b/friend/docker-compose.yml new file mode 100644 index 0000000..16e0bcb --- /dev/null +++ b/friend/docker-compose.yml @@ -0,0 +1,144 @@ +version: '2' + +services: + + # 1) Create a dedicated user for Wekan, for example: + # sudo useradd -d /home/wekan -m -s /bin/bash wekan + # 2) Add this user to the docker group, then logout+login or reboot: + # sudo usermod -aG docker wekan + # 3) Then login as user wekan. + # 4) Create this file /home/wekan/docker-compose.yml with your modifications. + # 5a) Running Docker as service, on Systemd like Debian 9, Ubuntu 16.04, CentOS 7: + # sudo systemctl enable docker + # sudo systemctl start docker + # 5b) Running Docker as service, on init.d like Debian 8, Ubuntu 14.04, CentOS 6: + # sudo update-rc.d docker defaults + # sudo service docker start + # 6) For seeing does Wekan work, try this and check with your webbroser: + # docker-compose up + # 7) Stop Wekan and start Wekan in background: + # docker-compose stop + # docker-compose up -d + # 8) See running Docker containers: + # docker ps + # 9) See stopped Docker containers: + # docker ps -a + + # Upgrading Wekan to new version: + # 1) Stop Wekan: + # docker-compose stop + # 2) Download new version: + # docker-compose pull wekan + # 3) If you have more networks for VPN etc as described at bottom of + # this config, download for them too: + # docker-compose pull wekan2 + # 4) Start Wekan: + # docker-compose start + + wekandb: + # All Wekan data is stored in MongoDB. For backup and restore, see: + # https://github.com/wekan/wekan/wiki/Export-Docker-Mongo-Data + image: mongo:3.2.19 + container_name: wekan-db + restart: always + command: mongod --smallfiles --oplogSize 128 + networks: + - wekan-tier + expose: + - 27017 + volumes: + - wekan-db:/data/db + - wekan-db-dump:/dump + + wekan: + # Wekan container only has Node.js and related code, + # there is no data stored here. + # + # Docker Hub, usually broken: + #image: wekanteam/wekan:latest + # + # Quay, usually works, updates faster: + image: quay.io/wekan/wekan:friend + container_name: wekan-app + restart: always + networks: + - wekan-tier + #--------------------------------------------------------------- + # For running Wekan in different port like 3000, use: 3000:80 + ports: + - 80:80 + environment: + #--------------------------------------------------------------- + # == ROOT_URL SETTING == + # Change ROOT_URL to your real Wekan URL, for example: + # http://example.com + # http://example.com/wekan + # http://192.168.1.100 + #--------------------------------------------------------------- + - ROOT_URL=http://example.com + #--------------------------------------------------------------- + # == PORT SETTING == + # Not needed on Docker, but if you had installed from source, + # you could also have setup Wekan Node.js port at localhost + # with setting: PORT=3001 + # and have Nginx proxy to port 3001, see Wekan wiki. + #--------------------------------------------------------------- + # - PORT=3001 + #--------------------------------------------------------------- + # == MONGO URL AND OPLOG SETTINGS == + # https://github.com/wekan/wekan-mongodb/issues/2#issuecomment-378343587 + # We've fixed our CPU usage problem today with an environment + # change around Wekan. I wasn't aware during implementation + # that if you're using more than 1 instance of Wekan + # (or any MeteorJS based tool) you're supposed to set + # MONGO_OPLOG_URL as an environment variable. + # Without setting it, Meteor will perform a pull-and-diff + # update of it's dataset. With it, Meteor will update from + # the OPLOG. See here + # https://blog.meteor.com/tuning-meteor-mongo-livedata-for-scalability-13fe9deb8908 + # After setting + # MONGO_OPLOG_URL=mongodb://:@/local?authSource=admin&replicaSet=rsWekan + # the CPU usage for all Wekan instances dropped to an average + # of less than 10% with only occasional spikes to high usage + # (I guess when someone is doing a lot of work) + #--------------------------------------------------------------- + - MONGO_URL=mongodb://wekandb:27017/wekan + #--------------------------------------------------------------- + # - MONGO_OPLOG_URL=mongodb://:@/local?authSource=admin&replicaSet=rsWekan + #--------------------------------------------------------------- + # == EMAIL SETTINGS == + # Email settings are required in both MAIL_URL and Admin Panel, + # see https://github.com/wekan/wekan/wiki/Troubleshooting-Mail + # For SSL in email, change smtp:// to smtps:// + # NOTE: Special characters need to be url-encoded in MAIL_URL. + #--------------------------------------------------------------- + - MAIL_URL=smtp://user:pass@mailserver.example.com:25/ + - MAIL_FROM='Example Wekan Support ' + depends_on: + - wekandb + +#------------------------------------------------------------------ +# When using Wekan both at office LAN and remote VPN: +# 1) Have above Wekan docker container config with LAN IP address +# 2) Copy all of above Wekan config below, change name to different +# like wekan2 or wekanvpn, and change ROOT_URL to server VPN IP +# address. +# 3) This way both Wekan containers can use same MongoDB database +# and see the same Wekan boards. +# 4) You could also add 3rd Wekan container for 3rd network etc. +#------------------------------------------------------------------ +# wekan2: +# ....COPY CONFIG FROM ABOVE TO HERE... +# environment: +# - ROOT_URL='http://10.10.10.10' +# ...COPY CONFIG FROM ABOVE TO HERE... + +volumes: + wekan-db: + driver: local + wekan-db-dump: + driver: local + +networks: + wekan-tier: + driver: bridge