File tree Expand file tree Collapse file tree 2 files changed +49
-2
lines changed
Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Original file line number Diff line number Diff line change 108108 systemctl stop termix
109109 msg_ok " Stopped Termix"
110110
111+ msg_info " Migrating Configuration"
112+ if [[ ! -f /opt/termix/.env ]]; then
113+ cat << EOF >/opt/termix/.env
114+ NODE_ENV=production
115+ DATA_DIR=/opt/termix/data
116+ GUACD_HOST=127.0.0.1
117+ GUACD_PORT=4822
118+ EOF
119+ fi
120+ if ! grep -q " EnvironmentFile" /etc/systemd/system/termix.service 2> /dev/null; then
121+ cat << EOF >/etc/systemd/system/termix.service
122+ [Unit]
123+ Description=Termix Backend
124+ After=network.target guacd.service
125+ Wants=guacd.service
126+
127+ [Service]
128+ Type=simple
129+ User=root
130+ WorkingDirectory=/opt/termix
131+ EnvironmentFile=/opt/termix/.env
132+ ExecStart=/usr/bin/node /opt/termix/dist/backend/backend/starter.js
133+ Restart=on-failure
134+ RestartSec=5
135+
136+ [Install]
137+ WantedBy=multi-user.target
138+ EOF
139+ systemctl daemon-reload
140+ fi
141+ cd /opt/termix
142+ $STD node -e "
143+ const Database = require('better-sqlite3');
144+ try {
145+ const db = new Database('data/db.sqlite');
146+ db.prepare(\" UPDATE settings SET value = '127.0.0.1:4822' WHERE key = 'guac_url' AND value LIKE '%guacd%'\" ).run();
147+ db.close();
148+ } catch(e) {}
149+ "
150+ msg_ok " Migrated Configuration"
151+
111152 msg_info " Backing up Data"
112153 cp -r /opt/termix/data /opt/termix_data_backup
113154 cp -r /opt/termix/uploads /opt/termix_uploads_backup
Original file line number Diff line number Diff line change @@ -113,6 +113,13 @@ bind_host = 127.0.0.1
113113bind_port = 4822
114114EOF
115115
116+ cat << EOF >/opt/termix/.env
117+ NODE_ENV=production
118+ DATA_DIR=/opt/termix/data
119+ GUACD_HOST=127.0.0.1
120+ GUACD_PORT=4822
121+ EOF
122+
116123cat << EOF >/etc/systemd/system/guacd.service
117124[Unit]
118125Description=Guacamole Proxy Daemon (guacd)
@@ -138,8 +145,7 @@ Wants=guacd.service
138145Type=simple
139146User=root
140147WorkingDirectory=/opt/termix
141- Environment=NODE_ENV=production
142- Environment=DATA_DIR=/opt/termix/data
148+ EnvironmentFile=/opt/termix/.env
143149ExecStart=/usr/bin/node /opt/termix/dist/backend/backend/starter.js
144150Restart=on-failure
145151RestartSec=5
You can’t perform that action at this time.
0 commit comments