Move scripts to tools/ folder
This commit is contained in:
20
readme.md
20
readme.md
@@ -7,28 +7,24 @@ This project is a personal cloud of services:
|
||||
|
||||
# Setup
|
||||
|
||||
1. Generate a self-signed certificate for the proxy.
|
||||
1. Generate a certificate for the proxy
|
||||
|
||||
To generate a self-signed certificate (e.g. for `localhost`):
|
||||
|
||||
```
|
||||
host=yourdomain.com
|
||||
mkcert -cert-file services/nginx/server.crt -key-file services/nginx/server.key \
|
||||
gitea.$host nextcloud.$host redmine.$host \
|
||||
$host 127.0.0.1 ::1
|
||||
./tools/generate_self_signed_cert.bash localhost .
|
||||
```
|
||||
|
||||
Alternatively you can generate a real CA signed certificate (if your own a domain):
|
||||
Alternatively to generate a CA signed certificate (if your own a domain):
|
||||
|
||||
```
|
||||
sudo certbot certonly --cert-path services/nginx/server.crt --key-path services/nginx/server.key \
|
||||
--manual --preferred-challenges dns --agree-tos --email admin@example.com \
|
||||
-d gitea.yourdomain.com -d nextcloud.yourdomain.com -d redmine.yourdomain.com
|
||||
./tools/generate_cert.bash yourdomain.com admin@email.com .
|
||||
```
|
||||
|
||||
2. Configure the host name.
|
||||
2. Configure the host name (e.g. for `localhost`):
|
||||
|
||||
```
|
||||
host=yourdomain.com
|
||||
sudo ./configure.bash $host .
|
||||
./tools/configure.bash localhost .
|
||||
```
|
||||
|
||||
3. Start the services.
|
||||
|
||||
@@ -12,11 +12,11 @@ sed -Ei "s/(^[[:blank:]]*server_name [^_][^.]*\.)[^;]*/\1${server_name}/" "$root
|
||||
# Note that this works only if you use a docker volume named `tvcloud_gitea` (this project default).
|
||||
gitea_conf_file=/var/lib/docker/volumes/tvcloud_gitea/_data/gitea/conf/app.init
|
||||
if [[ ! -e $gitea_conf_file ]]; then
|
||||
mkdir -p "$(dirname "$gitea_conf_file")"
|
||||
touch "$gitea_conf_file"
|
||||
sudo mkdir -p "$(dirname "$gitea_conf_file")"
|
||||
sudo touch "$gitea_conf_file"
|
||||
fi
|
||||
if grep -Eq "\[server\] ROOT_URL = https://gitea\." $gitea_conf_file; then
|
||||
sed -Ei "s/(\[server\] ROOT_URL = https:\/\/gitea\.).*/\1$server_name/" "$gitea_conf_file"
|
||||
if sudo grep -Eq "\[server\] ROOT_URL = https://gitea\." $gitea_conf_file; then
|
||||
sudo sed -Ei "s/(\[server\] ROOT_URL = https:\/\/gitea\.).*/\1$server_name/" "$gitea_conf_file"
|
||||
else
|
||||
echo "[server] ROOT_URL = https://gitea.${server_name}/" >>"$gitea_conf_file"
|
||||
echo "[server] ROOT_URL = https://gitea.${server_name}/" | sudo tee -a "$gitea_conf_file" >/dev/null
|
||||
fi
|
||||
12
tools/generate_cert.bash
Executable file
12
tools/generate_cert.bash
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage="Usage: $0 host email project_root"
|
||||
host="${1:?$usage}"
|
||||
email="${2:?$usage}"
|
||||
root="${3:?$usage}"
|
||||
services=(nextcloud gitea redmine)
|
||||
nginx_dir="$root"/services/nginx
|
||||
|
||||
# shellcheck disable=SC2068
|
||||
sudo certbot certonly --cert-path "$nginx_dir"/server.crt --key-path "$nginx_dir"/server.key \
|
||||
--manual --preferred-challenges dns --agree-tos --email "$email" ${services[@]/*/-d &."$host"}
|
||||
11
tools/generate_self_signed_cert.bash
Executable file
11
tools/generate_self_signed_cert.bash
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage="Usage: $0 host project_root"
|
||||
host="${1:?$usage}"
|
||||
root="${2:?$usage}"
|
||||
services=(nextcloud gitea redmine)
|
||||
nginx_dir="$root"/services/nginx
|
||||
|
||||
mkcert -install
|
||||
mkcert -cert-file "$nginx_dir"/server.crt -key-file "$nginx_dir"/server.key \
|
||||
"${services[@]/%/.$host}" "$host" 127.0.0.1 ::1
|
||||
Reference in New Issue
Block a user