From d290e52377e21b48ac85c2ddc025b52818499562 Mon Sep 17 00:00:00 2001 From: Nikola Petrov Date: Mon, 29 Sep 2025 00:12:01 +0200 Subject: [PATCH] personal_website --- backup/02_personal_website.sh | 3 +++ files/my-app.service | 24 ++++++++++++++++++++++++ scripts/10_personal_website.sh | 25 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 backup/02_personal_website.sh create mode 100644 files/my-app.service create mode 100644 scripts/10_personal_website.sh diff --git a/backup/02_personal_website.sh b/backup/02_personal_website.sh new file mode 100644 index 0000000..719ee7d --- /dev/null +++ b/backup/02_personal_website.sh @@ -0,0 +1,3 @@ +cd ../private +mkdir personal_website +scp server:/root/personal_website/mydb.sqlite personal_website \ No newline at end of file diff --git a/files/my-app.service b/files/my-app.service new file mode 100644 index 0000000..c5e063a --- /dev/null +++ b/files/my-app.service @@ -0,0 +1,24 @@ +[Unit] +# describe the app +Description=My App +# start the app after the network is available +After=network.target + +[Service] +# usually you'll use 'simple' +# one of https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type= +Type=simple +# which user to use when starting the app +User=root +# path to your application's root directory +WorkingDirectory=/root/personal_website +# the command to start the app +# requires absolute paths +ExecStart=/root/.bun/bin/bun app.js +# restart policy +# one of {no|on-success|on-failure|on-abnormal|on-watchdog|on-abort|always} +Restart=always + +[Install] +# start the app automatically +WantedBy=multi-user.target \ No newline at end of file diff --git a/scripts/10_personal_website.sh b/scripts/10_personal_website.sh new file mode 100644 index 0000000..c9cd449 --- /dev/null +++ b/scripts/10_personal_website.sh @@ -0,0 +1,25 @@ +wget https://github.com/gohugoio/hugo/releases/download/v0.150.1/hugo_extended_0.150.1_linux-amd64.tar.gz + +mkdir /opt/hugo +tar -C /opt/hugo -xzf hugo_extended_0.150.1_linux-amd64.tar.gz +ln -s /opt/hugo/hugo /usr/bin/hugo + +git clone --depth 1 --recurse-submodules https://git.petrovv.com/nikola/personal_website.git +cd personal_website +bun i +./build.sh + +mv output/ /root/personal_website/ + +cd .. +rm -rf personal_website + +cd .. +cp private/mydb.sqlite server:/root/personal_website/ +cp files/my-app.service /etc/systemd/system/my-app.service + + +systemctl daemon-reload +systemctl enable my-app +systemctl start my-app +