-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
7 changed files
with
291 additions
and
59 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
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
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,3 @@ | ||
Various ways to deploy GoatCounter; see the subdirectories for details. | ||
|
||
- alpine – Set up an Alpine Linux machine. |
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,24 @@ | ||
This sets up a basic GoatCounter installation on Alpine Linux, using SQLite. | ||
|
||
This is also available as a ["StackScript" for Linode][s]; If you don't have a | ||
Linode account yet then [consider using my "referral URL"][r] and I'll get some | ||
cash back from Linode :-) | ||
|
||
It should be fine to run this more than once; and can be used to upgrade to a | ||
newer version. | ||
|
||
You can set the version to use with `GOATCOUNTER_VERSION`; this needs to be a | ||
release on GitHub: | ||
|
||
$ GOATCOUNTER_VERSION=v2.0.0 ./goatcounter-alpine.sh | ||
|
||
You can create additional sites with: | ||
|
||
$ cd /home/goatcounter | ||
$ ./bin/goatcounter db create site -domain example.com -email [email protected] | ||
|
||
Files are stored in `/home/goatcounter`; see `/var/log/goatcounter/current` for | ||
logs; and you can configure the flags in `/etc/conf.d/goatcounter` | ||
|
||
[s]: https://cloud.linode.com/stackscripts/659823 | ||
[r]: https://www.linode.com/?r=7acaf75737436d859e785dd5c9abe1ae99b4387e |
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 |
---|---|---|
|
@@ -2,38 +2,41 @@ | |
# <UDF name="goatcounter_domain" label="Domain you'll be hosting GoatCounter on" example="stats.example.com" /> | ||
# <UDF name="goatcounter_email" label="Your email address" example="[email protected]" /> | ||
# <UDF name="goatcounter_password" label="Password to access GoatCounter" example="Password 1234 :-)" /> | ||
# <UDF name="goatcounter_version" label="GoatCounter version" default="v1.4.1" /> | ||
# <UDF name="goatcounter_version" label="GoatCounter version" default="v2.0.0" /> | ||
# | ||
# This is a "StackScript" to deploy GoatCounter on a Linode VPS; it's available | ||
# in Linode as: https://cloud.linode.com/stackscripts/659823 | ||
# This will set up an Alpine Linux machine; environment variables: | ||
# GOATCOUNTER_DOMAIN Domain you'll be hosting GoatCounter on | ||
# GOATCOUNTER_EMAIL Your email address | ||
# GOATCOUNTER_PASSWORD Password to access GoatCounter | ||
# GOATCOUNTER_VERSION GoatCounter version (default: v2.0.0). | ||
# | ||
# This script should also work fine outside of Linode; it does assume you're | ||
# using Alpine Linux. | ||
# This is available as a "StackScript" to deploy GoatCounter on a Linode VPS: | ||
# https://cloud.linode.com/stackscripts/659823 | ||
# | ||
# If you don't have a Linode account yet then consider using my "referral URL" | ||
# and I'll get some cash back from Linode :-) | ||
# https://www.linode.com/?r=7acaf75737436d859e785dd5c9abe1ae99b4387e | ||
# | ||
# This script's source at the GoatCounter repo is: | ||
# https://github.com/zgoat/goatcounter/blob/master/deploy/StackScript | ||
# https://github.com/zgoat/goatcounter/blob/master/deploy/alpine | ||
# | ||
# It should be fine to run this more than once; and can be used to upgrade to a | ||
# newer version. | ||
# | ||
# You can create additional sites with: | ||
# Files are stored in /home/goatcounter; see /var/log/goatcounter for logs; and | ||
# you can configure the flags in /etc/conf.d/goatcounter. | ||
# | ||
# $ cd /home/goatcounter | ||
# $ ./bin/goatcounter db create site -domain example.com -email [email protected] | ||
# You can create additional sites with | ||
# | ||
# Files are stored in /home/goatcounter; see /var/log/goatcounter/current for | ||
# logs; and you can configure the flags it starts with in /etc/conf.d/goatcounter. | ||
# $ cd /home/goatcounter | ||
# $ ./bin/goatcounter db create site [..] | ||
# | ||
# Please report any bugs, problems, or other issues on the GoatCounter issue | ||
# tracker, or email me at [email protected] | ||
# | ||
|
||
# GoatCounter version to set up. | ||
v=${GOATCOUNTER_VERSION:-v1.4.1} | ||
v=${GOATCOUNTER_VERSION:-"v2.0.0"} | ||
|
||
|
||
set -eu | ||
|
@@ -60,7 +63,7 @@ apk add tzdata | |
grep -q '^goatcounter:' /etc/group || addgroup -S goatcounter | ||
grep -q '^goatcounter:' /etc/passwd || adduser -s /sbin/nologin -DS -G goatcounter goatcounter | ||
|
||
# Get latest version. | ||
# Get latest version if it doesn't exist yet. | ||
mkdir -p /home/goatcounter/bin | ||
dst="/home/goatcounter/bin/goatcounter-$v" | ||
if [ ! -f "$dst" ]; then | ||
|
@@ -74,7 +77,7 @@ ln -sf "$dst" "/home/goatcounter/bin/goatcounter" | |
|
||
# Set up site; this may fail if the site already exists, which is fine. | ||
cd /home/goatcounter | ||
./bin/goatcounter db create site -createdb -domain "$GOATCOUNTER_DOMAIN" -email "$GOATCOUNTER_EMAIL" -password "$GOATCOUNTER_PASSWORD" ||: | ||
./bin/goatcounter db create site -createdb -vhost "$GOATCOUNTER_DOMAIN" -user.email "$GOATCOUNTER_EMAIL" -user.password "$GOATCOUNTER_PASSWORD" ||: | ||
chown -R goatcounter:goatcounter db | ||
|
||
# Set up log directory. | ||
|
@@ -97,6 +100,11 @@ pidfile="/run/\${RC_SVCNAME}.pid" | |
output_log="/var/log/\${RC_SVCNAME}/current" | ||
error_log="/var/log/\${RC_SVCNAME}/current" | ||
start_pre() { | ||
# Make sure this is correct after updates etc. | ||
setcap 'cap_net_bind_service=+ep cap_sys_chroot=+ep' "\$(readlink "\$command")" | ||
} | ||
depend() { | ||
use net | ||
use dns | ||
|
@@ -105,15 +113,20 @@ depend() { | |
EOF | ||
|
||
cat << EOF > /etc/conf.d/goatcounter | ||
# These are the defaults. | ||
# The uncommented values are the defaults. | ||
# Listen on all addressed. | ||
# Listen on all addresses. | ||
#GOATCOUNTER_LISTEN=:443 | ||
# Location of SQLite3 database file or PostgreSQL connection. GoatCounter is | ||
# started from /home/goatcounter. | ||
#GOATCOUNTER_DB="sqlite://./db/goatcounter.sqlite3" | ||
# If you use PostgreSQL then URI-type connector is recommended, as OpenRC can't | ||
# deal well with spaces; for example: | ||
#GOATCOUNTER_DB="postgresql:///run/postgresql/goatcounter?sslmode=disable" | ||
# Other flags to add. See "goatcounter help serve". | ||
#GOATCOUNTER_ARGS="-automigrate" | ||
EOF | ||
|
Oops, something went wrong.