-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
113 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules | ||
dist/ | ||
.DS_Store | ||
.DS_Store | ||
*.log | ||
__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# How this works | ||
I have the following systemd services running: | ||
1. Send a webhook on reboot (ARCity-webhook.service) | ||
2. Run webpack (ARCity-webpack.service) | ||
3. Run the server (ARCity-server.service) | ||
4. Open firefox fullscreen in kiosk mode (ARCity-browser.service) | ||
5. Check the github repo for updates and pull them (ARCity-auto-git-pull.service & ARCity-auto-git-pull.timer) | ||
|
||
These need to be copied across to `/etc/systemd/system/` and then enabled and started with `systemctl enable <service-name>`. The git pull service doesnt need to be enabled, just the timer. | ||
|
||
We also need to set up the BIOS to restart the computer when it loses power. This is done by going into the BIOS (keep pushing F2 after restart) and setting the power loss option to restart. | ||
|
||
In principle from then everything should just work! |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[Unit] | ||
Description=Auto Git Pull Service | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/opt/ARCity/auto-pull.sh | ||
WorkingDirectory=/opt/ARCity/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Run Git Auto Pull every 5 minutes | ||
|
||
[Timer] | ||
OnBootSec=5min | ||
OnUnitActiveSec=5min | ||
Unit=ARCity-auto-git-pull.service | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Start browser fullscreen | ||
Wants=network-online.target | ||
Requires=graphical.target | ||
After=network-online.target ARCity-server.service | ||
|
||
[Service] | ||
Environment=DISPLAY=:0.0 | ||
Environment=XAUTHORITY=/home/%u/.Xauthority | ||
Type=simple | ||
ExecStart=firefox -kiosk http://localhost:8080 | ||
Restart=on-abort | ||
|
||
[Install] | ||
WantedBy=graphical.target | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=ARCity communications server | ||
Wants=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=simple | ||
WorkingDirectory=/opt/ARCity/ | ||
ExecStart=npx nodemon /opt/ARCity/src/js/server.js | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Description=Startup webhook | ||
Wants=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=oneshot | ||
User=smartcity | ||
WorkingDirectory=/opt/ARCity/ | ||
ExecStart=/opt/ARCity/sys/webhook.sh | ||
ExecStartPost=/opt/ARCity/sys/start_kiosk.sh | ||
RemainAfterExit=yes | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Startup webhook | ||
Wants=network-online.target | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=simpley | ||
WorkingDirectory=/opt/ARCity/ | ||
ExecStart=npx webpack serve | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# Navigate to the directory of your Git repository | ||
cd /opt/ARCity || exit | ||
|
||
# Pull the latest changes | ||
git pull origin main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
npx webpack serve & | ||
npx nodemon --legacy-watch --delay 2.5 src/js/server.js & | ||
# sleep 1 | ||
firefox -kiosk http://localhost:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
IPADDRESS=$(curl ifconfig.me) | ||
|
||
curl -i -X POST -H 'Content-Type: application/json' -d '{"text": "'"ARCity installation ${hostname} has turned back on with IP Address ${IPADDRESS} :tada:"'"}' https://mattermost.scigem.com/hooks/5cwtdg8cupds5n5hiehby75mwe |