2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-14 00:54:07 +00:00
frappe_docker/docs/site-operations.md
Revant Nandgaonkar e6088af885
refactor: build only one frappe/erpnext image (#1032)
* ci: skip frappe builds

* refactor: build only one frappe/erpnext image

* fix: lint nginx entrypoint script

* docs: update and organize docs

* docs: fix lint errors

* fix(custom): pass base64 encoded apps json

* ci: update dependabot

* docs: update contributing

* docs: remove info about multi image setup

* fix: initiate empty common_site_config.json

default config has host keys set to localhost
causes connection errors

* docs: add details for pwd volumes

* fix: symlink assets instead of copy

* fix: nginx private files

* ci: skip docker compose v2 install for ubuntu-latest

* fix: organize layers

* feat: allow remove git remote for custom image

* docs: allow remove git remote for custom image

* fix: remove duplicate --apps_path
2023-01-16 04:20:09 +05:30

3.0 KiB

Site operations

💡 You should setup --project-name option in docker-compose commands if you have non-standard project name.

Setup new site

Note:

  • Wait for the db service to start and configurator to exit before trying to create a new site. Usually this takes up to 10 seconds.
docker-compose exec backend bench new-site <site-name> --no-mariadb-socket --mariadb-root-password <db-password> --admin-password <admin-password>

If you need to install some app, specify --install-app. To see all options, just run bench new-site --help.

To create Postgres site (assuming you already use Postgres compose override) you need have to do set root_login and root_password in common config before that:

docker-compose exec backend bench set-config -g root_login <root-login>
docker-compose exec backend bench set-config -g root_password <root-password>

Also command is slightly different:

docker-compose exec backend bench new-site <site-name> --no-mariadb-socket --db-type postgres --admin-password <admin-password>

Push backup to S3 storage

We have the script that helps to push latest backup to S3.

docker-compose exec backend push_backup.py --site-name <site-name> --bucket <bucket> --region-name <region> --endpoint-url <endpoint-url> --aws-access-key-id <access-key> --aws-secret-access-key <secret-key>

Note that you can restore backup only manually.

Edit configs

Editing config manually might be required in some cases, one such case is to use Amazon RDS (or any other DBaaS). For full instructions, refer to the wiki. Common question can be found in Issues and on forum.

common_site_config.json or site_config.json from sites volume has to be edited using following command:

docker run --rm -it \
    -v <project-name>_sites:/sites \
    alpine vi /sites/common_site_config.json

Instead of alpine use any image of your choice.

Health check

For socketio and gunicorn service ping the hostname:port and that will be sufficient. For workers and scheduler, there is a command that needs to be executed.

docker-compose exec backend healthcheck.sh --ping-service mongodb:27017

Additional services can be pinged as part of health check with option -p or --ping-service.

This check ensures that given service should be connected along with services in common_site_config.json. If connection to service(s) fails, the command fails with exit code 1.


For reference of commands like backup, drop-site or migrate check official guide or run:

docker-compose exec backend bench --help

Migrate site

Note:

  • Wait for the db service to start and configurator to exit before trying to migrate a site. Usually this takes up to 10 seconds.
docker-compose exec backend bench --site <site-name> migrate