Compare commits

...

2 Commits

Author SHA1 Message Date
Andrei Jiroh Halili c504e75cf6
Add example Caddyfile for reference
Signed-off-by: Andrei Jiroh Eugenio Halili <ajhalili2006@gmail.com>
2022-06-02 19:08:49 +08:00
Andrei Jiroh Halili f0359db526
Add some scripts and add keys directory via gitkeep way
Signed-off-by: Andrei Jiroh Eugenio Halili <ajhalili2006@gmail.com>
2022-06-02 19:01:23 +08:00
5 changed files with 67 additions and 0 deletions

10
Caddyfile Normal file
View File

@ -0,0 +1,10 @@
# Change mydomain.tld into your own domain over here. We also recommend to edit this file
# based on your needs.
mydomain.tld {
reverse_proxy localhost:8080
tls {
# Get an API token from https://dash.cloudflare.com/profile/api-tokens with scoped DNS editing perms
# to your domain. If not using Cloudflare DNS, please update this section
dns cloudflare yourTokenHere
}
}

0
keys/.gitkeep Normal file
View File

16
scripts/get-latest-files.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -xe
# Public access key for the dumps, read-only
ACCESS_KEY="1DXWofMPgzcjWYy2b7F9HYxWAXMNDVDroAWQBV5i7t3fn784Gay3ekM8TgZfFrGeHo6JanUuNA8ukS84jH5XzV1sY73v1HPWcBDQDUFtM8AbuVGjRHEhNQSWFHNWE8LTRvuW57XBLTyCy5w4ndR7ntkKBBxq4v4hPaX2K8jvFE8WwzTzu5c9wncd4LmKGUSjDBtZ3j4M4EWp81xgZjhpdkoLSpLxKSJQLxL63UL8SHF9xEoiH2knf87udwXjMzVxyLsngT2sSp8ZRCjgkupHSL1JisDJdE96bEbddECnAhUFhoHwUEcuA5RPRntn55HNoGEYkwZjerjR8wxKD2eNj7"
BASE_URL="https://link.eu1.storjshare.io/s"
BUCKET_PATH="recaptime-file-dumps/ajhalili2006/writefreely" # this is where we usually dump files for public access
VERSION=0.13.1
if command -v wget; then
wget "$BASE_URL/$ACCESS_KEY/$BUCKET_PATH/writefreely_$VERSION_linux_amd64.tar.gz?download=1" -O /tmp/writefreely-release.tar.gz
else
curl "$BASE_URL/$ACCESS_KEY/$BUCKET_PATH/writefreely_$VERSION_linux_amd64.tar.gz?download=1" -o /tmp/writefreely-release.tar.gz
fi
tar xzvf /tmp/writefreely-release.tar.gz -C /tmp
cp -rvu pages/ static/ templates/

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -xe
if [[ "$EUID" != "0"]]; then
echo "error: Run this script again as root to install the binary to /usr/local/bin!"
fi
# Public access key for the dumps, read-only
ACCESS_KEY="1DXWofMPgzcjWYy2b7F9HYxWAXMNDVDroAWQBV5i7t3fn784Gay3ekM8TgZfFrGeHo6JanUuNA8ukS84jH5XzV1sY73v1HPWcBDQDUFtM8AbuVGjRHEhNQSWFHNWE8LTRvuW57XBLTyCy5w4ndR7ntkKBBxq4v4hPaX2K8jvFE8WwzTzu5c9wncd4LmKGUSjDBtZ3j4M4EWp81xgZjhpdkoLSpLxKSJQLxL63UL8SHF9xEoiH2knf87udwXjMzVxyLsngT2sSp8ZRCjgkupHSL1JisDJdE96bEbddECnAhUFhoHwUEcuA5RPRntn55HNoGEYkwZjerjR8wxKD2eNj7"
BASE_URL="https://link.eu1.storjshare.io/s"
BUCKET_PATH="recaptime-file-dumps/ajhalili2006/writefreely"
VERSION=0.13.1
if command -v wget; then
wget "$BASE_URL/$ACCESS_KEY/$BUCKET_PATH/writefreely_$VERSION_linux_amd64.tar.gz?download=1" -O /tmp/writefreely-release.tar.gz
else
curl "$BASE_URL/$ACCESS_KEY/$BUCKET_PATH/writefreely_$VERSION_linux_amd64.tar.gz?download=1" -o /tmp/writefreely-release.tar.gz
fi
tar xzvf /tmp/writefreely-release.tar.gz -C /tmp
if test -f /usr/local/bin/writefreely;
rm /usr/local/bin/writefreely
fi
cp /tmp/writefreely/writefreely /usr/local/bin/writefreely
rm /tmp/writefreely -rv

16
systemd/caddy.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=Caddy webserver
Documentation=https://caddyserver.com/
After=network.target
[Service]
User=ajhalili2006
WorkingDirectory=/var/ajhalili2006/writefreely-ajhalili2006-prod
LimitNOFILE=4096
PIDFile=/var/run/caddy/caddy.pid
ExecStart=/usr/local/bin/caddy run --config ./Caddyfile --watch --pidfile=/var/run/caddy/caddy.pid
Restart=on-failure
StartLimitInterval=600
[Install]
WantedBy=multi-user.target