This commit is contained in:
parent
1115512817
commit
b74bd67a4a
@ -1,10 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo $SSH_KEY | base64 -d >> /tmp/key
|
echo $SSH_KEY | base64 -d >> /tmp/key
|
||||||
chmod -R 0600 /tmp/key
|
chmod -R 0600 /tmp/key
|
||||||
|
|
||||||
|
rsync -e "ssh -i /tmp/key -o StrictHostKeyChecking=no" -avz --delete ./systemd/ $RSYNC_DESTINATION/.config/systemd/user/
|
||||||
|
|
||||||
cd dist
|
cd dist
|
||||||
for item in *; do
|
for item in *; do
|
||||||
echo "copying $item"
|
echo "copying $item"
|
||||||
@ -20,4 +22,7 @@ done
|
|||||||
cd ..
|
cd ..
|
||||||
echo "finished copying to remote host..."
|
echo "finished copying to remote host..."
|
||||||
|
|
||||||
|
ssh -i /tmp/key -o StrictHostKeyChecking=no $(echo "${$RSYNC_DESTINATION%%:*}") "systemctl daemon reload --user && systemctl restart --user fruitvote"
|
||||||
|
echo "reloading fruitvote..."
|
||||||
|
|
||||||
rm /tmp/key
|
rm /tmp/key
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
nice -n 19 /home/simponic/fruitvote/fruitvote \
|
|
||||||
--users simponic,nginx \
|
|
||||||
--socket-path /home/simponic/fruitvote/http.sock \
|
|
||||||
&
|
|
||||||
# --database /home/simponic/fruitvote/db.sqlite \
|
|
@ -4,28 +4,19 @@ class GoPage {
|
|||||||
private $socket;
|
private $socket;
|
||||||
private $template;
|
private $template;
|
||||||
|
|
||||||
public function __construct($page, $socket = "/home/simponic/fruitvote/http.sock", $start_cmd="/home/simponic/fruitvote/start.sh", $template = "../template.html") {
|
public function __construct($page, $socket = "/home/simponic/fruitvote/http.sock", $template = "../template.html") {
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
$this->socket = $socket;
|
$this->socket = $socket;
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
|
|
||||||
// test if socket exists
|
|
||||||
if (!file_exists($socket)) {
|
|
||||||
// start the server
|
|
||||||
exec($start_cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($i = 0; $i < 10; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
if (file_exists($socket)) {
|
if (file_exists($socket)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(100_000); // wait 100ms
|
usleep(100_000); // wait 100ms
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($socket)) {
|
|
||||||
throw new Exception("Could not start server");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function go() {
|
public function go() {
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
$url = "http://localhost".$this->page;
|
$url = "http://localhost".$this->page;
|
||||||
|
10
systemd/fruitvote.service
Normal file
10
systemd/fruitvote.service
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=fruitvote
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/bin/nice -n 19 /home/simponic/fruitvote/fruitvote --socket-path /home/simponic/fruitvote/http.sock --users nginx,simponic
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
Loading…
Reference in New Issue
Block a user