Welcome to mirror list, hosted at ThFree Co, Russian Federation.

020nextcloud « nextcloud « docker « build - github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 62452c7407029ee33631b89f0ca6d2b8dc2ff5ab (plain)
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
#!/bin/bash

source /usr/local/etc/library.sh

set -e

[[ "$1" == "stop" ]] && {
  echo "stopping Cron..."
  killall cron
  echo "stopping Redis..."
  killall redis-server
  echo "stopping Postfix..."
  postfix stop
  echo "stopping HPB..."
  killall notify_push
  postfix stop
  echo "stopping logs..."
  killall tail
  exit 0
}

# we want to work in the volume version of the code
rm /var/www/nextcloud
ln -s /data/nextcloud /var/www/nextcloud

echo "Starting Redis"
sed -i 's|^requirepass .*|requirepass default|' /etc/redis/redis.conf
chown redis:redis /etc/redis/redis.conf
mkdir -p /var/run/redis
chown redis /var/run/redis
sudo -u redis redis-server /etc/redis/redis.conf

echo "Starting Cron"
cron

echo "Starting Postfix"
postfix start

# Better do real provisioning at the end, as it can restart PHP asynchronously
sed -i "s|'password'.*|'password' => 'default',|"        /data/nextcloud/config/config.php
sed -i "s|'dbpassword' =>.*|'dbpassword' => 'default',|" /data/nextcloud/config/config.php
echo -e "[client]\npassword=default" > /root/.my.cnf
chmod 600 /root/.my.cnf
DBPASSWD=default
DBADMIN=ncadmin
mysql <<EOF
GRANT USAGE ON *.* TO '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD';
DROP USER '$DBADMIN'@'localhost';
CREATE USER '$DBADMIN'@'localhost' IDENTIFIED BY '$DBPASSWD';
GRANT ALL PRIVILEGES ON nextcloud.* TO $DBADMIN@localhost;
FLUSH PRIVILEGES;
EXIT
EOF

echo "Provisioning"
bash /usr/local/bin/ncp-provisioning.sh

if needs_decrypt; then
  echo "Waiting for user to decrypt instance"
  while :; do
    sleep 1
    needs_decrypt || break
  done
fi

echo "Configuring Domain"
# Trusted Domain (local/public IP)
bash /usr/local/bin/nextcloud-domain.sh

# Trusted Domain (as an argument)
[[ -z "$2" ]] || {
  ncc config:system:set trusted_domains 6 --value="$2"
  ncc notify_push:self-test > /dev/null 2>&1 || ncc notify_push:setup "https://$2/push"
}

echo "Nextcloud version $(nc_version). NextCloudPi version $(cat /usr/local/etc/ncp-version)"

# Display NC logs in the docker logs
tail -f -n0 /data/nextcloud/data/nextcloud.log &

exit 0