frappe_docker/docs/04-operations/01-site-operations.md
Ali Al Saif 09934d576c
docs: reorganize documentation structure with numbered navigation (#1729)
* docs: reorganize documentation structure into logical categories

Restructure documentation into organized directories for better navigation:

- getting-started/: Quick start guides for new users
- setup/: Setup and configuration guides
- production/: Production deployment guides (backup, TLS, multi-tenancy)
- operations/: Site operations and management
- development/: Development workflow guides
- migration/: Migration guides
- troubleshooting/: Troubleshooting guides
- reference/: Reference documentation (container setup, build configs)

Rename files for consistency:
- Use kebab-case naming convention throughout
- Remove numbered prefixes from container-setup files
- Use descriptive names (backup-strategy, tls-ssl-setup, etc.)

Update all internal cross-references to reflect new file locations.
Update README.md with organized documentation structure.
Fix image paths in development.md to use correct relative paths.

* docs: add numeric prefixes to directories and files for navigation order

Add numeric prefixes (01-08) to documentation directories to indicate
reading order and flow for first-time users:

- 01-getting-started: Quick start guides
- 02-setup: Setup and configuration
- 03-production: Production deployment
- 04-operations: Site operations
- 05-development: Development guides
- 06-migration: Migration guides
- 07-troubleshooting: Troubleshooting
- 08-reference: Reference documentation

Add numeric prefixes to files within directories to guide readers
through documentation in a logical sequence.

Update all cross-references throughout documentation to use new
numbered paths. Update README.md to reflect the new structure.

* docs: move container-setup to 02-setup and integrate setup-options content

Move container-setup directory from 08-reference/ to 02-setup/ to follow
PR feedback. The container-setup documentation provides a more linear
and coherent flow compared to the previous unstructured setup files.

Changes:
- Move container-setup/ from docs/08-reference/ to docs/02-setup/
- Integrate content from setup-options.md into structured flow:
  - Create new 06-setup-examples.md with practical deployment scenarios
  - Enhance 03-start-setup.md with site creation details from setup-options
  - Remove redundant 01-setup-options.md (content now integrated)
- Rename 02-single-server-example.md to 07-single-server-example.md
- Update all cross-references throughout documentation:
  - Update README.md with new structure under Setup section
  - Fix links in site-operations.md and migration docs
  - Add navigation links between container-setup files and examples
- Maintain container-setup's linear flow: overview → build → start → env → overrides
- Add practical examples document (06-setup-examples.md) that follows the container-setup guide

Result: Documentation now follows a clear progression from conceptual
overview through practical examples, with all setup information properly
organized under 02-setup/.

* docs: remove container-setup subfolder and flatten structure

Move all files from docs/02-setup/container-setup/ directly into docs/02-setup/
to eliminate unnecessary subfolder. Files are already numbered sequentially,
so they work perfectly at the same level.

Changes:
- Move all files from container-setup/ subfolder to 02-setup/ root
- Remove container-setup/ subfolder
- Update all cross-references:
  - Update README.md paths (remove container-setup/ from all links)
  - Fix references in site-operations.md
  - Fix references in migration docs
  - Update internal references in 06-setup-examples.md
  - Fix relative path references in 01-overview.md, 02-build-setup.md, 03-start-setup.md

Result: Cleaner, flatter structure with all numbered setup files at the
same level, making navigation more straightforward.

* fix: Pre-commit failure is fixed

---------

Co-authored-by: adithya <adithya.a@bayesian.in>
2025-12-06 10:07:36 +05:30

3.1 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.
  • Also you have to pass -p <project_name> if -p passed previously eg. docker-compose -p <project_name> exec (rest of the command).
docker-compose exec backend bench new-site --mariadb-user-host-login-scope=% --db-root-password <db-password> --admin-password <admin-password> <site-name>

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 --mariadb-user-host-login-scope=% --db-type postgres --admin-password <admin-password> <site-name>

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