summaryrefslogtreecommitdiffstats
path: root/plausible/plausible-deploy.sh
blob: ed3a4c5491855c163631fff3612abe1c8df22c13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

set -e

echo -e "This script will help you quickly deploy Plausible using Docker Compose\nAuthor: Dejavu Moe\nPost:https://dejavu.moe/posts/plausible-selfhosted-with-docker-complete-guide/"
read -p "Press Enter to continue..." enter

if [[ "$(command -v docker)" == "" && "$(command -v docker compose)" == "" ]]; then
  echo "Docker and the Docker Compose plugin are not installed on your machine, aborted!"
  exit 1
else
  echo "Start deployment process"
fi

echo "Plausible The relevant persistent data will be stored in $(pwd)/container/plausible/"

if [ -d container ]; then
    echo "The container folder already exists in the current directory, skip creating the folder"
else
    mkdir container
    echo "The container folder has been created"
fi

cd container
git init
git remote add origin https://git.xvo.es/self-hosted.git
git config --local core.sparsecheckout true
echo "plausible" >> .git/info/sparse-checkout
git pull --depth=1 origin master
cd plausible
echo "Downloading geonames.csv.database..."
wget https://s3.eu-central-1.wasabisys.com/plausible-application/geonames.csv -P GeoIP/
echo -e "The environment required for Plausible has been initialized\nPlease complete the environment variables\nAfterwards, use the following command in the current directory to complete the deployment\nsudo docker compose up -d\nPress any key to exit..."
read -n 1 -s -r -p ""
exit 0