2020-06-13 10:03:06 +00:00
# Site operations
2020-06-12 16:49:37 +00:00
2022-03-14 05:53:03 +00:00
> 💡 You should setup `--project-name` option in `docker-compose` commands if you have non-standard project name.
2020-06-12 16:49:37 +00:00
2022-03-14 05:53:03 +00:00
## Setup new site
2020-06-12 16:49:37 +00:00
Note:
2022-03-14 05:53:03 +00: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-12 16:49:37 +00:00
```sh
2023-10-30 06:15:55 +00:00
docker-compose exec backend bench new-site --no-mariadb-socket --mariadb-root-password < db-password > --admin-password < admin-password > < site-name >
2020-06-12 16:49:37 +00:00
```
2022-03-14 05:53:03 +00:00
If you need to install some app, specify `--install-app` . To see all options, just run `bench new-site --help` .
2020-06-12 16:49:37 +00:00
2022-03-14 05:53:03 +00: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-12 16:49:37 +00:00
```sh
2022-03-14 05:53:03 +00: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-12 16:49:37 +00:00
```
2022-03-14 05:53:03 +00:00
Also command is slightly different:
2020-06-12 16:49:37 +00:00
```sh
2023-10-30 06:15:55 +00:00
docker-compose exec backend bench new-site --no-mariadb-socket --db-type postgres --admin-password < admin-password > < site-name >
2020-06-12 16:49:37 +00:00
```
2022-03-14 05:53:03 +00:00
## Push backup to S3 storage
2020-06-12 16:49:37 +00:00
2022-03-14 05:53:03 +00:00
We have the script that helps to push latest backup to S3.
2020-06-12 16:49:37 +00:00
```sh
2022-03-14 05:53:03 +00: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 16:49:37 +00:00
```
2022-03-14 05:53:03 +00:00
Note that you can restore backup only manually.
2020-06-12 16:49:37 +00:00
2020-06-13 10:03:06 +00:00
## 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 08:53:43 +00: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 10:03:06 +00:00
2022-03-14 05:53:03 +00:00
`common_site_config.json` or `site_config.json` from `sites` volume has to be edited using following command:
2020-06-13 10:03:06 +00:00
```sh
2022-03-14 05:53:03 +00:00
docker run --rm -it \
-v < project-name > _sites:/sites \
2020-06-13 10:03:06 +00:00
alpine vi /sites/common_site_config.json
```
Instead of `alpine` use any image of your choice.
2020-07-02 08:10:23 +00:00
## 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
2022-03-14 05:53:03 +00:00
docker-compose exec backend healthcheck.sh --ping-service mongodb:27017
2020-07-02 08:10:23 +00:00
```
2020-07-02 10:22:06 +00:00
Additional services can be pinged as part of health check with option `-p` or `--ping-service` .
2020-07-02 08:10:23 +00:00
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 09:59:10 +00:00
2022-03-14 05:53:03 +00:00
---
2020-10-01 12:41:49 +00:00
2022-03-14 05:53:03 +00: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 12:41:49 +00:00
```sh
2022-03-14 05:53:03 +00:00
docker-compose exec backend bench --help
2020-10-01 12:41:49 +00:00
```
2022-03-14 05:53:03 +00:00
## Migrate site
2020-10-01 12:41:49 +00:00
2022-03-14 05:53:03 +00:00
Note:
2021-04-12 05:47:38 +00:00
2022-03-14 05:53:03 +00:00
- Wait for the `db` service to start and `configurator` to exit before trying to migrate a site. Usually this takes up to 10 seconds.
2021-04-12 05:47:38 +00:00
```sh
2022-03-14 05:53:03 +00:00
docker-compose exec backend bench --site < site-name > migrate
2021-04-12 05:47:38 +00:00
```