Skip to content

Commit 6dd4f23

Browse files
committed
fix: install script won't be asking for let's encrypt email
1 parent 920ae1a commit 6dd4f23

2 files changed

Lines changed: 59 additions & 55 deletions

File tree

install.sh

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ run_step() {
3838
spinner &
3939
SPINNER_PID=$!
4040

41-
bash -c "$cmd" >>"$LOG_FILE" 2>&1 || true
41+
bash -c "$cmd" >>"$LOG_FILE" 2>&1
4242

4343
kill "$SPINNER_PID" >/dev/null 2>&1 || true
4444
wait "$SPINNER_PID" 2>/dev/null || true
@@ -60,10 +60,6 @@ fail() {
6060
}
6161
trap fail ERR
6262

63-
echo "📧 Let's Encrypt configuration"
64-
read -rp "Email (default: admin@example.com): " LETSENCRYPT_EMAIL
65-
LETSENCRYPT_EMAIL="${LETSENCRYPT_EMAIL:-admin@example.com}"
66-
6763
echo "🔐 Verifying sudo access..."
6864
sudo -v
6965

@@ -75,6 +71,8 @@ sudo -v
7571
) 2>/dev/null &
7672
SUDO_KEEPALIVE_PID=$!
7773

74+
# ---------------- Packages ----------------
75+
7876
if command -v apt >/dev/null; then
7977
PKG_INSTALL="sudo apt update && sudo apt install -y git curl build-essential wget unzip"
8078
elif command -v dnf >/dev/null; then
@@ -89,7 +87,9 @@ fi
8987

9088
run_step "Installing system dependencies" "$PKG_INSTALL"
9189

92-
command -v docker >/dev/null || exit 1
90+
command -v docker >/dev/null
91+
92+
# ---------------- Go ----------------
9393

9494
if ! command -v go >/dev/null; then
9595
run_step "Installing Go" "
@@ -98,10 +98,12 @@ if ! command -v go >/dev/null; then
9898
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
9999
"
100100
grep -q '/usr/local/go/bin' "$REAL_HOME/.bashrc" || \
101-
echo 'export PATH=$PATH:/usr/local/go/bin' >>"$REAL_HOME/.bashrc"
101+
echo 'export PATH=\$PATH:/usr/local/go/bin' >>"$REAL_HOME/.bashrc"
102102
export PATH="$PATH:/usr/local/go/bin"
103103
fi
104104

105+
# ---------------- Repo ----------------
106+
105107
if [ -d "$INSTALL_DIR/.git" ]; then
106108
run_step "Updating Mist ($BRANCH)" "
107109
cd '$INSTALL_DIR' &&
@@ -116,53 +118,31 @@ else
116118
"
117119
fi
118120

119-
run_step "Ensuring Traefik Docker network" "
120-
docker network inspect traefik-net >/dev/null 2>&1 ||
121-
docker network create traefik-net
122-
"
123-
124-
[ -f "$INSTALL_DIR/traefik-static.yml" ] || exit 1
121+
# ---------------- Directories FIRST ----------------
125122

126-
run_step "Configuring Traefik" "
127-
grep -q '$LETSENCRYPT_EMAIL' '$INSTALL_DIR/traefik-static.yml' ||
128-
sed -i \"s|^\\s*email:.*| email: $LETSENCRYPT_EMAIL|\" '$INSTALL_DIR/traefik-static.yml'
123+
run_step "Preparing data directories" "
124+
sudo mkdir -p /var/lib/mist/traefik &&
125+
sudo mkdir -p $(dirname "$MIST_FILE") &&
126+
sudo touch '$MIST_FILE' &&
127+
sudo chown -R '$REAL_USER:$REAL_USER' /var/lib/mist
129128
"
130129

131-
run_step "Starting Traefik" "
132-
docker compose -f '$INSTALL_DIR/traefik-compose.yml' up -d
130+
run_step "Initializing Traefik dynamic config" "
131+
cat > /var/lib/mist/traefik/dynamic.yml <<'EOF'
132+
http:
133+
routers: {}
134+
services: {}
135+
EOF
133136
"
134137

135-
[ -d "$INSTALL_DIR/$GO_BACKEND_DIR/static" ] || exit 1
138+
# ---------------- Backend ----------------
136139

137140
run_step "Building backend" "
138141
cd '$INSTALL_DIR/$GO_BACKEND_DIR' &&
139142
go mod tidy &&
140143
go build -o '$GO_BINARY_NAME'
141144
"
142145

