2
0
mirror of https://github.com/frappe/bench.git synced 2025-02-12 23:58:25 +00:00

chore: Update Readme and changed password generated method

Co-authored-by: @ankush
This commit is contained in:
Athul Cyriac Ajay 2022-12-13 13:18:09 +05:30
parent 3ff7bfb35f
commit 9313777276
2 changed files with 73 additions and 15 deletions

View File

@ -31,17 +31,21 @@ Bench is a command-line utility that helps you to install, update, and manage mu
## Table of Contents
- [Installation](#installation)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Containerized Installation](#containerized-installation)
- [Easy Install Script](#easy-install-script)
- [Setup](#setup)
- [Arguments](#arguments)
- [Troubleshooting](#troubleshooting)
- [Manual Installation](#manual-installation)
- [Usage](#basic-usage)
- [Custom Bench commands](#custom-bench-commands)
- [Bench Manager](#bench-manager)
- [Guides](#guides)
- [Resources](#resources)
- [Development](#development)
- [Releases](#releases)
- [License](#license)
- [Basic Usage](#basic-usage)
- [Custom Bench Commands](#custom-bench-commands)
- [Guides](#guides)
- [Resources](#resources)
- [Development](#development)
- [Releases](#releases)
- [License](#license)
## Installation
@ -71,6 +75,53 @@ $ cd frappe_docker
A quick setup guide for both the environments can be found below. For more details, check out the [Frappe/ERPNext Docker Repository](https://github.com/frappe/frappe_docker).
### Easy Install Script
The Easy Install script should get you going with a Frappe/ERPNext setup with minimal manual intervention and effort.
This script uses Docker with the [Frappe/ERPNext Docker Repository](https://github.com/frappe/frappe_docker) and can be used for both Development setup and Production setup.
#### Setup
Download the Easy Install script and execute it:
```sh
$ wget https://raw.githubusercontent.com/frappe/bench/develop/easy-install.py
$ python3 install.py --prod
```
This script will install docker on your system and will fetch the required containers, setup bench and a default ERPNext instance.
The script will generate MySQL root password and an Administrator password for the Frappe/ERPNext instance, which will then be saved under `$HOME/passwords.txt` of the user used to setup the instance.
It will also generate a new compose file under `$HOME/<project-name>-compose.yml`.
When the setup is complete, you will be able to access the system at `http://<your-server-ip>`, wherein you can use the Administrator password to login.
#### Arguments
Here are the arguments for the easy-install script
```txt
usage: easy-install.py [-h] [-p] [-d] [-s SITENAME] [-n PROJECT] [--email EMAIL]
Install Frappe with Docker
options:
-h, --help show this help message and exit
-p, --prod Setup Production System
-d, --dev Setup Development System
-s SITENAME, --sitename SITENAME
The Site Name for your production site
-n PROJECT, --project PROJECT
Project Name
--email EMAIL Add email for the SSL.
```
#### Troubleshooting
In case the setup fails, the log file is saved under `$HOME/easy-install.log`. You may then
- Create an Issue in this repository with the log file attached.
### Manual Installation

View File

@ -14,7 +14,7 @@ from typing import Dict
logging.basicConfig(
filename="easy-install.log",
filemode="w",
format="%(levelname)s - %(message)s",
format="%(asctime)s - %(levelname)s - %(message)s",
level=logging.INFO,
)
@ -91,7 +91,14 @@ def write_to_env(wd: str, site: str, db_pass: str, admin_pass: str, email: str)
def generate_pass(length: int = 12) -> str:
return sha224(repr(time.time()).encode()).hexdigest()[:length]
"""Generate random hash using best available randomness source."""
import math
import secrets
if not length:
length = 56
return secrets.token_hex(math.ceil(length / 2))[:length]
def check_repo_exists() -> bool:
@ -108,11 +115,11 @@ def setup_prod(project: str, sitename: str, email: str) -> None:
"\nPlease refer to .example.env file in the frappe_docker folder to know which keys to set\n\n",
level=3,
)
admin_pass = generate_pass()
db_pass = generate_pass(9)
with open(compose_file_name, "w") as f:
# Writing to compose file
if not os.path.exists(os.path.join(docker_repo_path, ".env")):
admin_pass = generate_pass()
db_pass = generate_pass(9)
write_to_env(docker_repo_path, sitename, db_pass, admin_pass, email)
cprint(
"\nA .env file is generated with basic configs. Please edit it to fit to your needs \n",
@ -121,8 +128,8 @@ def setup_prod(project: str, sitename: str, email: str) -> None:
with open(
os.path.join(os.path.expanduser("~"), "passwords.txt"), "w"
) as en:
en.writelines(f"Administrator:{admin_pass}\n")
en.writelines(f"MariaDB Root Password:{db_pass}\n")
en.writelines(f"ADMINISTRATOR_PASSWORD={admin_pass}\n")
en.writelines(f"MARIADB_ROOT_PASSWORD={db_pass}\n")
try:
# TODO: Include flags for non-https and non-erpnext installation
subprocess.run(