mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-11-09 14:50:58 +00:00
docs: frappe docker support for PostgreSQL
This commit is contained in:
parent
3558765a03
commit
04f98778bb
@ -104,6 +104,23 @@ This will create a new site and a `mysite.localhost` directory under `frappe-ben
|
|||||||
The option `--no-mariadb-socket` will configure site's database credentials to work with docker.
|
The option `--no-mariadb-socket` will configure site's database credentials to work with docker.
|
||||||
You may need to configure your system /etc/hosts if you're on Linux, Mac, or its Windows equivalent.
|
You may need to configure your system /etc/hosts if you're on Linux, Mac, or its Windows equivalent.
|
||||||
|
|
||||||
|
To setup site with PostgreSQL as database use option `--db-type postgres` and `--db-host postgresql`. (Available only v12 onwards, currently NOT available for ERPNext).
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bench new-site mypgsql.localhost --db-type postgres --db-host postgresql
|
||||||
|
```
|
||||||
|
|
||||||
|
To avoid entering postgresql username and root password, set it in `common_site_config.json`,
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bench config set-common-config -c root_login postgres
|
||||||
|
bench config set-common-config -c root_password '"123"'
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: If PostgreSQL is not required, the postgresql service / container can be stopped.
|
||||||
|
|
||||||
### Set bench developer mode on the new site
|
### Set bench developer mode on the new site
|
||||||
|
|
||||||
To develop a new app, the last step will be setting the site into developer mode. Documentation is available at [this link](https://frappe.io/docs/user/en/guides/app-development/how-enable-developer-mode-in-frappe).
|
To develop a new app, the last step will be setting the site into developer mode. Documentation is available at [this link](https://frappe.io/docs/user/en/guides/app-development/how-enable-developer-mode-in-frappe).
|
||||||
|
@ -12,10 +12,12 @@ Or specify environment variables instead of passing secrets as command arguments
|
|||||||
|
|
||||||
Note:
|
Note:
|
||||||
|
|
||||||
- Wait for the MariaDB service to start before trying to create a new site.
|
- Wait for the database service to start before trying to create a new site.
|
||||||
- If new site creation fails, retry after the MariaDB container is up and running.
|
- If new site creation fails, retry after the MariaDB container is up and running.
|
||||||
- If you're using a managed database instance, make sure that the database is running before setting up a new site.
|
- If you're using a managed database instance, make sure that the database is running before setting up a new site.
|
||||||
|
|
||||||
|
#### MariaDB Site
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Create ERPNext site
|
# Create ERPNext site
|
||||||
docker run \
|
docker run \
|
||||||
@ -29,10 +31,28 @@ docker run \
|
|||||||
frappe/erpnext-worker:$VERSION new
|
frappe/erpnext-worker:$VERSION new
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### PostgreSQL Site
|
||||||
|
|
||||||
|
PostgreSQL is only available v12 onwards. It is NOT available for ERPNext.
|
||||||
|
It is available as part of `frappe/erpnext-worker`. It inherits from `frappe/frappe-worker`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Create ERPNext site
|
||||||
|
docker run \
|
||||||
|
-e "SITE_NAME=$SITE_NAME" \
|
||||||
|
-e "DB_ROOT_USER=$DB_ROOT_USER" \
|
||||||
|
-e "POSTGRES_HOST=$POSTGRES_HOST" \
|
||||||
|
-e "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" \
|
||||||
|
-e "ADMIN_PASSWORD=$ADMIN_PASSWORD" \
|
||||||
|
-v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
|
||||||
|
--network <project-name>_default \
|
||||||
|
frappe/erpnext-worker:$VERSION new
|
||||||
|
```
|
||||||
|
|
||||||
Environment Variables needed:
|
Environment Variables needed:
|
||||||
|
|
||||||
- `SITE_NAME`: name of the new site to create. Site name is domain name that resolves. e.g. `erp.example.com` or `erp.localhost`.
|
- `SITE_NAME`: name of the new site to create. Site name is domain name that resolves. e.g. `erp.example.com` or `erp.localhost`.
|
||||||
- `DB_ROOT_USER`: MariaDB Root user.
|
- `DB_ROOT_USER`: MariaDB/PostgreSQL Root user.
|
||||||
- `MYSQL_ROOT_PASSWORD`: In case of the MariaDB docker container use the one set in `MYSQL_ROOT_PASSWORD` in previous steps. In case of a managed database use the appropriate password.
|
- `MYSQL_ROOT_PASSWORD`: In case of the MariaDB docker container use the one set in `MYSQL_ROOT_PASSWORD` in previous steps. In case of a managed database use the appropriate password.
|
||||||
- `MYSQL_ROOT_PASSWORD_FILE` - When the MariaDB root password is stored using docker secrets.
|
- `MYSQL_ROOT_PASSWORD_FILE` - When the MariaDB root password is stored using docker secrets.
|
||||||
- `ADMIN_PASSWORD`: set the administrator password for the new site.
|
- `ADMIN_PASSWORD`: set the administrator password for the new site.
|
||||||
@ -40,6 +60,16 @@ Environment Variables needed:
|
|||||||
- `INSTALL_APPS=erpnext`: available only in erpnext-worker and erpnext containers (or other containers with custom apps). Installs ERPNext (and/or the specified apps, comma-delinieated) on this new site.
|
- `INSTALL_APPS=erpnext`: available only in erpnext-worker and erpnext containers (or other containers with custom apps). Installs ERPNext (and/or the specified apps, comma-delinieated) on this new site.
|
||||||
- `FORCE=1`: optional variable which force installation of the same site.
|
- `FORCE=1`: optional variable which force installation of the same site.
|
||||||
|
|
||||||
|
Environment Variables for PostgreSQL only:
|
||||||
|
|
||||||
|
- `POSTGRES_HOST`: host for PostgreSQL server
|
||||||
|
- `POSTGRES_PASSWORD`: Password for `postgres`. The database root user.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- To setup existing frappe-bench deployment with default database as PostgreSQL edit the common_site_config.json and set `db_host` to PostgreSQL hostname and `db_port` to PostgreSQL port.
|
||||||
|
- To create new frappe-bench deployment with default database as PostgreSQL use `POSTGRES_HOST` and `DB_PORT` environment variables in `erpnext-python` service instead of `MARIADB_HOST`
|
||||||
|
|
||||||
## Add sites to proxy
|
## Add sites to proxy
|
||||||
|
|
||||||
Change `SITES` variable to the list of sites created encapsulated in backtick and separated by comma with no space. e.g. ``SITES=`site1.example.com`,`site2.example.com` ``.
|
Change `SITES` variable to the list of sites created encapsulated in backtick and separated by comma with no space. e.g. ``SITES=`site1.example.com`,`site2.example.com` ``.
|
||||||
|
@ -52,6 +52,7 @@ services:
|
|||||||
restart: on-failure
|
restart: on-failure
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_HOST=${POSTGRES_HOST}
|
- POSTGRES_HOST=${POSTGRES_HOST}
|
||||||
|
- DB_PORT=5432
|
||||||
- REDIS_CACHE=redis-cache:6379
|
- REDIS_CACHE=redis-cache:6379
|
||||||
- REDIS_QUEUE=redis-queue:6379
|
- REDIS_QUEUE=redis-queue:6379
|
||||||
- REDIS_SOCKETIO=redis-socketio:6379
|
- REDIS_SOCKETIO=redis-socketio:6379
|
||||||
|
Loading…
Reference in New Issue
Block a user