Compare commits

..

15 Commits

Author SHA1 Message Date
Baptiste Fotia 60f5cefc19 feat(sh):Create 2 environment variables
I create APPS and SERVER_GIT_WITH_ORGANIZATIO env var when we generate
the .env file.

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-11-08 15:38:57 +01:00
Baptiste Fotia aac7883609 build(sh): Fix shellchecl add source=/dev/null
Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-11-08 15:38:17 +01:00
Baptiste Fotia 71ff3f9ac0 fix(bash): Declare the source file for shellcheck
Please, read the doc : https://www.shellcheck.net/wiki/SC1091

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-11-08 11:40:22 +01:00
Baptiste Fotia 440daf474c fix(bash): Shellcheck compliant
I had an error with ShellCheck in the CI.

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-11-08 11:32:27 +01:00
Baptiste Fotia 7c56999606 chore(): Add the my-apps folder in the gitignore
Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-11-08 11:23:46 +01:00
Baptiste Fotia cc1d2021c3 feat(yaml,sh,env): Centralise the apps folder
This feature centralise the apps folder for the end user (dev).

We don't need to clone our apps for each nextcloud releases.

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-11-08 11:20:35 +01:00
Julius Härtl dad9f33359 Merge pull request #86 from juliushaertl/feature/update-default-php
Update the default release of PHP
2022-10-13 11:10:26 +02:00
Baptiste Fotia c11df7ec3b fix(yml):Adapting php release to stable NC version
I adapted the php release to stable NC versions.

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-10-13 11:02:09 +02:00
Baptiste Fotia 24e0fe8c6b feature(yml): Update the default release of PHP
I updated the default release of PHP to be compliant with the official
documentation admin :
https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html
.

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-10-13 10:24:51 +02:00
Julius Härtl 2cec861c04 Merge pull request #82 from eneiluj/enh/noid/harmonize-docker-compose
Add stable25 and harmonize stable* container configs
2022-10-06 09:21:57 +02:00
Julien Veyssier 360460d1dd add stable25 and harmonize stable*
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
2022-10-05 18:18:14 +02:00
Julius Härtl abfabbf9fa Merge pull request #83 from arawa/hotfix/redefine-env
refactor(Docker, Bash): Generic env vars
2022-10-05 09:28:29 +02:00
Baptiste Fotia f0615d4ada refactor(Docker, Bash): Generic env vars
I deleted all values related to Julius' home to make it as generic as
possible.
In addition, I changed the value of the COMPOSE_PROJECT_NAME env var to
target the master branch. Otherwise, we cannot join the development instance
with "http://nextcloud.local".

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
2022-10-04 15:17:03 +02:00
Julius Härtl ca6cd7ab47 Merge pull request #79 from sylvainmetayer/feat_35_add_phpunit 2022-10-03 11:52:28 +02:00
Sylvain 0a9394970a feat(35): add phpunit 2022-10-02 19:46:01 +02:00
31 changed files with 538 additions and 606 deletions
+1
View File
@@ -7,3 +7,4 @@ workspace/
.*
data/skeleton/
wip/
my-apps/
+300 -133
View File
@@ -1,172 +1,339 @@
# nextcloud-dev-docker-compose
Hi beginner developer ! 👋
Nextcloud development environment using docker-compose
This project allows you to start developing a Nextcloud app or contribute to Nextcloud server.
**DO NOT USE THIS IN PRODUCTION** Various settings in this setup are considered insecure and default passwords and secrets are used all over the place
This project is very **modular** where you can add [features](#different-feature-you-can-use).
So, you can use this project for your development environment only.
Features
**DO NOT USE THIS IN PRODUCTION** Various settings in this setup are considered insecure and default passwords and secrets are used all over the place.
- ☁ Nextcloud
- 🔒 Nginx proxy with SSL termination
- 💾 MySQL
- 💡 Redis
- 👥 LDAP with example user data
- ✉ Mailhog
- 🚀 Blackfire
- 📄 Collabora
If you don't know how to install Docker, please, read this tutorial by Daphne Muller: https://cloud.nextcloud.com/s/iyNGp8ryWxc7Efa
Be careful : Read the "README.md" of the tutorial written by Daphne Muller first.
## Getting started
## Getting started 🎮
To get the setup running:
First, get the setup running:
```bash
```
git clone https://github.com/juliushaertl/nextcloud-docker-dev
cd nextcloud-docker-dev
./bootstrap.sh
sudo sh -c "echo '127.0.0.1 nextcloud.local' >> /etc/hosts"
docker compose up nextcloud proxy
docker-compose up nextcloud proxy
```
Ok, let's go to understand these commands line !
## Manual setup
First, you download the project with the git command, then you move to the `nextcloud-docker-dev` folder.
### Nextcloud Code
The `bootstrap.sh` script check if all requirements are present and prepares your workspace.
You have the `./workspace` folder where there is the `server` folder, the Nextcloud's core and [other Nextcloud versions](docs/running-stable-versions.md) if you want (the stable21, stable22, stable23, and so on).
The Nextcloud code base needs to be available including the `3rdparty` submodule. To clone it from github run:
So, you if you want to contribute to the Nextcloud's core, you can work in this folder directly !
```
git clone https://github.com/nextcloud/server.git
cd server
git submodule update --init
pwd
```
The last command prints the path to the Nextcloud server directory.
Use it for setting the `REPO_PATH_SERVER` in the next step.
Then, you add `nextcloud.local` to your hosts file.
### Environment variables
Finally, the `docker compose up nextcloud proxy` command line. This command line runs the nextcloud, proxy, redis and mailhog containers.
A `.env` file should be created in the repository root, to keep configuration default on the dev setup:
Once here, you can read the [First connection](#first-connection) section after seeing this result in your terminal :
```
cp example.env .env
```
Replace `REPO_PATH_SERVER` with the path from above.
### Setting the PHP version to be used
The Nextcloud instance is setup to run with PHP 7.2 by default.
If you wish to use a different version of PHP, set the `PHP_VERSION` `.env` variable.
The variable supports the following values:
1. PHP 7.1: `71`
1. PHP 7.2: `72`
1. PHP 7.3: `73`
1. PHP 7.4: `74`
1. PHP 8.0: `80`
### Starting the containers
- Start full setup: `docker-compose up`
- Minimum: `docker-compose up proxy nextcloud` (nextcloud mysql redis mailhog)
### Running stable versions
The docker-compose file provides individual containers for stable Nextcloud releases. In order to run those you will need a checkout of the stable version server branch to your workspace directory. Using [git worktree](https://blog.juliushaertl.de/index.php/2018/01/24/how-to-checkout-multiple-git-branches-at-the-same-time/) makes it easy to have different branches checked out in parallel in separate directories.
Note that for performance reasons the server repository might have been cloned with --depth=1 by default. To get the full history it is highly recommended to run:
cd workspace/server
git fetch --unshallow
This may take some time depending on your internet connection speed.
```
cd workspace/server
git worktree add ../stable23 stable23
cd ../stable23
git submodule update --init
```
After adding the worktree you can start the stable container using `docker-compose up -d stable23`. You can then add stable23.local to your `/etc/hosts` file to access it.
Git worktrees can also be used to have a checkout of an apps stable brach within the server stable directory.
```
cd workspace/server/apps-extra/text
git worktree add ../../../stable23/apps-extra/text stable23
```
### Running into errors
If your setup isn't working and you can not figure out the reason why, running
`docker-compose down -v` will remove the relevant containers and volumes,
allowing you to run `docker-compose up` again from a clean slate.
## 🔒 Reverse Proxy
Used for SSL termination. To setup SSL support provide a proper DOMAIN_SUFFIX environment variable and put the certificates to ./data/ssl/ named by the domain name.
You might need to add the domains to your `/etc/hosts` file:
```
127.0.0.1 nextcloud.local
127.0.0.1 collabora.local
```
This is assuming you have set `DOMAIN_SUFFIX=.local`
You can generate it through:
```
awk -v D=.local '/- [A-z0-9]+\${DOMAIN_SUFFIX}/ {sub("\\$\{DOMAIN_SUFFIX\}", D " 127.0.0.1", $2); print $2}' docker-compose.yml
```
You can generate selfsigned certificates using:
```
cd data/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nextcloud.local.key -out nextcloud.local.crt
```
### dnsmasq to resolve wildcard domains
Instead of adding the individual container domains to `/etc/hosts` a local dns server like dnsmasq can be used to resolve any domain ending with the configured DOMAIN_SUFFIX in `.env` to localhost.
For dnsmasq adding the following configuration would be sufficient for `DOMAIN_SUFFIX=.local`:
```
address=/.local/127.0.0.1
```
### Use valid certificates trusted by your system
* Install mkcert https://github.com/FiloSottile/mkcert
* Go to `data/ssl`
* `mkcert nextcloud.local`
* `mv nextcloud.local-key.pem nextcloud.local.key`
* `mv nextcloud.local.pem nextcloud.local.crt`
* `docker-compose restart proxy`
## ✉ Mail
Sending/receiving mails can be tested with [mailhog](https://github.com/mailhog/MailHog) which is available on ports 1025 (SMTP).
To use the webui, add `127.0.0.1 mail.local` to your `/etc/hosts` and open [mail.local](http://mail.local).
## 🚀 Blackfire
Blackfire needs to use a hostname/ip that is resolvable from within the blackfire container. Their free version is [limited to local profiling](https://support.blackfire.io/troubleshooting/hack-edition-users-cannot-profile-non-local-http-applications) so we need to browse Nextcloud though its local docker IP or add the hostname to `/etc/hosts`.
### Using with curl
```
alias blackfire='docker-compose exec -e BLACKFIRE_CLIENT_ID=$BLACKFIRE_CLIENT_ID -e BLACKFIRE_CLIENT_TOKEN=$BLACKFIRE_CLIENT_TOKEN blackfire blackfire'
blackfire curl http://192.168.21.8/
```
## 👥 LDAP
The LDAP sample data is based on https://github.com/rroemhild/docker-test-openldap and extended with randomly generated users/groups. For details see [data/ldap-generator/](https://github.com/juliushaertl/nextcloud-docker-dev/tree/master/data/ldap-generator). LDAP will be configured automatically if the ldap container is available during installation.
Example users are: `leela fry bender zoidberg hermes professor`. The password is the same as the uid.
Useful commands:
```
docker-compose exec ldap ldapsearch -H 'ldap://localhost' -D "cn=admin,dc=planetexpress,dc=com" -w admin -b "dc=planetexpress,dc=com" "(&(objectclass=inetOrgPerson)(description=*use*))"
```
## Collabora
- Make sure to have the collabora hostname setup in your /etc/hosts file: `127.0.0.1 collabora.local`
- Automatically enable for one of your containers (e.g. the main nextcloud one):
- Run `./scripts/enable-collabora nextcloud`
- Manual setup
- Start the Collabora Online server in addition to your other containers `docker-compose up -d collabora`
- Make sure you have the richdocuments app cloned to your apps-extra directory and built the frontend code of the app with `npm ci && npm run build`
- Enable the app and configure `collabora.local` in the Collabora settings inside of Nextcloud
## ONLYOFFICE
- Make sure to have the collabora hostname setup in your /etc/hosts file: `127.0.0.1 onlyoffice.local`
- Automatically enable for one of your containers (e.g. the main nextcloud one):
- Run `./scripts/enable-onlyoffice nextcloud`
- Manual setup
- Start the ONLYOFFICE server in addition to your other containers `docker-compose up -d onlyoffice`
- Clone https://github.com/ONLYOFFICE/onlyoffice-nextcloud into your apps directory
- Enable the app and configure `onlyoffice.local` in the ONLYOFFICE settings inside of Nextcloud
## Antivirus
```bash
nextcloud-nextcloud-1 | The user "alice" was created successfully
nextcloud-nextcloud-1 | The user "user6" was created successfully
nextcloud-nextcloud-1 | The user "user1" was created successfully
nextcloud-nextcloud-1 | The user "nextcloud" was created successfully
nextcloud-nextcloud-1 | The user "user3" was created successfully
nextcloud-nextcloud-1 | The user "user5" was created successfully
nextcloud-nextcloud-1 | The user "jane" was created successfully
nextcloud-nextcloud-1 | The user "john" was created successfully
nextcloud-nextcloud-1 | The user "bob" was created successfully
nextcloud-nextcloud-1 | The user "user4" was created successfully
nextcloud-nextcloud-1 | The user "user2" was created successfully
docker-compose up -d proxy nextcloud av
```
This result means that all users are created and you can try to log in with the admin account or [other users](#which-user-accounts-can-i-use).
The clanav antivirus will then be exposed as a deamon with host `clam` and
port 3310.
If you want to stop the services, you should use `Ctrl+C`. But, the containers are always running or presents.
## SAML
Look at the status of your containers with `docker compose ps` :
```bahs
$ docker compose ps
NAME COMMAND SERVICE STATUS PORTS
nextcloud-database-mysql-1 "docker-entrypoint.s…" database-mysql running 0.0.0.0:8212->3306/tcp, :::8212->3306/tcp
nextcloud-mail-1 "MailHog" mail running 1025/tcp, 8025/tcp
nextcloud-nextcloud-1 "/usr/local/bin/boot…" nextcloud exited (0)
nextcloud-proxy-1 "/app/docker-entrypo…" proxy exited (2)
nextcloud-redis-1 "docker-entrypoint.s…" redis running 6379/tcp
```
docker-compose up -d proxy nextcloud saml
```
To down your containers, use the `docker compose down -v` command :
- uid mapping: `urn:oid:0.9.2342.19200300.100.1.1`
- idp entity id: `https://sso.local.dev.bitgrid.net/simplesaml/saml2/idp/metadata.php`
- single sign on service url: `https://sso.local.dev.bitgrid.net/simplesaml/saml2/idp/SSOService.php`
- single log out service url: `https://sso.local.dev.bitgrid.net/simplesaml/saml2/idp/SingleLogoutService.php`
- use certificate from docker/configs/var-simplesamlphp/cert/example.org.crt
```
-----BEGIN CERTIFICATE-----
MIICrDCCAhWgAwIBAgIUNtfnC2jE/rLdxHCs2th3WaYLryAwDQYJKoZIhvcNAQEL
BQAwaDELMAkGA1UEBhMCREUxCzAJBgNVBAgMAkJZMRIwEAYDVQQHDAlXdWVyemJ1
cmcxFDASBgNVBAoMC0V4YW1wbGUgb3JnMSIwIAYDVQQDDBlzc28ubG9jYWwuZGV2
LmJpdGdyaWQubmV0MB4XDTE5MDcwMzE0MjkzOFoXDTI5MDcwMjE0MjkzOFowaDEL
MAkGA1UEBhMCREUxCzAJBgNVBAgMAkJZMRIwEAYDVQQHDAlXdWVyemJ1cmcxFDAS
BgNVBAoMC0V4YW1wbGUgb3JnMSIwIAYDVQQDDBlzc28ubG9jYWwuZGV2LmJpdGdy
aWQubmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHPZwU+dAc76yB6bOq
0AkP1y9g7aAi1vRtJ9GD4AEAsA3zjW1P60BYs92mvZwNWK6NxlJYw51xPak9QMk5
qRHaTdBkmq0a2mWYqh1AZNNgCII6/VnLcbEIgyoXB0CCfY+2vaavAmFsRwOMdeR9
HmtQQPlbTA4m5Y8jWGVs1qPtDQIDAQABo1MwUTAdBgNVHQ4EFgQUeZSoGKeN5uu5
K+n98o3wcitFYJ0wHwYDVR0jBBgwFoAUeZSoGKeN5uu5K+n98o3wcitFYJ0wDwYD
VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOBgQA25X/Ke+5dw7up8gcF2BNQ
ggBcJs+SVKBmPwRcPQ8plgX4D/K8JJNT13HNlxTGDmb9elXEkzSjdJ+6Oa8n3IMe
vUUejXDXUBvlmmm+ImJVwwCn27cSfIYb/RoZPeKtned4SCzpbEO9H/75z3XSqAZS
Z1tiHzYOVtEs4UNGOtz1Jg==
-----END CERTIFICATE-----
```
- cn `urn:oid:2.5.4.3`
- email `urn:oid:0.9.2342.19200300.100.1.3`
### Environment based SSO
A simple approach to test environment based SSO with the user_saml app is to use apache basic auth with the following configuration:
```
<Location /login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
<Location /index.php/login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
<Location /index.php/apps/user_saml/saml/login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
<Location /apps/user_saml/saml/login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
```
## Fulltextsearch
```
docker-compose up -d elasticsearch elasticsearch-ui
```
- Address for configuring in Nextcloud: `http://elastic:elastic@elasticsearch:9200`
- Adress to access elastic search from outside: `http://elastic:elastic@elasticsearch.local`
- Address for accessing the ui: http://elasticsearch-ui.local/
`sudo sysctl -w vm.max_map_count=262144`
## Object storage
Primary object storage can be enabled by setting the `PRIMARY=minio` environment variable either in your .env file or in docker-compose.yml for individual containers.
```bash
foo@bar:~/Documents/codes/nextcloud-docker-dev$ docker compose down -v
[+] Running 16/5
⠿ Container nextcloud-nextcloud-1 Removed 0.0s
⠿ Container nextcloud-proxy-1 Removed 0.0s
⠿ Container nextcloud-mail-1 Removed 0.6s
#...
foo@bar:~/Documents/codes/nextcloud-docker-dev$
```
Once you understand the mechanisms, you could run your containers in the background with the `-d` flag.
```bash
foo@bar:~/Documents/codes/nextcloud-docker-dev$ docker compose up -d proxy nextcloud
[+] Running 12/1
⠿ Network nextcloud_default Created 0.2s
⠿ Volume "nextcloud_postgres" Created 0.0s
⠿ Volume "nextcloud_mysql" Created 0.0s
⠿ Volume "nextcloud_smb" Created 0.0s
⠿ Volume "nextcloud_clam" Created 0.0s
⠿ Volume "nextcloud_document_data" Created 0.0s
#...
foo@bar:~/Documents/codes/nextcloud-docker-dev$
docker-compose up proxy nextcloud minio
```
The difference with the `-d` flag is you can use your currently prompt after run the `docker compose` command.
## Development
## First connection
### OCC
After running the `docker compose up nextcloud proxy` command, you have to wait a few minutes before trying to connect to your development instance.
Run inside of the Nextcloud container:
```
set XDEBUG_CONFIG=idekey=PHPSTORM
sudo -E -u www-data php -dxdebug.remote_host=192.168.21.1 occ
```
In fact, you will see that the `nextcloud` and `proxy` containers initialize your Nextcloud, create user accounts, and so on. Step by step.
### Useful commands
Then, once these steps are completed, you can connect to your development instance. You must enter `http://nextcloud.local` in your address bar!
- Restart apache to reload php configuration without a full container restart: `docker-compose kill -s USR1 nextcloud`
- Access to mysql console: `mysql -h $(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nextcloud_database-mysql_1) -P 3306 -u nextcloud -pnextcloud`
- Run an LDAP search: `ldapsearch -x -H ldap://$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nextcloud_ldap_1) -D "cn=admin,dc=planetexpress,dc=com" -w admin -b "dc=planetexpress,dc=com" -s subtree <filter> <attrs>`
In fact, with the `proxy` container you don't need to specify the port number and you can't use `http://localhost` or `http://127.0.0.1`. Just, you have to use this address : `http://nextcloud.local`.
## Keycloak
- Keycloak is using ldap as a user backend (make sure the ldap container is also running)
- `occ user_oidc:provider Keycloak -c nextcloud -s 09e3c268-d8bc-42f1-b7c6-74d307ef5fde -d https://keycloak.local.dev.bitgrid.net/auth/realms/Example/.well-known/openid-configuration`
- https://keycloak.local.dev.bitgrid.net/auth/realms/Example/.well-known/openid-configuration
- nextcloud
- 09e3c268-d8bc-42f1-b7c6-74d307ef5fde
## Global scale
```
docker-compose up -d proxy portal gs1 gs2 lookup database-mysql
```
Users are named the same as the instance name, e.g. gs1, gs2
## Imaginary
Enable the imaginary server for generating previews
```bash
docker-compose up proxy nextcloud previews_hpb
./scripts/enable-preview-imaginary.sh
```
### Which user accounts can I use ?
Here is a list of user accounts you can use :
| uid | password |
|:---:|:---:|
| admin | admin |
| user1 | user1 |
| user2 | user2 |
| user3 | user3 |
| user4 | user4 |
| user5 | user5 |
| user6 | user6 |
| nextcloud | nextcloud |
| alice | alice |
| bob | bob |
| jane | jane |
| john | john |
## Where can I add my app for development ?
Once you have ran the Nextcloud's server with `docker compose`. You can clone your app in this folder : `./workspace/server/apps-extra/`.
Of course, you should adapt to the nextcloud release you are using (server, stable23, stable24, and so on.).
If you have not yet generated an app, you can do so from this web page : [https://apps.nextcloud.com/developer/apps/generate](https://apps.nextcloud.com/developer/apps/generate).
## Going further
If you want to go further, you can add new features or customize your development environment by following this documentation : [Configure my environment](docs/manual-setup.md#copy-environment-variables).
If you use **XDEBUG** to debug your PHP code. Please, read the [Set Up Xdebug](docs/setup-xdebug.md) documentation.
If you want to set up the Nextcloud's core, please, read the [Manual setup](docs/manual-setup.md) documentation.
If you aren't comfortable with Docker or other tools from the various containers (ldap, mysql, and so on.). You can read the [Useful commands](docs/useful-commands.md) file with some tips.
If you encounter any problems, please, look at this documentation : [Troubleshooting](docs/troubleshooting.md).
### Different feature you can use
These are features where you can use :
- ☁ Nextcloud
- 🔒 [Nginx proxy with SSL termination](docs/containers/ssl.md)
- 💾 [MySQL](docs/containers/mysql.md)
- 💡 Redis
- 👥 [LDAP with example user data](docs/containers/ldap.md)
- ✉ [Mailhog](docs/containers/mail.md)
- 🚀 [Blackfire](docs/containers/blackfire.md)
- 📄 [Collabora](docs/containers/collabora.md)
- 📄 [Only Office](docs/containers/onlyoffice.md)
- 👥 [SAML](docs/containers/saml.md)
- 🔍 [Full Text Search](docs/containers/fulltextsearch.md)
- 🪣 [Object Storage](docs/containers/objectstorage.md)
- 💉 [Antivirus](docs/containers/antivirus.md)
- 🔑 [Keycloak](docs/containers/keycloak.md)
- [Global Scale](docs/containers/globalscale.md)
- [Imaginary](docs/containers/imaginary.md)
+30 -11
View File
@@ -19,12 +19,27 @@ indent_cli() {
function install_app() {
(
echo "🌏 Fetching $1"
(git clone https://github.com/nextcloud/"$1".git workspace/server/apps-extra/"$1" 2>&1 | indent_cli &&
(git clone "$SERVER_GIT_WITH_ORGANIZATION/$1".git "$PWD/my-apps/$1" 2>&1 | indent_cli &&
echo "$1 installed") ||
echo "❌ Failed to install $1"
) | indent
}
function install_apps() {
if (( ${#APPS[@]} != 0 )); then
if test -z "$SERVER_GIT_WITH_ORGANIZATION"; then
echo "❌ You didn't define the $SERVER_GIT_WITH_ORGANIZATION variable."
exit 10
fi
echo "⏩ Clonning of applications in progress"
for app in "${APPS[@]}"; do
install_app "$app"
done
else
echo "⚠️ You don't have apps to clone."
fi
}
function is_installed() {
(
if [ -x "$(command -v "$1")" ]; then
@@ -40,6 +55,7 @@ echo
echo "⏩ Performing system checks"
is_installed docker
is_installed docker-compose
is_installed git
(
@@ -66,28 +82,31 @@ mkdir -p workspace/
# ) || echo "❌ Failed to setup worktree for stable19"
#) | indent
mkdir -p workspace/server/apps-extra
install_app viewer
install_app recommendations
install_app files_pdfviewer
install_app profiler
mkdir -p ./my-apps
echo
echo
echo "⏩ Setup your environment in an .env file"
if [ ! -f ".env" ]; then
cat <<EOT >.env
COMPOSE_PROJECT_NAME=nextcloud
COMPOSE_PROJECT_NAME=master
DOMAIN_SUFFIX=.local
REPO_PATH_SERVER=$PWD/workspace/server
ADDITIONAL_APPS_PATH=$PWD/workspace/server/apps-extra
ADDITIONAL_APPS_PATH=$PWD/my-apps
STABLE_ROOT_PATH=$PWD/workspace
NEXTCLOUD_AUTOINSTALL_APPS="viewer profiler"
DOCKER_SUBNET=192.168.21.0/24
PORTBASE=821
APPS=()
SERVER_GIT_WITH_ORGANIZATION=""
EOT
fi
# shellcheck source=/dev/null
source .env
install_apps
if [[ $(uname -m) == 'arm64' ]]; then
echo "Setting custom containers for arm platform"
@@ -104,17 +123,17 @@ cat <<EOF
🚀 Start the Nextcloud server by running
$ docker compose up -d nextcloud
$ docker-compose up -d nextcloud
💤 Stop it with
$ docker compose stop nextcloud
$ docker-compose stop nextcloud
🗑 Fresh install and wipe all data
$ docker compose down -v
$ docker-compose down -v
Note that for performance reasons the server repository has been cloned with
+153 -75
View File
@@ -34,6 +34,7 @@ services:
- stable22${DOMAIN_SUFFIX}
- stable23${DOMAIN_SUFFIX}
- stable24${DOMAIN_SUFFIX}
- stable25${DOMAIN_SUFFIX}
- collabora${DOMAIN_SUFFIX}
- onlyoffice${DOMAIN_SUFFIX}
- proxy${DOMAIN_SUFFIX}
@@ -57,7 +58,7 @@ services:
- ./docker/configs/haproxy.conf:/usr/local/etc/haproxy/haproxy.cfg:ro
nextcloud:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
@@ -69,10 +70,10 @@ services:
BLACKFIRE_CLIENT_ID:
BLACKFIRE_CLIENT_TOKEN:
volumes:
- '${REPO_PATH_SERVER:-/home/jus/repos/nextcloud/server}:/var/www/html'
- '${REPO_PATH_SERVER}:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- data:/var/www/html/data
- config:/var/www/html/config
- '${ADDITIONAL_APPS_PATH:-./data/apps-extra}:/var/www/html/apps-extra'
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
@@ -87,13 +88,13 @@ services:
- host.docker.internal:host-gateway
nextcloud2:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
SQL: 'mysql'
VIRTUAL_HOST: "nextcloud2${DOMAIN_SUFFIX}"
volumes:
- '${REPO_PATH_SERVER:-/home/jus/repos/nextcloud/server}:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./data/apps-extra}:/var/www/html/apps-extra'
- '${REPO_PATH_SERVER}:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
ports:
@@ -106,13 +107,13 @@ services:
- host.docker.internal:host-gateway
nextcloud3:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
SQL: 'mysql'
SQL: ${SQL:-mysql}
VIRTUAL_HOST: "nextcloud3${DOMAIN_SUFFIX}"
volumes:
- '${REPO_PATH_SERVER:-/home/jus/repos/nextcloud/server}:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./data/apps-extra}:/var/www/html/apps-extra'
- '${REPO_PATH_SERVER}:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- ./data/skeleton/:/skeleton
- ./docker/configs/config.php:/var/www/html/config/writable.config.php:ro
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
@@ -124,9 +125,9 @@ services:
- host.docker.internal:host-gateway
stable16:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-72}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -134,23 +135,27 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable16:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable16/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable16:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable17:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-72}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -158,23 +163,27 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable17:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable17/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable17:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable18:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -182,25 +191,27 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable18:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable18/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable18:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable19:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-72}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -208,20 +219,27 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable19:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable19/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable19:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable20:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-72}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -229,20 +247,27 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable20:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable20/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable20:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable21:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-80}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -250,20 +275,27 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable21:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable21/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable21:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable22:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-80}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -271,46 +303,27 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable22:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable22/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable22:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable24:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
environment:
SQL: 'mysql'
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
VIRTUAL_HOST: stable24${DOMAIN_SUFFIX}
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable24:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable24/apps-extra:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable23:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-73}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-80}:latest
environment:
SQL: 'sqlite'
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
@@ -318,10 +331,74 @@ services:
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable23:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/stable23/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/stable23:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable24:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-80}:latest
environment:
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
VIRTUAL_HOST: stable24${DOMAIN_SUFFIX}
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH}/stable24:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
- host.docker.internal:host-gateway
stable25:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
VIRTUAL_HOST: stable25${DOMAIN_SUFFIX}
ADDITIONAL_APPS_PATH:
NEXTCLOUD_TRUSTED_DOMAINS:
volumes:
- '${STABLE_ROOT_PATH}/stable25:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- /var/www/html/apps-writable
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
ports:
- "${PORTBASE:-800}0:80"
depends_on:
- ${DB_SERVICE:-database-mysql}
- redis
- mail
extra_hosts:
@@ -443,6 +520,7 @@ services:
aliasgroup6: http://stable22${DOMAIN_SUFFIX}
aliasgroup7: http://stable23${DOMAIN_SUFFIX}
aliasgroup8: http://stable24${DOMAIN_SUFFIX}
aliasgroup9: http://stable25${DOMAIN_SUFFIX}
dictionaries: de_DE en_US en_GB
username: admin
password: admin
@@ -541,14 +619,14 @@ services:
- clam:/var/lib/clamav
portal:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
VIRTUAL_HOST: portal${DOMAIN_SUFFIX}
SQL: 'mysql'
GS_MODE: master
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/server:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/server/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/server:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- ./data/skeleton/:/skeleton
@@ -563,14 +641,14 @@ services:
- host.docker.internal:host-gateway
gs1:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
VIRTUAL_HOST: gs1${DOMAIN_SUFFIX}
SQL: 'mysql'
GS_MODE: slave
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/server:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/server/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/server:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- ./data/skeleton/:/skeleton
@@ -586,14 +664,14 @@ services:
- host.docker.internal:host-gateway
gs2:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-74}:latest
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
VIRTUAL_HOST: gs2${DOMAIN_SUFFIX}
SQL: 'mysql'
GS_MODE: slave
volumes:
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/server:/var/www/html'
- '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/server/apps-extra:/var/www/html/apps-extra'
- '${STABLE_ROOT_PATH}/server:/var/www/html'
- '${ADDITIONAL_APPS_PATH:-./my-apps}:/var/www/html/apps-extra'
- /var/www/html/data
- /var/www/html/config
- ./data/skeleton/:/skeleton
@@ -613,7 +691,7 @@ services:
environment:
VIRTUAL_HOST: "lookup${DOMAIN_SUFFIX}"
# volumes:
# - '${STABLE_ROOT_PATH:-/home/jus/repos/nextcloud}/lookupserver:/var/www/html'
# - '${STABLE_ROOT_PATH}/lookupserver:/var/www/html'
extra_hosts:
- host.docker.internal:host-gateway
+6 -1
View File
@@ -49,11 +49,16 @@ RUN pecl install APCu; \
docker-php-source delete && \
rm -r /tmp/* /var/cache/*
# dev tools separate install so we quickly change without rebuilding all php extenions
# dev tools separate install so we quickly change without rebuilding all php extensions
RUN apt update && apt-get install -y --no-install-recommends \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
RUN cd /tmp && curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar && \
chmod +x phpunit.phar && \
mv /tmp/phpunit.phar /usr/local/bin/phpunit
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
+6 -1
View File
@@ -49,11 +49,16 @@ RUN pecl install APCu; \
docker-php-source delete && \
rm -r /tmp/* /var/cache/*
# dev tools separate install so we quickly change without rebuilding all php extenions
# dev tools separate install so we quickly change without rebuilding all php extensions
RUN apt update && apt-get install -y --no-install-recommends \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
RUN cd /tmp && curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar && \
chmod +x phpunit.phar && \
mv /tmp/phpunit.phar /usr/local/bin/phpunit
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
+6 -1
View File
@@ -49,11 +49,16 @@ RUN pecl install APCu; \
docker-php-source delete && \
rm -r /tmp/* /var/cache/*
# dev tools separate install so we quickly change without rebuilding all php extenions
# dev tools separate install so we quickly change without rebuilding all php extensions
RUN apt update && apt-get install -y --no-install-recommends \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
RUN cd /tmp && curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar && \
chmod +x phpunit.phar && \
mv /tmp/phpunit.phar /usr/local/bin/phpunit
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
+6 -1
View File
@@ -49,11 +49,16 @@ RUN pecl install APCu; \
docker-php-source delete && \
rm -r /tmp/* /var/cache/*
# dev tools separate install so we quickly change without rebuilding all php extenions
# dev tools separate install so we quickly change without rebuilding all php extensions
RUN apt update && apt-get install -y --no-install-recommends \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
RUN cd /tmp && curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar && \
chmod +x phpunit.phar && \
mv /tmp/phpunit.phar /usr/local/bin/phpunit
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
+6 -1
View File
@@ -49,11 +49,16 @@ RUN pecl install APCu; \
docker-php-source delete && \
rm -r /tmp/* /var/cache/*
# dev tools separate install so we quickly change without rebuilding all php extenions
# dev tools separate install so we quickly change without rebuilding all php extensions
RUN apt update && apt-get install -y --no-install-recommends \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
RUN cd /tmp && curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar && \
chmod +x phpunit.phar && \
mv /tmp/phpunit.phar /usr/local/bin/phpunit
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
+6 -1
View File
@@ -49,11 +49,16 @@ RUN pecl install APCu; \
docker-php-source delete && \
rm -r /tmp/* /var/cache/*
# dev tools separate install so we quickly change without rebuilding all php extenions
# dev tools separate install so we quickly change without rebuilding all php extensions
RUN apt update && apt-get install -y --no-install-recommends \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
RUN cd /tmp && curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar && \
chmod +x phpunit.phar && \
mv /tmp/phpunit.phar /usr/local/bin/phpunit
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
+6 -1
View File
@@ -49,11 +49,16 @@ RUN pecl install APCu; \
docker-php-source delete && \
rm -r /tmp/* /var/cache/*
# dev tools separate install so we quickly change without rebuilding all php extenions
# dev tools separate install so we quickly change without rebuilding all php extensions
RUN apt update && apt-get install -y --no-install-recommends \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
RUN cd /tmp && curl -L https://phar.phpunit.de/phpunit.phar > phpunit.phar && \
chmod +x phpunit.phar && \
mv /tmp/phpunit.phar /usr/local/bin/phpunit
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
-8
View File
@@ -1,8 +0,0 @@
# Antivirus
```bash
docker compose up -d proxy nextcloud av
```
The clanav antivirus will then be exposed as a deamon with host `clam` and
port 3310.
-10
View File
@@ -1,10 +0,0 @@
# 🚀 Blackfire
Blackfire needs to use a hostname/ip that is resolvable from within the blackfire container. Their free version is [limited to local profiling](https://support.blackfire.io/troubleshooting/hack-edition-users-cannot-profile-non-local-http-applications) so we need to browse Nextcloud though its local docker IP or add the hostname to `/etc/hosts`.
## Using with curl
```
alias blackfire='docker compose exec -e BLACKFIRE_CLIENT_ID=$BLACKFIRE_CLIENT_ID -e BLACKFIRE_CLIENT_TOKEN=$BLACKFIRE_CLIENT_TOKEN blackfire blackfire'
blackfire curl http://192.168.21.8/
```
-9
View File
@@ -1,9 +0,0 @@
# Collabora
- Make sure to have the collabora hostname setup in your /etc/hosts file: `127.0.0.1 collabora.local`
- Automatically enable for one of your containers (e.g. the main nextcloud one):
- Run `./scripts/enable-collabora nextcloud`
- Manual setup
- Start the Collabora Online server in addition to your other containers `docker compose up -d collabora`
- Make sure you have the richdocuments app cloned to your apps-extra directory and built the frontend code of the app with `npm ci && npm run build`
- Enable the app and configure `collabora.local` in the Collabora settings inside of Nextcloud
-19
View File
@@ -1,19 +0,0 @@
# Full Text Search
To use Full Text Search, follow these commands :
```bash
docker compose down -v
docker compose up nextcloud proxy elasticsearch elasticsearch-ui
```
You can add another services from `docker-compose.yaml` if you want.
- Address for configuring in Nextcloud: `http://elastic:elastic@elasticsearch:9200`
- Adress to access elastic search from outside: `http://elastic:elastic@elasticsearch.local`
- Address for accessing the ui: http://elasticsearch-ui.local/
```bash
sudo sysctl -w vm.max_map_count=262144
```
-7
View File
@@ -1,7 +0,0 @@
## Global scale
```bash
docker compose up -d proxy portal gs1 gs2 lookup database-mysql
```
Users are named the same as the instance name, e.g. gs1, gs2
-8
View File
@@ -1,8 +0,0 @@
# Imaginary
Enable the imaginary server for generating previews
```bash
docker composer up proxy nextcloud previews_hpb
./scripts/enable-preview-imaginary.sh
```
-7
View File
@@ -1,7 +0,0 @@
# Keycloak
- Keycloak is using ldap as a user backend (make sure the ldap container is also running)
- `occ user_oidc:provider Keycloak -c nextcloud -s 09e3c268-d8bc-42f1-b7c6-74d307ef5fde -d https://keycloak.local.dev.bitgrid.net/auth/realms/Example/.well-known/openid-configuration`
- https://keycloak.local.dev.bitgrid.net/auth/realms/Example/.well-known/openid-configuration
- nextcloud
- 09e3c268-d8bc-42f1-b7c6-74d307ef5fde
-29
View File
@@ -1,29 +0,0 @@
# 👥 LDAP
The LDAP sample data is based on https://github.com/rroemhild/docker-test-openldap and extended with randomly generated users/groups. For details see [data/ldap-generator/](https://github.com/juliushaertl/nextcloud-docker-dev/tree/master/data/ldap-generator). LDAP will be configured automatically if the ldap container is available during installation.
|uid (login) | password |
|---|---|
| leela | leela |
| fry | fry |
| zoidberg | zoidberg |
| hermes | hermes |
| professor | professor |
| ... | ... |
To add LDAP in your dev environment use these commands :
```bash
docker compose down -v
docker compose up nextcloud proxy ldap
```
You can add another services from `docker-compose.yaml` if you want.
Useful commands to know all LDAP's objects :
```
docker compose exec ldap ldapsearch -H 'ldap://localhost' -D "cn=admin,dc=planetexpress,dc=com" -w admin -b "dc=planetexpress,dc=com" "(&(objectclass=inetOrgPerson)(description=*use*))"
```
-5
View File
@@ -1,5 +0,0 @@
# ✉ Mail
Sending/receiving mails can be tested with [mailhog](https://github.com/mailhog/MailHog) which is available on ports 1025 (SMTP).
To use the webui, add `127.0.0.1 mail.local` to your `/etc/hosts` and open [mail.local](http://mail.local).
-25
View File
@@ -1,25 +0,0 @@
# Mysql
This is information about the mysql service :
- user root : `root`
- password root : `nextcloud`
- user : `nextcloud`
- password : `nextcloud`
- database name : `nextcloud`
## How to connect on the mysql service ?
You can run this command to be in the mysql prompt as no root :
```bash
docker compose exec database-mysql mysql -unextcloud -pnextcloud
```
If you want to be as root, use this command :
```bash
docker compose exec database-mysql mysql -uroot -pnextcloud
```
-7
View File
@@ -1,7 +0,0 @@
# Object storage
Primary object storage can be enabled by setting the `PRIMARY=minio` environment variable either in your .env file or in docker-compose.yml for individual containers.
```bash
docker composer up proxy nextcloud minio
```
-9
View File
@@ -1,9 +0,0 @@
# ONLYOFFICE
- Make sure to have the collabora hostname setup in your /etc/hosts file: `127.0.0.1 onlyoffice.local`
- Automatically enable for one of your containers (e.g. the main nextcloud one):
- Run `./scripts/enable-onlyoffice nextcloud`
- Manual setup
- Start the ONLYOFFICE server in addition to your other containers `docker compose up -d onlyoffice`
- Clone https://github.com/ONLYOFFICE/onlyoffice-nextcloud into your apps directory
- Enable the app and configure `onlyoffice.local` in the ONLYOFFICE settings inside of Nextcloud
-65
View File
@@ -1,65 +0,0 @@
# SAML
```bash
docker compose up -d proxy nextcloud saml
```
- uid mapping: `urn:oid:0.9.2342.19200300.100.1.1`
- idp entity id: `https://sso.local.dev.bitgrid.net/simplesaml/saml2/idp/metadata.php`
- single sign on service url: `https://sso.local.dev.bitgrid.net/simplesaml/saml2/idp/SSOService.php`
- single log out service url: `https://sso.local.dev.bitgrid.net/simplesaml/saml2/idp/SingleLogoutService.php`
- use certificate from docker/configs/var-simplesamlphp/cert/example.org.crt
```
-----BEGIN CERTIFICATE-----
MIICrDCCAhWgAwIBAgIUNtfnC2jE/rLdxHCs2th3WaYLryAwDQYJKoZIhvcNAQEL
BQAwaDELMAkGA1UEBhMCREUxCzAJBgNVBAgMAkJZMRIwEAYDVQQHDAlXdWVyemJ1
cmcxFDASBgNVBAoMC0V4YW1wbGUgb3JnMSIwIAYDVQQDDBlzc28ubG9jYWwuZGV2
LmJpdGdyaWQubmV0MB4XDTE5MDcwMzE0MjkzOFoXDTI5MDcwMjE0MjkzOFowaDEL
MAkGA1UEBhMCREUxCzAJBgNVBAgMAkJZMRIwEAYDVQQHDAlXdWVyemJ1cmcxFDAS
BgNVBAoMC0V4YW1wbGUgb3JnMSIwIAYDVQQDDBlzc28ubG9jYWwuZGV2LmJpdGdy
aWQubmV0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHPZwU+dAc76yB6bOq
0AkP1y9g7aAi1vRtJ9GD4AEAsA3zjW1P60BYs92mvZwNWK6NxlJYw51xPak9QMk5
qRHaTdBkmq0a2mWYqh1AZNNgCII6/VnLcbEIgyoXB0CCfY+2vaavAmFsRwOMdeR9
HmtQQPlbTA4m5Y8jWGVs1qPtDQIDAQABo1MwUTAdBgNVHQ4EFgQUeZSoGKeN5uu5
K+n98o3wcitFYJ0wHwYDVR0jBBgwFoAUeZSoGKeN5uu5K+n98o3wcitFYJ0wDwYD
VR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOBgQA25X/Ke+5dw7up8gcF2BNQ
ggBcJs+SVKBmPwRcPQ8plgX4D/K8JJNT13HNlxTGDmb9elXEkzSjdJ+6Oa8n3IMe
vUUejXDXUBvlmmm+ImJVwwCn27cSfIYb/RoZPeKtned4SCzpbEO9H/75z3XSqAZS
Z1tiHzYOVtEs4UNGOtz1Jg==
-----END CERTIFICATE-----
```
- cn `urn:oid:2.5.4.3`
- email `urn:oid:0.9.2342.19200300.100.1.3`
## Environment based SSO
A simple approach to test environment based SSO with the user_saml app is to use apache basic auth with the following configuration:
```xml
<Location /login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
<Location /index.php/login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
<Location /index.php/apps/user_saml/saml/login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
<Location /apps/user_saml/saml/login>
AuthType Basic
AuthName "SAML"
AuthUserFile /var/www/html/.htpasswd
Require valid-user
</Location>
```
-52
View File
@@ -1,52 +0,0 @@
# SSL
## What is SSL ?
<!-- ## How to use this container with others ?-->
<!-- This section describes if there are particularities or others with this container. -->
## 🔒 Reverse Proxy
Used for SSL termination. To setup SSL support provide a proper DOMAIN_SUFFIX environment variable and put the certificates to ./data/ssl/ named by the domain name.
You might need to add the domains to your `/etc/hosts` file:
```
127.0.0.1 nextcloud.local
127.0.0.1 collabora.local
```
This is assuming you have set `DOMAIN_SUFFIX=.local`
You can generate it through:
```bash
awk -v D=.local '/- [A-z0-9]+\${DOMAIN_SUFFIX}/ {sub("\\$\{DOMAIN_SUFFIX\}", D " 127.0.0.1", $2); print $2}' docker-compose.yml
```
You can generate selfsigned certificates using:
```bash
cd data/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nextcloud.local.key -out nextcloud.local.crt
```
### dnsmasq to resolve wildcard domains
Instead of adding the individual container domains to `/etc/hosts` a local dns server like dnsmasq can be used to resolve any domain ending with the configured DOMAIN_SUFFIX in `.env` to localhost.
For dnsmasq adding the following configuration would be sufficient for `DOMAIN_SUFFIX=.local`:
```
address=/.local/127.0.0.1
```
### Use valid certificates trusted by your system
* Install mkcert https://github.com/FiloSottile/mkcert
* Go to `data/ssl`
* `mkcert nextcloud.local`
* `mv nextcloud.local-key.pem nextcloud.local.key`
* `mv nextcloud.local.pem nextcloud.local.crt`
* `docker compose restart proxy`
-57
View File
@@ -1,57 +0,0 @@
# Manual setup
## Nextcloud Code
The Nextcloud code base needs to be available including the `3rdparty` submodule. To clone it from github run:
```bash
git clone https://github.com/nextcloud/server.git
cd server
git submodule update --init
pwd
```
The last command prints the path to the Nextcloud server directory.
Use it for setting the `REPO_PATH_SERVER` in the next step.
## Configure my environment
### Copy environment variables
For this section you don't need to run the `./bootstrap.sh` script.
Here, we learn how to customise our development environment !
First, a `.env` file should be created in the repository root, to keep configuration default on the dev setup:
```bash
cp example.env .env
```
Replace `REPO_PATH_SERVER` with your path using the `pwd` command from the project.
```bash
foo@bar:~/Documents/codes/nextcloud-docker-dev$ pwd
/home/foo/Documents/codes/nextcloud-docker-dev
```
And the new value is :
```bash
REPO_PATH_SERVER=/home/foo/Documents/codes/nextcloud-docker-dev/workspace/server
```
### Setting the PHP version to be used
The Nextcloud instance is setup to run with PHP 8.1 by default.
But, the program adapts the PHP default release to suit the Nextcloud stable release using. For example, the stable23 use PHP 7.3 and the stable24 use PHP 7.4.
If you wish to use a different version of PHP, set the `PHP_VERSION` `.env` variable.
The variable supports the following values:
1. PHP 7.1: `71`
1. PHP 7.2: `72`
1. PHP 7.3: `73`
1. PHP 7.4: `74`
1. PHP 8.0: `80`
-28
View File
@@ -1,28 +0,0 @@
# Running stable versions
The docker compose file provides individual containers for stable Nextcloud releases. In order to run those you will need a checkout of the stable version server branch to your workspace directory. Using [git worktree](https://blog.juliushaertl.de/index.php/2018/01/24/how-to-checkout-multiple-git-branches-at-the-same-time/) makes it easy to have different branches checked out in parallel in separate directories.
Note that for performance reasons the server repository might have been cloned with --depth=1 by default. To get the full history it is highly recommended to run:
```bash
cd workspace/server
git fetch --unshallow
```
This may take some time depending on your internet connection speed.
```bash
cd workspace/server
git worktree add ../stable23 stable23
cd ../stable23
git submodule update --init
```
After adding the worktree you can start the stable container using `docker compose up -d stable23`. You can then add stable23.local to your `/etc/hosts` file to access it.
Git worktrees can also be used to have a checkout of an apps stable brach within the server stable directory.
```bash
cd workspace/server/apps-extra/text
git worktree add ../../../stable23/apps-extra/text stable23
```
-8
View File
@@ -1,8 +0,0 @@
## Set up XDebug
Run inside of the Nextcloud container:
```bash
set XDEBUG_CONFIG=idekey=PHPSTORM
sudo -E -u www-data php -dxdebug.remote_host=192.168.21.1 occ
```
-8
View File
@@ -1,8 +0,0 @@
# Troubleshooting
## Running into errors
If your setup isn't working and you can not figure out the reason why, running
`docker compose down -v` will remove the relevant containers and volumes,
allowing you to run `docker compose up` again from a clean slate.
-16
View File
@@ -1,16 +0,0 @@
# Useful commands
## Related to Apache
- Restart apache to reload php configuration without a full container restart: `docker compose kill -s USR1 nextcloud`
## Related to MySql
- Access to mysql console: `mysql -h $(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nextcloud_database-mysql_1) -P 3306 -u nextcloud -pnextcloud`
## Related to LDAP
- Run an LDAP search: `ldapsearch -x -H ldap://$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' nextcloud_ldap_1) -D "cn=admin,dc=planetexpress,dc=com" -w admin -b "dc=planetexpress,dc=com" -s subtree <filter> <attrs>`
+12 -3
View File
@@ -1,11 +1,11 @@
COMPOSE_PROJECT_NAME=master
# Paths
REPO_PATH_SERVER=/home/foobar/repos/nextcloud-docker-dev/workspace/server
ADDITIONAL_APPS_PATH=/home/foobar/repos/nextcloud-docker-dev/workspace/server/apps-extra
REPO_PATH_SERVER=/home/jus/repos/nextcloud/server
ADDITIONAL_APPS_PATH=/home/jus/repos/nextcloud/server/apps-extra
# Stable releases root directory
STABLE_ROOT_PATH=/home/foobar/repos/nextcloud-docker-dev/workspace
STABLE_ROOT_PATH=/home/jus/repos/nextcloud/
# Install Nextcloud apps per default
# NEXTCLOUD_AUTOINSTALL_APPS="viewer activity"
@@ -36,3 +36,12 @@ DOMAIN_SUFFIX=.local
# May be used to choose database. Both SQL and DB_SERVICE have to be set if used. Defaults to mysql.
# SQL=pgsql
# DB_SERVICE=database-postgres
# Your server git with your organization or user.
# Example : https://github.com/nextcloud
# SERVER_GIT_WITH_ORGANIZATION=""
# You define your apps list to clone.
# Example: APPS=(viewer recommendations files_pdfviewer profiler)
# APPS=()