Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install apps via env var for initial setup #1259

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions 20.0/apache/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
if [ -n "${NEXTCLOUD_INSTALL_APPS+x}" ]; then
echo "Install apps…"
echo "$NEXTCLOUD_INSTALL_APPS" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr " " \\n | while read APP; do
run_as "php /var/www/html/occ app:install -n $APP"
done
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
6 changes: 6 additions & 0 deletions 20.0/fpm-alpine/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
if [ -n "${NEXTCLOUD_INSTALL_APPS+x}" ]; then
echo "Install apps…"
echo "$NEXTCLOUD_INSTALL_APPS" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr " " \\n | while read APP; do
run_as "php /var/www/html/occ app:install -n $APP"
done
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
6 changes: 6 additions & 0 deletions 20.0/fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
if [ -n "${NEXTCLOUD_INSTALL_APPS+x}" ]; then
echo "Install apps…"
echo "$NEXTCLOUD_INSTALL_APPS" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr " " \\n | while read APP; do
run_as "php /var/www/html/occ app:install -n $APP"
done
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ One or more trusted domains can be set through environment variable, too. They w

- `NEXTCLOUD_TRUSTED_DOMAINS` (not set by default) Optional space-separated list of domains

To install apps with the initial nextcloud installation, you can set a space separated list of apps.

- `NEXTCLOUD_INSTALL_APPS` (not set by default) Optional space-separated list of apps

The install and update script is only triggered when a default command is used (`apache-foreground` or `php-fpm`). If you use a custom command you have to enable the install / update with

- `NEXTCLOUD_UPDATE` (default: _0_)
Expand Down
6 changes: 6 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
NC_TRUSTED_DOMAIN_IDX=$(($NC_TRUSTED_DOMAIN_IDX+1))
done
fi
if [ -n "${NEXTCLOUD_INSTALL_APPS+x}" ]; then
echo "Install apps…"
echo "$NEXTCLOUD_INSTALL_APPS" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr " " \\n | while read APP; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks with multiple spaces. I guess a comma separated list would be much easier

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as i can see this only affects apps which have Space in their name... Does this really happen?

I'd be willing to contribute an implementation which parses a comma separated list, everything that needs to happen to get this PR in as soon as possible! 🚀 :)

Copy link

@AbcSxyZ AbcSxyZ Oct 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you consider PR #1260 ? Would be great to have a more flexible way to configure Nextcloud for the automatic installation.

At Nextcloud (you're working there ?), did you think about enabling all options for autoconfig.php ? Would it be possible to enable more configuration variables there ?

It would be a great thing to have a way to automate the entire installation !

Edit: See Synapse (matrix server) who deprecated env var for burden maintenance and support install only through passing config files.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AbcSxyZ I agree with you, custom script provided by Docker Config or Docker Volume will give more possibility like enabling encryption right after installation for example or even after upgrade process.

@J0WI any thoughts ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think I'll prefer #1260

run_as "php /var/www/html/occ app:install -n $APP"
done
fi
else
echo "running web-based installer on first connect!"
fi
Expand Down