From 0cfd6d7634ed1cc0cbf9d691ee688aa1782090b3 Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Thu, 29 Apr 2021 14:13:01 +0530 Subject: [PATCH] feat: dev-instance using docker-compose --- README.md | 50 +++++++++++++++++++++++++++++++++++++++++++--- docker-compose.yml | 34 +++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 8d87e29c..8515399e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,51 @@ The App has following components: Community is built on the [Frappe Framework](https://github.com/frappe/frappe), a full-stack web app framework built with Python & JavaScript. -### Local Setup +## Development Setup + +**Step 1:** Clone the repo + +``` +$ git clone https://github.com/fossunited/community.git + +$ cd community +``` + +**Step 2:** Run docker-compose + +``` +$ docker-compose up +``` + +**Step 3:** Visit the website at http://localhost:8000/ + +You'll have to go through the setup wizard to setup the website for the first time you access it. Login using the following credentiasl to complete the setup wizard. + +``` +Username: Administrator +password: admin +``` + +TODO: Explain how to load sample data + +## Stopping the server + +Press `ctrl+c` in the terminal to stop the server. You can also run `docker-compose down` in another terminal to stop it. + +To completely reset the instance, do the following: + +``` +$ docker-compose down --volumes +$ docker-compose up +``` + +## Making Code Changes + +The dev setup is configured to reload whenever any code is changed. Just edit the code and reload the webpage. + +Commit the changes in a branch and send a pull request. + +## Local Setup - The Hard Way To setup the repository locally follow the steps mentioned below: @@ -21,7 +65,7 @@ To setup the repository locally follow the steps mentioned below: 1. Map your site to localhost with the command ```bench --site community.test add-to-hosts``` 1. Now open the URL http://community.test:8000/docs in your browser, you should see the app running. -### Contribution Guidelines +### Contribution Guidelines (for The Hard Way) 1. Go to the apps/community directory of your installation and execute git pull --unshallow to ensure that you have the full git repository. Also fork the fossunited/community repository on GitHub. 1. Check out a working branch in git (e.g. git checkout -b my-new-branch). @@ -32,4 +76,4 @@ To setup the repository locally follow the steps mentioned below: #### License -AGPL \ No newline at end of file +AGPL diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..6700698e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,34 @@ +version: "3" + +services: + redis-cache: + image: redis:alpine + redis-queue: + image: redis:alpine + redis-socketio: + image: redis:alpine + mariadb: + image: mariadb + volumes: + - mariadb-storage:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=root + command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci + bench: + image: anandology/frappe-bench + volumes: + - .:/home/bench/frappe-bench/apps/community + environment: + - FRAPPE_APPS=community + - FRAPPE_ALLOW_TESTS=true + - FRAPPE_SITE_NAME=frappe.localhost + depends_on: + - mariadb + - redis-cache + - redis-queue + - redis-socketio + ports: + - 8000:8000 + - 9000:9000 +volumes: + mariadb-storage: {}