@@ -2,7 +2,6 @@ package cmd
2
2
3
3
import (
4
4
"fmt"
5
-
6
5
"github.com/nodetec/rwz/pkg/manager"
7
6
"github.com/nodetec/rwz/pkg/network"
8
7
"github.com/nodetec/rwz/pkg/relays"
@@ -87,19 +86,19 @@ var installCmd = &cobra.Command{
87
86
pterm .Println (pterm .Yellow ("If you make a mistake, you can always re-run this installer." ))
88
87
pterm .Println ()
89
88
90
- // Step 1: Install necessary packages using APT
89
+ // Install necessary packages using APT
91
90
manager .AptInstallPackages (selectedRelayOption )
92
91
93
- // Step 2: Configure the firewall
92
+ // Configure the firewall
94
93
network .ConfigureFirewall ()
95
94
96
- // Step 3: Configure the intrusion detection system
95
+ // Configure the intrusion detection system
97
96
network .ConfigureIntrusionDetection ()
98
97
99
- // Step 4: Configure Nginx
98
+ // Configure Nginx
100
99
network .ConfigureNginx ()
101
100
102
- // Step 5: Create relay user
101
+ // Create relay user
103
102
spinner , _ := pterm .DefaultSpinner .Start (fmt .Sprintf ("Checking if '%s' user exists..." , relays .User ))
104
103
if ! users .UserExists (relays .User ) {
105
104
spinner .UpdateText (fmt .Sprintf ("Creating '%s' user..." , relays .User ))
@@ -110,158 +109,17 @@ var installCmd = &cobra.Command{
110
109
}
111
110
112
111
if selectedRelayOption == khatru_pyramid .RelayName {
113
- // Step 6: Configure Nginx for HTTP
114
- khatru_pyramid .ConfigureNginxHttp (relayDomain )
115
-
116
- // Step 7: Get SSL/TLS certificates
117
- httpsEnabled := network .GetCertificates (relayDomain )
118
- if httpsEnabled {
119
- // Step 8: Configure Nginx for HTTPS
120
- khatru_pyramid .ConfigureNginxHttps (relayDomain )
121
- }
122
-
123
- // Step 9: Download and install the relay binary
124
- khatru_pyramid .InstallRelayBinary (pubKey )
125
-
126
- // Step 10: Set up the relay data directory
127
- khatru_pyramid .SetUpRelayDataDir ()
128
-
129
- // Step 11: Configure the relay
130
- khatru_pyramid .ConfigureRelay (relayDomain , pubKey , relayContact )
131
-
132
- // Step 12: Set up the relay service
133
- khatru_pyramid .SetUpRelayService ()
134
-
135
- // Step 13: Show success messages
136
- khatru_pyramid .SuccessMessages (relayDomain , httpsEnabled )
112
+ khatru_pyramid .Install (relayDomain , pubKey , relayContact )
137
113
} else if selectedRelayOption == nostr_rs_relay .RelayName {
138
- // Step 6: Configure Nginx for HTTP
139
- nostr_rs_relay .ConfigureNginxHttp (relayDomain )
140
-
141
- // Step 7: Get SSL/TLS certificates
142
- httpsEnabled := network .GetCertificates (relayDomain )
143
- if httpsEnabled {
144
- // Step 8: Configure Nginx for HTTPS
145
- nostr_rs_relay .ConfigureNginxHttps (relayDomain )
146
- }
147
-
148
- // Step 9: Download and install the relay binary
149
- nostr_rs_relay .InstallRelayBinary ()
150
-
151
- // Step 10: Set up the relay data directory
152
- nostr_rs_relay .SetUpRelayDataDir ()
153
-
154
- // Step 11: Configure the relay
155
- nostr_rs_relay .ConfigureRelay (relayDomain , pubKey , relayContact , httpsEnabled )
156
-
157
- // Step 12: Set up the relay service
158
- nostr_rs_relay .SetUpRelayService ()
159
-
160
- // Step 13: Show success messages
161
- nostr_rs_relay .SuccessMessages (relayDomain , httpsEnabled )
114
+ nostr_rs_relay .Install (relayDomain , pubKey , relayContact )
162
115
} else if selectedRelayOption == strfry .RelayName {
163
- // Step 6: Configure Nginx for HTTP
164
- strfry .ConfigureNginxHttp (relayDomain )
165
-
166
- // Step 7: Get SSL/TLS certificates
167
- httpsEnabled := network .GetCertificates (relayDomain )
168
- if httpsEnabled {
169
- // Step 8: Configure Nginx for HTTPS
170
- strfry .ConfigureNginxHttps (relayDomain )
171
- }
172
-
173
- // Step 9: Download and install the relay binary
174
- strfry .InstallRelayBinary ()
175
-
176
- // Step 10: Set up the relay data directory
177
- strfry .SetUpRelayDataDir ()
178
-
179
- // Step 11: Configure the relay
180
- strfry .ConfigureRelay (pubKey , relayContact )
181
-
182
- // Step 12: Set up the relay service
183
- strfry .SetUpRelayService ()
184
-
185
- // Step 13: Show success messages
186
- strfry .SuccessMessages (relayDomain , httpsEnabled )
116
+ strfry .Install (relayDomain , pubKey , relayContact )
187
117
} else if selectedRelayOption == wot_relay .RelayName {
188
- // Step 6: Configure Nginx for HTTP
189
- wot_relay .ConfigureNginxHttp (relayDomain )
190
-
191
- // Step 7: Get SSL/TLS certificates
192
- httpsEnabled := network .GetCertificates (relayDomain )
193
- if httpsEnabled {
194
- // Step 8: Configure Nginx for HTTPS
195
- wot_relay .ConfigureNginxHttps (relayDomain )
196
- }
197
-
198
- // Step 9: Download and install the relay binary
199
- wot_relay .InstallRelayBinary (pubKey )
200
-
201
- // Step 10: Set up the relay data directory
202
- wot_relay .SetUpRelayDataDir ()
203
-
204
- // Step 11: Configure the relay
205
- wot_relay .ConfigureRelay (relayDomain , pubKey , relayContact , httpsEnabled )
206
-
207
- // Step 12: Set up the relay site
208
- wot_relay .SetUpRelaySite (relayDomain )
209
-
210
- // Step 13: Set up the relay service
211
- wot_relay .SetUpRelayService ()
212
-
213
- // Step 14: Show success messages
214
- wot_relay .SuccessMessages (relayDomain , httpsEnabled )
118
+ wot_relay .Install (relayDomain , pubKey , relayContact )
215
119
} else if selectedRelayOption == khatru29 .RelayName {
216
- // Step 6: Configure Nginx for HTTP
217
- khatru29 .ConfigureNginxHttp (relayDomain )
218
-
219
- // Step 7: Get SSL/TLS certificates
220
- httpsEnabled := network .GetCertificates (relayDomain )
221
- if httpsEnabled {
222
- // Step 8: Configure Nginx for HTTPS
223
- khatru29 .ConfigureNginxHttps (relayDomain )
224
- }
225
-
226
- // Step 9: Download and install the relay binary
227
- khatru29 .InstallRelayBinary ()
228
-
229
- // Step 10: Set up the relay data directory
230
- khatru29 .SetUpRelayDataDir ()
231
-
232
- // Step 11: Configure the relay
233
- khatru29 .ConfigureRelay (relayDomain , privKey , relayContact )
234
-
235
- // Step 12: Set up the relay service
236
- khatru29 .SetUpRelayService ()
237
-
238
- // Step 13: Show success messages
239
- khatru29 .SuccessMessages (relayDomain , httpsEnabled )
120
+ khatru29 .Install (relayDomain , privKey , relayContact )
240
121
} else if selectedRelayOption == strfry29 .RelayName {
241
- // Step 6: Configure Nginx for HTTP
242
- strfry29 .ConfigureNginxHttp (relayDomain )
243
-
244
- // Step 7: Get SSL/TLS certificates
245
- httpsEnabled := network .GetCertificates (relayDomain )
246
- if httpsEnabled {
247
- // Step 8: Configure Nginx for HTTPS
248
- strfry29 .ConfigureNginxHttps (relayDomain )
249
- }
250
-
251
- // Step 9: Download and install the relay binaries
252
- strfry29 .InstallRelayBinaries ()
253
-
254
- // Step 10: Set up the relay data directory
255
- strfry29 .SetUpRelayDataDir ()
256
-
257
- // Step 11: Configure the relay
258
- strfry29 .ConfigureRelay (relayDomain , pubKey , privKey , relayContact )
259
-
260
- // Step 12: Set up the relay service
261
- strfry29 .SetUpRelayService ()
262
-
263
- // Step 13: Show success messages
264
- strfry29 .SuccessMessages (relayDomain , httpsEnabled )
122
+ strfry29 .Install (relayDomain , pubKey , privKey , relayContact )
265
123
}
266
124
267
125
pterm .Println ()
0 commit comments