2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-02-09 07:28:39 +00:00

fix: improve installation README

This commit is contained in:
Revant Nandgaonkar 2020-03-02 05:07:40 +05:30
parent 2f59ebbae0
commit 4364330fe9

View File

@ -2,7 +2,7 @@
### Setup Letsencrypt Nginx Proxy Companion ### Setup Letsencrypt Nginx Proxy Companion
DNS needs to be configured for following to work DNS needs to be configured for following to work.
Read more: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion Read more: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
@ -32,11 +32,11 @@ Environment variables are set to pass secret and variable data.
If `env-example` is copied to `.env` following values are set. If `env-example` is copied to `.env` following values are set.
- `VERSION=edge` set version tag or latest for major version e.g. v12.3.0, v12 - `VERSION=edge` set version tag or latest for major version e.g. v12.3.0, v12.
- `MYSQL_ROOT_PASSWORD=admin`, set mariadb root password (bootstraps a mariadb container with this root password). If managed database mariadb is used NO need to set the password here - `MYSQL_ROOT_PASSWORD=admin`, set mariadb root password (bootstraps a mariadb container with this root password). If managed database mariadb is used NO need to set the password here.
- `MARIADB_HOST=mariadb` set hostname to `mariadb` in case of docker container for mariadb is used. In case managed db is used set the hostname/IP/domain name here - `MARIADB_HOST=mariadb` set hostname to `mariadb` in case of docker container for mariadb is used. In case managed db is used set the hostname/IP/domain name here.
- `SITES=site1.domain.com,site2.domain.com` these are list of sites that are part of the deployment "bench". Each site is separated by (,) comma - `SITES=site1.domain.com,site2.domain.com` these are list of sites that are part of the deployment "bench". Each site is separated by (,) comma.
- `LETSENCRYPT_EMAIL=your.email@your.domain.com` email for letsencrypt expiry notification - `LETSENCRYPT_EMAIL=your.email@your.domain.com` email for letsencrypt expiry notification.
### Start frappe-bench services ### Start frappe-bench services
@ -49,38 +49,41 @@ docker-compose \
--project-directory installation up -d --project-directory installation up -d
``` ```
Note: use `docker-compose-frappe.yml` in case you need bench with just frappe installed Note: use `docker-compose-frappe.yml` in case you need bench with just frappe installed.
### Create new sites ### Create new sites
Note: Wait for mariadb to start. If new site creation fails re-try again after mariadb container is up and running Note:
- Wait for mariadb to start. If new site creation fails re-try again after mariadb container is up and running.
- Use `.env` file or environment variables instead of passing secrets as command arguments.
```sh ```sh
# Create ERPNext site # Create ERPNext site
docker exec -it \ docker exec -it \
-e "SITE_NAME=site1.domain.com" \ -e "SITE_NAME=$SITE_NAME" \
-e "DB_ROOT_USER=root" \ -e "DB_ROOT_USER=$DB_ROOT_USER" \
-e "DB_ROOT_PASSWORD=admin" \ -e "MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD" \
-e "ADMIN_PASSWORD=admin" \ -e "ADMIN_PASSWORD=$ADMIN_PASSWORD" \
-e "INSTALL_ERPNEXT=1" \ -e "INSTALL_ERPNEXT=1" \
frappebench00_erpnext-python_1 docker-entrypoint.sh new frappebench00_erpnext-python_1 docker-entrypoint.sh new
``` ```
Environment Variables: Environment Variables needed:
- `SITE_NAME`, name of the new site to create - `SITE_NAME`, name of the new site to create.
- `DB_ROOT_USER`, MariaDB Root user. The user that can create databases - `DB_ROOT_USER`, MariaDB Root user. The user that can create databases.
- `DB_ROOT_PASSWORD`, In case of mariadb docker container use the one set in `MYSQL_ROOT_PASSWORD` in previous steps. In case of managed database use appropriate password - `MYSQL_ROOT_PASSWORD`, In case of mariadb docker container use the one set in `MYSQL_ROOT_PASSWORD` in previous steps. In case of managed database use appropriate password.
- `ADMIN_PASSWORD` set the administrator password for new site - `ADMIN_PASSWORD` set the administrator password for new site.
- `INSTALL_ERPNEXT=1` available only in erpnext-worker and erpnext containers. Installs ERPNext on this new site - `INSTALL_ERPNEXT=1` available only in erpnext-worker and erpnext containers. Installs ERPNext on this new site.
- `FORCE=1` is optional variable which force installs the same site. - `FORCE=1` is optional variable which force installs the same site.
### Backup sites ### Backup sites
Environment Variables Environment Variables
- `SITES` is list of sites separated by (:) colon to migrate. e.g. `SITES=site1.domain.com` or `SITES=site1.domain.com:site2.domain.com` By default all sites in bench will be backed up - `SITES` is list of sites separated by (:) colon to migrate. e.g. `SITES=site1.domain.com` or `SITES=site1.domain.com:site2.domain.com` By default all sites in bench will be backed up.
- `WITH_FILES` if set to 1, it will back up user uploaded files for the sites - `WITH_FILES` if set to 1, it will back up user uploaded files for the sites.
```sh ```sh
docker exec -it \ docker exec -it \
@ -89,7 +92,7 @@ docker exec -it \
frappebench00_erpnext-python_1 docker-entrypoint.sh backup frappebench00_erpnext-python_1 docker-entrypoint.sh backup
``` ```
Backup will be available in `sites` mounted volume Backup will be available in `sites` mounted volume.
### Update and migrate site ### Update and migrate site
@ -121,7 +124,9 @@ docker exec -it \
### Troubleshoot ### Troubleshoot
Clearing redis cache: 1. Remove containers and volumes clear redis cache:
This can be used when images are upgraded and if migration fails.
``` ```
# change to repo root # change to repo root
@ -158,4 +163,31 @@ docker-compose \
--project-directory installation up -d --project-directory installation up -d
``` ```
2. Clear redis cache by exec command:
In case of following error during container restarts,
```
frappe-worker-short_1 | Traceback (most recent call last):
frappe-worker-short_1 | File "/home/frappe/frappe-bench/commands/worker.py", line 5, in <module>
frappe-worker-short_1 | start_worker(queue, False)
frappe-worker-short_1 | File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 147, in start_worker
frappe-worker-short_1 | Worker(queues, name=get_worker_name(queue)).work(logging_level = logging_level)
frappe-worker-short_1 | File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/rq/worker.py", line 474, in work
frappe-worker-short_1 | self.register_birth()
frappe-worker-short_1 | File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/rq/worker.py", line 261, in register_birth
frappe-worker-short_1 | raise ValueError(msg.format(self.name))
frappe-worker-short_1 | ValueError: There exists an active worker named '8dfe5c234085.10.short' already
```
Use commands :
```sh
# Clear the cache which is causing problem.
docker exec -it frappebench00_redis-cache_1 redis-cli FLUSHALL
docker exec -it frappebench00_redis-queue_1 redis-cli FLUSHALL
docker exec -it frappebench00_redis-socketio_1 redis-cli FLUSHALL
```
Note: Environment variables from `.env` file located at current working directory will be used. Note: Environment variables from `.env` file located at current working directory will be used.