forked from juliusknorr/nextcloud-docker-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·114 lines (89 loc) · 2.58 KB
/
bootstrap.sh
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
indent() {
sed 's/^/ /'
}
indent_cli() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -l 's/^/ > /'
else
sed -u 's/^/ > /'
fi
}
function install_app() {
(
echo "🌏 Fetching $1"
(git clone https://github.com/nextcloud/"$1".git workspace/server/apps-extra/"$1" 2>&1 | indent_cli &&
echo "✅ $1 installed") ||
echo "❌ Failed to install $1"
) | indent
}
function is_installed() {
(
if [ -x "$(command -v "$1")" ]; then
echo "✅ $1 is properly installed"
else
echo "❌ Install $1 before running this script"
exit 1
fi
) | indent
}
echo
echo "⏩ Performing system checks"
is_installed docker
is_installed docker-compose
is_installed git
(
(docker ps 2>&1 >/dev/null && echo "✅ Docker is properly executable") ||
(echo "❌ Cannot run docker ps, you might need to check that your user is able to use docker properly" && exit 1)
) | indent
echo
echo "⏩ Setting up folder structure and fetching repositories"
mkdir -p workspace/
(
(
echo "🌏 Fetching server (this might take a while to finish)" &&
git clone https://github.com/nextcloud/server.git workspace/server 2>&1 | indent_cli &&
cd workspace/server && git submodule update --init 2>&1 | indent_cli
) || echo "❌ Failed to clone Nextcloud server code"
) | indent
(
(
cd workspace/server && \
git worktree add ../stable19 stable19 2>&1 | indent_cli
) || echo "❌ Failed to setup worktree for stable19"
) | indent
mkdir -p workspace/server/apps-extra
install_app viewer
install_app recommendations
install_app files_pdfviewer
echo
echo
echo "⏩ Setup your environment in an .env file"
if [ ! -f ".env" ]; then
cat <<EOT >.env
COMPOSE_PROJECT_NAME=nextcloud
DOMAIN_SUFFIX=.local
REPO_PATH_SERVER=$PWD/workspace/server
ADDITIONAL_APPS_PATH=$PWD/workspace/server/apps-extra
NEXTCLOUD_AUTOINSTALL_APPS="viewer"
DOKER_SUBNET=192.168.21.0/24
PORTBASE=821
EOT
fi
cat <<EOF
╔═════════════════════════════════════════╗
║ oOo Ready to start developing 🎉 ║
╚═════════════════════════════════════════╝
🚀 Start the Nextcloud server by running
$ docker-compose up -d nextcloud
💤 Stop it with
$ docker-compose stop nextcloud
🗑 Fresh install and wipe all data
$ docker-compose down -v
For more details about the individual setup options see
the README.md file or checkout the repo at
https://github.com/juliushaertl/nextcloud-docker-dev
EOF