Languages avaliable: pt-BR
You need to have, on your server, the installed docker. The installation can be done with an official script, following the following steps:
- Download the docker
curl -fsSL https://get.docker.com -o get-docker.sh- run the script
sh get-docker.sh- Give permissions to execute the Docker command to your user
sudo usermod -aG docker $USER- Remove the installation script
rm get-docker.shFollow the instructions of this repository:
https://github.com/LibreCodeCoop/nginx-proxy
Follow the instructions of this repository:
https://github.com/LibreCodeCoop/postgres-docker
Copy the .env.example to .env and set the values.
cp .env.example .env| Environment | service | Description |
|---|---|---|
VIRTUAL_HOST |
web |
Your domain |
LETSENCRYPT_HOST |
web |
Your domain |
LETSENCRYPT_EMAIL |
web |
Your sysadmin email |
NEXTCLOUD_TRUSTED_DOMAINS |
app |
domains separated by comma. The domain web is mandatory, add your domain together with whe domain web. The domain web is the domain of Nginx service. |
POSTGRES_DB |
db |
PostgreSQL database name (default: nextcloud) |
POSTGRES_USER |
db |
PostgreSQL database user (default: nextcloud) |
POSTGRES_PASSWORD |
db |
PostgreSQL database user password |
POSTGRES_HOST |
app |
PostgreSQL server host (default: postgres) |
NEXTCLOUD_ADMIN_USER |
app |
Nextcloud administrator username |
NEXTCLOUD_ADMIN_PASSWORD |
app |
Nextcloud administrator password |
NEXTCLOUD_ADMIN_EMAIL |
app |
Nextcloud administrator email |
SMTP_HOST |
app |
SMTP server for email sending |
SMTP_SECURE |
app |
SMTP security type (ssl, tls, or empty) |
SMTP_PORT |
app |
SMTP server port |
SMTP_AUTHTYPE |
app |
SMTP authentication type (LOGIN, PLAIN, NTLM) |
SMTP_NAME |
app |
Username for SMTP authentication |
SMTP_PASSWORD |
app |
Password for SMTP authentication |
MAIL_FROM_ADDRESS |
app |
Sender email address |
MAIL_DOMAIN |
app |
Sender email domain |
TZ |
app |
Timezone (e.g., America/Sao_Paulo) |
TRASHBIN_RETENTION_OBLIGATION |
app |
Number of days files should remain in the recycle bin before being cleaned. |
PS: Let's Encrypt only work in servers when the
VIRTUAL_HOSTandLETSENCRYPT_HOSThave a valid public domain registered in a DNS server. Don't try to use in localhost, don't work!
Create a network
docker network create reverse-proxy
docker network create postgresAfter finish the setup, access this url: https://yourdomain.tld/settings/admin/overview.
If is necessary run any occ command, run like this:
docker compose exec -u www-data app ./occ db:add-missing-indices
docker compose exec -u www-data app ./occ db:convert-filecache-bigintYou can do this using environments and creating a file called docker-compose.override.yml to add new services.
Use docker-compose-garages3.yml when you want Nextcloud to store files in a Garage S3 bucket instead of the local data/ directory.
The stack expects these values in .env:
GARAGES3_BUCKETGARAGES3_KEYGARAGES3_KEY_IDGARAGES3_SECRETGARAGES3_HOSTNAME, defaulting tohost.docker.internalGARAGES3_PORT, defaulting to3900GARAGES3_REGION, defaulting togarage
Create the bucket and access key in Garage before starting Nextcloud with this compose file. GARAGES3_KEY_ID must contain the Garage access key ID used by Nextcloud.
The Garage service uses garage/garage.toml. Update rpc_secret before using it in a real environment.
Use make up-garages3 to start Garage, and make bootstrap-garages3 to create the Garage bucket and access key.
The bootstrap updates .env in place with the generated Garage credentials.
Use make setup-garages3 to run the full setup and wait for Nextcloud to report as installed.
The stack now uses PostgreSQL 16. If you already created the database volume with an older PostgreSQL major version, recreate or migrate that volume once before starting the updated compose file.
For a clean local installation, use make reset-garages3.
Use make setup-garages3 if you want to keep the existing local state and only rerun the setup steps.
Basic flow:
- Copy
.env.exampleto.envif needed. - Update
garage/garage.tomland replace the placeholderrpc_secret. - Run
make setup-garages3. - Open the Nextcloud URL and finish the initial admin setup if it is still pending.
- Create your
.inifile atvolumes/php/folder. Example:volumes/php/xdebug.ini - Alter the file
docker-compose.override.ymladding your volume
services:
app:
volumes:
- ./volumes/php/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini- For PHP-FPM modifications, include the following volume to the app service in
docker-compose.override.ymlfile:
services:
app:
volumes:
- ./volumes/php/pm.conf:/usr/local/etc/php-fpm.d/www2.conf- Create a file
./volumes/php/pm.confwith the following content (see references for tunning according your setup):
[www]
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3- References:
- https://docs.nextcloud.com/server/21/admin_manual/installation/server_tuning.html#tune-php-fpm
- https://spot13.com/pmcalculator/
# The postgres service is executed separated to be possible reuse this service to other applications that use PostgreSQL
docker compose up -f docker-compose-postgres.yml -d
docker compose up -d
docker compose -dChange the value of NEXTCLOUD_VERSION at .env file and put the tag name that you want to use. Check the availables tags here: https://hub.docker.com/_/nextcloud/tags
Build the images, down the containers and get up again:
docker compose build --pull
docker compose up -dIf you want to see the logs, run:
docker compose logs -f --tail=100You will see this message in the logs and other many upgrade messages:
app_1 | 2020-04-28T19:49:38.568623133Z Initializing nextcloud 18.0.4.2 ...
app_1 | 2020-04-28T19:49:38.577733913Z Upgrading nextcloud from 18.0.3.0 ...
For setting up Nextcloud Talk with all services, see here.