Okay, today I have good news : I could reproduce your problem, and may have a solution
“Come on, let’s get to work!” (What I did)
I fired up a brand new Ubuntu 18.06 Hetzner CX21 server, adjusted a spare domain records & PTR accordingly. Nothing fancy
Then followed carefully instructions here.
Interesting facts :
- the “develop” branch is the default for the ecloud-selfhosting GitLab project
- for this branch, user are instructed to add a “master” parameter to “bootstrap-generic” script (this is not advised in “master” branch instructions !). This very detail is important, I’ll write later about.
“Anyone home?” (What happened)
Everything went fine, until the “Nexcloud drop_account” step :
Script output while in postinstall.sh
Sat Jan 9 09:05:42 CET 2021: Waiting for Nextcloud to finish installation.............................................................................................................................................................................................................................................................................................................Nextcloud was successfully installed
Nextcloud is in maintenance mode - no apps have been loaded
All tables already up to date!
Nextcloud is in maintenance mode - no apps have been loaded
System config value trusted_domains => 0 set to string smu44.fr
Installing nextcloud plugins
Nextcloud is in maintenance mode - no apps have been loaded
calendar installed
calendar enabled
Nextcloud is in maintenance mode - no apps have been loaded
tasks installed
tasks enabled
Nextcloud is in maintenance mode - no apps have been loaded
notes installed
notes enabled
Nextcloud is in maintenance mode - no apps have been loaded
user_backend_sql_raw installed
user_backend_sql_raw enabled
Nextcloud is in maintenance mode - no apps have been loaded
rainloop installed
rainloop enabled
Nextcloud is in maintenance mode - no apps have been loaded
Config value rainloop-autologin for app rainloop set to 1
Cloning into 'volumes/nextcloud/custom_apps/drop_account'...
remote: Enumerating objects: 84, done.
remote: Counting objects: 100% (84/84), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 447 (delta 25), reused 82 (delta 23), pack-reused 363
Receiving objects: 100% (447/447), 276.03 KiB | 3.17 MiB/s, done.
Resolving deltas: 100% (190/190), done.
Nextcloud is in maintenance mode - no apps have been loaded
App "Array" cannot be installed because it is not compatible with this version of the server.
Wait ! It is not supposed to end like this ! Looking at the “postinstall.sh” script, they are many steps more, including some info that I didn’t see !
Something went bad, take a look at last line of output above.
“Oh my god, they killed Kenny!” (Why it happened)
Looking at “postinstall.sh”, we were somewhere between :
echo "Installing nextcloud plugins"
and
echo "Installing custom ecloud drop account plugin"
(which we never seen)
According to the script output, we can easily find that the guilty is the foreign FramaGit resource at https://framagit.org/tcit/drop_user.git
The “Array” Nexcloud app error is then generated by docker-compose exec -T --user www-data nextcloud php occ app:enable drop_account
, stopping the script run abruptly.
There are a lot of steps that have not been carried out, including mandatory postfix and MariaDB configuration !
What we are missing
docker-compose exec -T --user www-data nextcloud php occ maintenance:mode --off
echo "Restarting Nextcloud container"
docker-compose restart nextcloud
echo "Configuring Rainloop"
mkdir -p "/mnt/repo-base/volumes/nextcloud/data/rainloop-storage/_data_/_default_/domains/"
echo "$ADD_DOMAINS" | tr "," "\n" | while read add_domain; do
cp "templates/rainloop/domain-config.ini" "/mnt/repo-base/volumes/nextcloud/data/rainloop-storage/_data_/_default_/domains/$add_domain.ini"
done
chown www-data:www-data /mnt/repo-base/volumes/nextcloud/ -R
echo "Creating postfix database schema"
curl --silent -L https://mail.$DOMAIN/setup.php > /dev/null
echo "Adding Postfix admin superadmin account"
docker-compose exec -T postfixadmin /postfixadmin/scripts/postfixadmin-cli admin add $ALT_EMAIL --password $PFA_SUPERADMIN_PASSWORD --password2 $PFA_SUPERADMIN_PASSWORD --superadmin
# adding sudo to postfixadmin container
docker-compose exec -T postfixadmin apk add sudo
# giving pfexec user a specific sudo perm ONLY for launching the bind-mounted mailbox-postdeletion script
docker-compose exec -T postfixadmin bash -c 'echo "" >> /etc/sudoers && echo "#pfexec single command perm" >> /etc/sudoers && echo "pfexec ALL=(root) NOPASSWD: /usr/local/bin/postfixadmin-mailbox-postdeletion.sh" >> /etc/sudoers'
# Adding domains to postfix is done by docker exec instead of docker-compose exec on purpose. Reason: with compose the loop aborts after the first item for an unknown reason
echo "Adding domains to Postfix"
# The password_expiry parameter is only a workaround, and does not have any effect
# https://github.com/postfixadmin/postfixadmin/issues/280#issuecomment-511788887
echo "$ADD_DOMAINS" | tr "," "\n" | while read line; do docker exec -t postfixadmin /postfixadmin/scripts/postfixadmin-cli domain add $line --password_expiry 0; done
echo "Adding email accounts used by system senders (drive, ...)"
docker-compose exec -T postfixadmin /postfixadmin/scripts/postfixadmin-cli mailbox add drive@$DOMAIN --password $DRIVE_SMTP_PASSWORD --password2 $DRIVE_SMTP_PASSWORD --name "drive" --email-other $ALT_EMAIL
docker-compose exec -T postfixadmin /postfixadmin/scripts/postfixadmin-cli mailbox add $SMTP_FROM --password $SMTP_PW --password2 $SMTP_PW --name "welcome" --email-other $ALT_EMAIL
# display DKIM DNS setup info/instructions to the user
echo -e "\n\n\n"
echo -e "Please add the following records to your domain's DNS configuration:\n"
find /mnt/repo-base/volumes/mail/dkim/ -maxdepth 1 -mindepth 1 -type d | while read line; do DOMAIN=$(basename $line); echo " - DKIM record (TXT) for $DOMAIN:" && cat $line/public.key; done
echo "================================================================================================================================="
echo "================================================================================================================================="
echo "Your logins:"
bash scripts/show-info.sh
echo "================================================================================================================================="
echo "Your signup link:"
bash scripts/generate-signup-link.sh --user-email $ALT_EMAIL
echo "Please reboot the server now"
We can easily confirm the problem while attempting to re-launch the “postinstall” script :
root@tst1:/mnt/repo-base# /mnt/repo-base/scripts/postinstall.sh
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for ‘nc_OsAF’@‘%’
“Knowing where one’s towel is” (How to get by)
Digging into the ecloud-selfhosting GitLab project, I’ve found the
“auto-delete-account” branch, with a very interesting comment : “update of drop account url in post_install script as repo was moved by maintainer”.
That sounds very promising!
Let’s give it a try …
As we will use another branch, I recommend to start over with the whole installation.
I just rebuilt my server, but one can also use cleaning instructions in some previous post.
Then grabbed the bootstrap script with :
wget https://gitlab.e.foundation/e/infra/bootstrap/raw/master/bootstrap-generic.sh
and launched it with :
bash bootstrap-generic.sh https://gitlab.e.foundation/e/infra/ecloud-selfhosting auto-delete-account
Note the “auto-delete-account” parameter !
Sadly, It didn’t do the trick, same error
Seems that the git clone
didn’t get the right file ! It’s still the “old” one, without the change from “auto-delete-account” branch …
AND, after manually modifying the script, it didn’t work either
Okay, time to show our muscles !
After cleaning again, I launched again with “master” as parameter. At “Enter your mailserver (management) domain (e.g. domainA.com):
” prompt, I launched another shell and modified manually the /mnt/repo-base/scripts/postinstall.sh
, as is (note the “#” in front of 2 lines) :
…
docker-compose exec -T --user www-data nextcloud php /var/www/html/occ config:app:set rainloop rainloop-autologin --value 1
#git clone --single-branch https://framagit.org/tcit/drop_user.git volumes/nextcloud/custom_apps /drop_account
#docker-compose exec -T --user www-data nextcloud php occ app:enable drop_account
echo “Installing custom ecloud drop account plugin”
# Add WELCOME_SECRET from .env file as a system config value, to be used by our ecloud_drop_account plugin
…
Save, exit, resume run in other shell.
“Yeah baby, we got mojo back!”
After some , a reboot, I conducted some lite testings and can confirm everything’s ok !
What about the “auto delete” feature ? Well, I think we can live without on a self-hosted small server.
Anyway, I’ll open an issue in GitLab … later