143-
run_step "Building CLI tool" "
144-
cd '$INSTALL_DIR/cli' &&
145-
go mod tidy &&
146-
go build -o mist-cli
147-
"
148-
149-
run_step "Preparing data directories" "
150-
sudo mkdir -p /var/lib/mist/traefik &&
151-
sudo mkdir -p $(dirname "$MIST_FILE") &&
152-
sudo touch '$MIST_FILE' &&
153-
sudo chown -R '$REAL_USER:$REAL_USER' /var/lib/mist
154-
"
155-
156-
run_step "Configuring firewall" "
157-
if command -v ufw >/dev/null; then
158-
sudo ufw allow $PORT/tcp || true
159-
sudo ufw reload || true
160-
elif command -v firewall-cmd >/dev/null; then
161-
sudo firewall-cmd --permanent --add-port=${PORT}/tcp || true
162-
sudo firewall-cmd --reload || true
163-
fi
164-
"
165-
166146
run_step "Installing systemd service" "
167147
sudo tee '$SERVICE_FILE' >/dev/null <<EOF
168148
[Unit]
@@ -185,32 +165,56 @@ EOF
185165

186166
run_step "Starting $APP_NAME service" "
187167
sudo systemctl daemon-reload &&
188-
sudo systemctl enable '$APP_NAME' || true &&
168+
sudo systemctl enable '$APP_NAME' &&
189169
sudo systemctl restart '$APP_NAME'
190170
"
191171

172+
# ---------------- Traefik LAST ----------------
173+
174+
run_step "Ensuring Traefik Docker network" "
175+
docker network inspect traefik-net >/dev/null 2>&1 ||
176+
docker network create traefik-net
177+
"
178+
179+
run_step "Starting Traefik" "
180+
docker compose -f '$INSTALL_DIR/traefik-compose.yml' up -d
181+
"
182+
183+
# ---------------- CLI ----------------
184+
185+
run_step "Building CLI tool" "
186+
cd '$INSTALL_DIR/cli' &&
187+
go mod tidy &&
188+
go build -o mist-cli
189+
"
190+
192191
run_step "Installing CLI tool" "
193192
sudo cp '$INSTALL_DIR/cli/mist-cli' /usr/local/bin/mist-cli &&
194193
sudo chmod +x /usr/local/bin/mist-cli
195194
"
196195

196+
# ---------------- Firewall ----------------
197+
198+
run_step "Configuring firewall" "
199+
if command -v ufw >/dev/null; then
200+
sudo ufw allow $PORT/tcp || true
201+
sudo ufw reload || true
202+
elif command -v firewall-cmd >/dev/null; then
203+
sudo firewall-cmd --permanent --add-port=${PORT}/tcp || true
204+
sudo firewall-cmd --reload || true
205+
fi
206+
"
207+
208+
# ---------------- Done ----------------
209+
197210
SERVER_IP="$(curl -fsSL https://api.ipify.org || hostname -I | awk '{print $1}')"
198211
URL="http://$SERVER_IP:$PORT"
199212

200213
echo
201214
echo "╔════════════════════════════════════════════╗"
202215
echo "║ 🎉 Mist is now running ║"
203-
echo "║ ║"
204-
echo "║ 👉 Open this in your browser: ║"
205-
echo "║ ║"
206-
printf "║ %-40s ║\n" "$URL"
207-
echo "║ ║"
208-
echo "║ (Ctrl + Click the link above if supported) ║"
209-
echo "║ ║"
210-
echo "║ 🛠️ CLI tool installed: mist-cli ║"
211-
echo "║ • mist-cli user list ║"
212-
echo "║ • mist-cli settings list ║"
213-
echo "║ • mist-cli help ║"
216+
echo "║ 👉 $URL"
217+
echo "║ 🛠️ CLI: mist-cli ║"
214218
echo "╚════════════════════════════════════════════╝"
215219
echo
216220
echo "📄 Logs: $LOG_FILE"

server/utils/traefik.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func generateDynamicYAML(wildcardDomain *string, mistAppName string) string {
7979
mist-dashboard:
8080
loadBalancer:
8181
servers:
82-
- url: "http://host.docker.internal:8080"
82+
- url: "http://172.17.0.1:8080"
8383
`)
8484
}
8585

0 commit comments

Comments
 (0)