Skip to content

Commit 703d685

Browse files
committed
fully automated setup
1 parent d59fc64 commit 703d685

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

cloud-init.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#cloud-config
2+
package_upgrade: true
3+
packages:
4+
- apt-transport-https
5+
- ca-certificates
6+
- curl
7+
- wget
8+
- gnupg-agent
9+
- software-properties-common
10+
- git
11+
runcmd:
12+
- cd /opt
13+
- git clone https://github.com/hiddify/hiddify-config/
14+
- cd hiddify-config
15+
- echo "USER_SECRET=44da16ea20ff4bac92afae43ef97f067" >config.env
16+
- echo "MAIN_DOMAIN=example.com" >>config.env
17+
- bash install.sh
18+
19+
power_state:
20+
mode: reboot
21+
message: please open https://example.com/44da16ea20ff4bac92afae43ef97f067

config.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
USER_SECRET= # 32 hex secret for user
55
MAIN_DOMAIN= # a subdomain or main domain that is pointed to your server
66

7-
CDN_NAME=ar #ar=arvancloud or cf=cloudflare ; if your are not using cdn enter 'ar'
7+
8+
# Optional:
89
TELEGRAM_AD_TAG= # AD TAG for telegram proxy

install.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ function check_for_env() {
5555

5656
random_secret=$(hexdump -vn16 -e'4/4 "%08X" 1 "\n"' /dev/urandom)
5757
replace_empty_env USER_SECRET "please enter 32 char user secret" $random_secret "^([0-9A-Fa-f]{32})$"
58-
replace_empty_env MAIN_DOMAIN "please enter valid domain name to use " "www.example.com" "^([A-Za-z0-9\.]+\.[a-zA-Z]{2,})$"
59-
DOMAIN_IP=$(dig +short -t a $MAIN_DOMAIN.)
6058
SERVER_IP=$(curl -Lso- https://api.ipify.org)
59+
replace_empty_env MAIN_DOMAIN "please enter valid domain name to use " "$SERVER_IP.nip.io" "^([A-Za-z0-9\.]+\.[a-zA-Z]{2,})$"
60+
61+
62+
DOMAIN_IP=$(dig +short -t a $MAIN_DOMAIN.)
63+
6164

6265
echo "resolving domain $MAIN_DOMAIN -> IP= $DOMAIN_IP ServerIP-> $SERVER_IP"
6366
if [[ $SERVER_IP != $DOMAIN_IP ]];then
@@ -85,7 +88,7 @@ function replace_empty_env() {
8588
echo "Enter $DEFAULT (default value='$DEFAULT' -> to confirm enter)"
8689
fi
8790

88-
read -p "> " RESPONSE
91+
# read -p "> " RESPONSE
8992
if [[ -z "$RESPONSE" ]]; then
9093
RESPONSE=$DEFAULT
9194
fi

0 commit comments

Comments
 (0)