45 lines
2.5 KiB
Markdown
45 lines
2.5 KiB
Markdown
# Set of commands
|
|
|
|
Also found [here](https://iratusmachina.com/#production-go-systemd-attempt-five)
|
|
|
|
```sh
|
|
$ sudo useradd --system --comment 'Go Custom Urls Service' --no-create-home <your user>
|
|
useradd: failed to reset the lastlog entry of UID 992: No such file or directory
|
|
$ sudo passwd -d <your user>
|
|
passwd: password changed.
|
|
$ getent passwd <your user>
|
|
<your user>:x:992:991:Go Custom Urls Service:/home/<your user>:/bin/bash
|
|
$ sudo mkdir -p /var/lib/<your user>/appfiles/otherfiles
|
|
$ sudo cp docker-compose.yml /var/lib/<your user>/appfiles/
|
|
$ sudo cp Dockerfile.1 /var/lib/<your user>/appfiles/Dockerfile
|
|
$ sed -i 's/$MYUSER/<your user>/g' gocustomurls.service
|
|
$ sed -i 's/$MYUSER/<your user>/g' config.json
|
|
$ sudo cp config.json /var/lib/<your user>/appfiles/othefiles
|
|
$ sudo cp rules.json /var/lib/<your user>/appfiles/otherfiles
|
|
$ sudo chmod -R 770 /var/lib/<your user>
|
|
$ sudo chown -R <your user>:<your user> /var/lib/<your user>
|
|
$ sudo cp gocustomurls.service /etc/systemd/system/
|
|
$ sudo systemctl daemon-reload
|
|
$ sudo systemctl start gocustomurls.service
|
|
● gocustomurls.service - GocustomUrls. A custom url mapper for go packages!
|
|
Loaded: loaded (/etc/systemd/system/gocustomurls.service; disabled; preset: disabled)
|
|
Drop-In: /usr/lib/systemd/system/service.d
|
|
└─10-timeout-abort.conf
|
|
Active: active (exited) since Sat 2024-08-03 18:08:46 UTC; 50s ago
|
|
Process: 24117 ExecStart=/bin/bash -c HOME=/var/lib/<your user> USER_ID=$(id -u) GROUP_ID=$(id -g) USERNAME=$(whoami) docker compose --file /var/lib/<your user>/docker-compose.yml up --detach --force-recreate (code=exited, status=0/SUCCESS)
|
|
Main PID: 24117 (code=exited, status=0/SUCCESS)
|
|
CPU: 125ms
|
|
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: #17 DONE 0.0s
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: #18 [app] resolving provenance for metadata file
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: #18 DONE 0.0s
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: Network <your user>_default Creating
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: Network <your user>_default Created
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: Container gocustomurls_app Creating
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: Container gocustomurls_app Created
|
|
Aug 03 18:08:45 fedoramachine gocustomurls[24132]: Container gocustomurls_app Starting
|
|
Aug 03 18:08:46 fedoramachine gocustomurls[24132]: Container gocustomurls_app Started
|
|
Aug 03 18:08:46 fedoramachine systemd[1]: Finished gocustomurls.service - GocustomUrls. A custom url mapper for go packages!.
|
|
|
|
```
|