2020-06-13 15:33:06 +05:30
# Site operations
2020-06-12 22:19:37 +05:30
2021-12-17 15:06:32 +03:00
## Setup new site
2020-06-12 22:19:37 +05:30
Note:
2021-12-17 15:06:32 +03:00
- 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.
2020-06-30 15:27:14 +05:30
2020-06-12 22:19:37 +05:30
```sh
2021-12-17 15:06:32 +03:00
docker-compose exec backend bench new-site < site-name > --mariadb-root-password < db-password > --admin-password < admin-password >
2020-06-12 22:19:37 +05:30
```
2021-12-17 15:06:32 +03:00
If you need to install some app, specify `--install-app` . To see all options, just run `bench new-site --help` .
2020-06-30 15:27:14 +05:30
2021-12-17 15:06:32 +03:00
To create Postgres site (assuming you already use [Postgres compose override ](images-and-compose-files.md#overrides )) you need have to do set `root_login` and `root_password` in common config before that:
2020-06-30 15:27:14 +05:30
```sh
2021-12-17 15:06:32 +03:00
docker-compose exec backend bench set-config -g root_login < root-login >
docker-compose exec backend bench set-config -g root_password < root-password >
2020-06-30 15:27:14 +05:30
```
2021-12-17 15:06:32 +03:00
Also command is slightly different:
2020-06-12 22:19:37 +05:30
```sh
2021-12-17 15:06:32 +03:00
docker-compose exec backend bench new-site < site-name > --db-type postgres --admin-password < admin-password >
2020-06-12 22:19:37 +05:30
```
2021-12-17 15:06:32 +03:00
## Push backup to S3 storage
2020-06-12 22:19:37 +05:30
2021-12-17 15:06:32 +03:00
We have the script that helps to push latest backup to S3.
2020-06-12 22:19:37 +05:30
```sh
2021-12-17 15:06:32 +03:00
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 >
2020-06-12 22:19:37 +05:30
```
2021-12-17 15:06:32 +03:00
Note that you can restore backup only manually.
2020-06-12 22:19:37 +05:30
2020-06-13 15:33:06 +05:30
## Edit configs
Editing config manually might be required in some cases,
one such case is to use Amazon RDS (or any other DBaaS).
2021-12-10 11:53:43 +03:00
For full instructions, refer to the [wiki ](<https://github.com/frappe/frappe/wiki/Using-Frappe-with-Amazon-RDS-(or-any-other-DBaaS )>). Common question can be found in Issues and on forum.
2020-06-13 15:33:06 +05:30
2021-12-17 15:06:32 +03:00
`common_site_config.json` or `site_config.json` from `sites` volume has to be edited using following command:
2020-06-13 15:33:06 +05:30
```sh
2021-12-17 15:06:32 +03:00
docker run --rm -it \
-v < project-name > _sites:/sites \
2020-06-13 15:33:06 +05:30
alpine vi /sites/common_site_config.json
```
Instead of `alpine` use any image of your choice.
2020-07-02 13:40:23 +05:30
## 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.
```shell
2021-12-17 15:06:32 +03:00
docker-compose exec backend healthcheck.sh --ping-service mongodb:27017
2020-07-02 13:40:23 +05:30
```
2020-07-02 15:52:06 +05:30
Additional services can be pinged as part of health check with option `-p` or `--ping-service` .
2020-07-02 13:40:23 +05:30
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.
2020-08-13 15:29:10 +05:30
2021-12-17 15:06:32 +03:00
---
2020-10-01 18:11:49 +05:30
2021-12-17 15:06:32 +03:00
For reference of commands like `backup` , `drop-site` or `migrate` check [official guide ](https://frappeframework.com/docs/v13/user/en/bench/frappe-commands ) or run:
2020-10-01 18:11:49 +05:30
```sh
2021-12-17 15:06:32 +03:00
docker-compose exec backend bench --help
2020-10-01 18:11:49 +05:30
```
2021-12-26 13:38:51 +05:30
## 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.
```sh
docker-compose exec backend bench --site < site-name > migrate
```