Compare commits

...

36 Commits

Author SHA1 Message Date
Christian Wolf ef21ea6be3 Added script to fetch full clones
Signed-off-by: Christian Wolf <github@christianwolf.email>
2023-12-03 16:03:21 +01:00
Christian Wolf dae008139b Add CLI parameter parsing to bootstrap script
Signed-off-by: Christian Wolf <github@christianwolf.email>
2023-12-03 16:03:20 +01:00
Julius Härtl b777c14fa9 docs: Move all docs
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-03 16:00:06 +01:00
Julius Härtl e941833242 Merge pull request #241 from juliushaertl/enh/db-cluster 2023-12-03 15:57:47 +01:00
Julius Härtl 6afcd1b4e8 fix: Add mariadb-client to containers
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-03 14:45:52 +01:00
Julius Härtl ccccc6bbdd docs: Hint to the new docs in README
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-03 14:30:38 +01:00
Julius Härtl 2786901674 docs: Add database docs
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-03 14:30:38 +01:00
Julius Härtl 76676aadb1 test: add simple playwright login test
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-03 14:30:38 +01:00
Julius Härtl 5049660b77 wip: Add mariadb primary/secondary cluster
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-03 14:30:38 +01:00
Julius Härtl 564251f56e Merge pull request #260 from juliushaertl/fix/memcached 2023-12-03 12:25:45 +01:00
Julius Härtl 4118e9b59d fix: Show progress during clone
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 22:05:52 +01:00
Julius Härtl e6116acb7d fix: Setup hosts during bootstrap and print debug info for existing installations
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 21:47:22 +01:00
Julius Härtl 9854a3c779 docs: Reference tutorial in the README (fix #70)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 21:20:31 +01:00
Julius Härtl 3c06fe3a22 fix: Bring back memcached php extension
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 21:18:08 +01:00
Julius Härtl 6705dd98f4 fix: Clone circles on fresh setups (fix #236)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 21:15:30 +01:00
Julius Härtl a5f404a4a2 fix: Comment out paths in example config (fix #174)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 21:13:29 +01:00
Julius Härtl 42925f47ec fix: Throw error if no source code found (fix #169)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 21:01:41 +01:00
Julius Härtl d43ebeea3e Merge pull request #259 from juliushaertl/renovate/actions-setup-python-4.x 2023-12-02 19:43:43 +01:00
Julius Härtl df936789b1 Merge pull request #258 from juliushaertl/renovate/actions-checkout-4.x 2023-12-02 19:43:33 +01:00
Julius Härtl 0454d2c5be ci: fix docs build on push
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 19:42:35 +01:00
Julius Härtl 1ce9d8fff5 Merge pull request #172 from fflorent/postgres-port-env 2023-12-02 19:35:06 +01:00
Julius Härtl cc210923e9 chore: update gitignore
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 19:30:34 +01:00
Julius Härtl a72e27b09f docs: More docs
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 19:30:34 +01:00
Julius Härtl 09f8437f33 fix: cleanup npm version
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 19:30:34 +01:00
Julius Härtl 71fc8c53dc enh: cleanup config handling
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 19:30:34 +01:00
Julius Härtl eab103d997 fix: docs action
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 18:20:45 +01:00
renovate[bot] 38fc67b345 chore(deps): update actions/setup-python action to v4 2023-12-02 17:18:50 +00:00
renovate[bot] 03b5c188cb chore(deps): update actions/checkout action to v4 2023-12-02 17:18:46 +00:00
Julius Härtl 3b9ec4f8fd docs: Start separate docs build
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 18:18:28 +01:00
Julius Härtl 85f756d834 fix: Fix onlyoffice secret
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 17:58:40 +01:00
Julius Härtl c67644976d chore: Bump node version in containers
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 13:28:08 +01:00
Julius Härtl b29a0cc0f5 feat: Easy editing of config from outside
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 13:25:50 +01:00
Julius Härtl 0e768bf194 fix: Cleanup docker-compose
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 13:18:34 +01:00
Julius Härtl f56d76cfa3 fix: prepare xdebug config for trace flamegraphs
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 13:13:27 +01:00
Julius Härtl d6b30a09cd fix: Use github ref name
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-02 11:16:35 +01:00
Florent d4998c12e7 Postgresql host port like Mysql 2023-03-27 12:58:42 +02:00
57 changed files with 1720 additions and 765 deletions
+43 -4
View File
@@ -81,6 +81,47 @@ jobs:
ghcr.io/juliushaertl/nextcloud-dev-${{ matrix.container }}:${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Start containers with docker compose
run: |
./bootstrap.sh
PHP_VERSION=$(echo ${{ matrix.container }} | sed -e 's/^php//')
echo "PHP_VERSION=${PHP_VERSION}" >> .env
# exit if php version is not numeric or below 80
if ! [[ $PHP_VERSION =~ ^[0-9]+$ ]] || [[ $PHP_VERSION -lt 80 ]]; then
exit 0
fi
docker-compose up -d nextcloud
# wait for nextcloud to be up
# wait up to 5 minutes
for i in {1..300}; do
if curl -s http://nextcloud.local/index.php/login | grep -q 'Login'; then
break
fi
sleep 1
done
curl http://nextcloud.local/status.php
- uses: actions/setup-node@v3
if: matrix.container == 'php80' || matrix.container == 'php81' || matrix.container == 'php82' || matrix.container == 'php83'
with:
node-version: 18
- name: Install dependencies
if: matrix.container == 'php80' || matrix.container == 'php81' || matrix.container == 'php82' || matrix.container == 'php83'
working-directory: tests
run: npm ci
- name: Install Playwright Browsers
if: matrix.container == 'php80' || matrix.container == 'php81' || matrix.container == 'php82' || matrix.container == 'php83'
working-directory: tests
run: npx playwright install --with-deps
- name: Run Playwright tests
if: matrix.container == 'php80' || matrix.container == 'php81' || matrix.container == 'php82' || matrix.container == 'php83'
working-directory: tests
run: npx playwright test
- uses: actions/upload-artifact@v3
if: matrix.container == 'php80' || matrix.container == 'php81' || matrix.container == 'php82' || matrix.container == 'php83'
with:
name: playwright-report
path: tests/playwright-report/
retention-days: 30
- name: Push container image
uses: docker/build-push-action@v5
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
@@ -91,12 +132,10 @@ jobs:
file: ${{ steps.dockerfile.outputs.DOCKERFILE }}
tags: |
ghcr.io/juliushaertl/nextcloud-dev-${{ matrix.container }}:${{ github.event_name == 'release' && 'latest' || 'nightly' }}
ghcr.io/juliushaertl/nextcloud-dev-${{ matrix.container }}:${{ github.event_name == 'release' && github.ref || github.sha }}
ghcr.io/juliushaertl/nextcloud-dev-${{ matrix.container }}:${{ github.ref_name }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
+51
View File
@@ -0,0 +1,51 @@
name: Publish MkDocs to GitHub Pages
on:
push:
branches:
- master
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs mkdocs-material
- name: Build MkDocs
run: mkdocs build
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: './site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
+14 -8
View File
@@ -1,9 +1,15 @@
data/ssl/
data/shared/
workspace/
.env
*.env
/.vscode
/data/ssl/
/data/shared/
/workspace/
/.env
/*.env
!example.env
.*
data/skeleton/
wip/
/data/skeleton/
/wip/
/site
node_modules/
/tests/test-results/
/tests/playwright-report/
/tests/blob-report/
/tests/playwright/.cache/
+9 -1
View File
@@ -1,6 +1,6 @@
SHELL := /bin/bash
.PHONY: images docker-build pull-all
.PHONY: images docker-build pull-all docs docs-watch
.ONESHELL:
images: docker/*/Dockerfile docker/Dockerfile.*
@@ -55,3 +55,11 @@ template-apply:
cat docker/Dockerfile.php.template | sed 's/php:8.2/php:8.1/' > docker/Dockerfile.php81
cat docker/Dockerfile.php.template | sed 's/php:8.2/php:8.2/' > docker/php82/Dockerfile
cat docker/Dockerfile.php.template | sed 's/php:8.2/php:8.3/' > docker/php83/Dockerfile
docs:
pip3 install mkdocs
mkdocs
docs-watch:
pip3 install mkdocs
mkdocs serve
+58 -486
View File
@@ -1,26 +1,65 @@
# Nextcloud development environment on Docker Compose
Nextcloud development environment using docker-compose
Nextcloud development environment using docker-compose providing a large variety of services for Nextcloud server and app development and testing.
**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
Features
- ☁ Nextcloud containers for running multiple versions
- 🐘 Multiple PHP versions
- 🔒 Nginx proxy with optional SSL termination
- 🛢️ MySQL/PostgreSQL/MariaDB/SQLite/MaxScale, Redis cache
- 💾 Local or S3 primary storage
- 👥 LDAP with example user data, Keycloak
- ✉ Mailhog for testing mail sending
- 🚀 Blackfire, Xdebug for profiling and debugging
- 📄 Lots of integrating service containers: Collabora Online, Onlyoffice, Elasticsearch, ...
- ☁ Nextcloud
- 🔒 Nginx proxy with SSL termination
- 💾 MySQL
- 💡 Redis
- 👥 LDAP with example user data
- ✉ Mailhog
- 🚀 Blackfire
- 📄 Collabora
## Tutorial
You can find a step by step tutorial on how to use this setup in the [Nextcloud Developer Portal](https://nextcloud.com/developer/). It will guide you through the setup and show you how to use it for app development: https://cloud.nextcloud.com/s/iyNGp8ryWxc7Efa?path=%2F1%20Setting%20up%20a%20development%20environment
In detail explanation of the setup and its features and configuration options can be found in the [nextcloud-docker-dev documentation](https://juliushaertl.github.io/nextcloud-docker-dev/).
## Quickstart
### Persistent development setup
> [!TIP]
> This is the recommended way to run the setup for development. You will have a local clone of all required source code.
To start the setup run the following commands to clone the repository and bootstrap the setup. This will prepare your setp and clone the Nextcloud server repository and required apps into the `workspace` folder.
```bash
git clone https://github.com/juliushaertl/nextcloud-docker-dev
cd nextcloud-docker-dev
./bootstrap.sh
```
This may take some time depending on your internet connection speed.
Once done you can start the Nextcloud container using:
```bash
docker-compose up nextcloud
```
You can also start it in the background using `docker-compose up -d nextcloud`.
You can then access your Nextcloud instance at [http://nextcloud.local](http://nextcloud.local). The default username is `admin` and the password is `admin`. [Other users can be found in the documentation](https://juliushaertl.github.io/nextcloud-docker-dev/basics/overview/#default-users).
> [!WARN]
> 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
> git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
> git fetch origin
> ```
## Standalone containers
### Standalone containers
::: tip
This is a very simple way but doesn't cover all features. If you are looking for a fully featured setup you may skip to the next section
:::
> [!TIP]
> This is a very simple way but doesn't cover all features. If you are looking for a fully featured setup you may skip to the next section
There is a standalone version of the Nextcloud containers available that can be used to run Nextcloud without the other services. This is useful if you are just wanting to get started with app development against a specific server version, or to just have a quick way to develop, test or debug.
@@ -51,477 +90,10 @@ You can also mount your local server source code into the container to run a loc
```bash
docker run --rm -p 8080:80 -e SERVER_BRANCH=v24.0.1 -v /tmp/server:/var/www/html ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
## Simple master setup
## More features
The easiest way to get the setup running the ```master``` branch is by running the ```bootstrap.sh``` script:
```
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
```
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:
You can find documentation for more advanced features in [nextcloud-docker-dev documentation](https://juliushaertl.github.io/nextcloud-docker-dev/) for example:
cd workspace/server
git fetch --unshallow
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
This may take some time depending on your internet connection speed.
## Additional apps
To install additional apps add them to the bootstrap command:
```bash
./bootstrap.sh circles contacts
```
You can also do this after the initial bootstrap.
In this case it will clone the apps but not update the `.env` file.
If you want your apps to be installed in the Nextcloud instance by default
add them to the `NEXTCLOUD_AUTOINSTALL_APPS` variable in `.env`.
## Complex setup
In order to achieve a more complex dev environment with different branches of the server, follow the manual steps:
##### 1. Create a workspace folder and clone the server repository
```
mkdir workspace && cd workspace
git clone https://github.com/nextcloud/server.git
```
##### 2. The Nextcloud code base needs to be available including the [`3rdparty`](https://github.com/nextcloud/3rdparty) submodule:
```
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.
Since the viewer app is kind of required for Nextcloud server, you should also clone the viewer app:
```
cd apps
git clone https://github.com/nextcloud/viewer.git
```
##### 3. Environment variables
A `.env` file should be created in the repository root, to keep configuration default on the dev setup:
```
cp example.env .env
```
Replace `REPO_PATH_SERVER` with the path from above.
##### 4. Running different 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.
```
cd workspace/server
git worktree add ../stable23 stable23
```
As in the `server` folder, the `3rdparty` submodule is needed:
```
cd ../stable23
git submodule update --init
```
The same can be done for `stable24`, `stable25`... and so on.
Git worktrees can also be used to have a checkout of an apps stable branch within the server stable directory.
```
cd workspace/server/apps-extra/text
git worktree add ../../../stable23/apps-extra/text stable23
```
The viewer app should also be added to the stable worktrees:
```
cd workspace/server/apps/viewer
git worktree add ../../../stable25/apps/viewer stable25
```
- Use `apps/` for required apps (like `viewer`)
- Use `apps-extra/` for apps that support only one specific nextcloud version (like `talk`)
- Use `apps-shared/` for apps that support multiple nextcloud versions as this directory is shared between all containers
##### 5. Editing `/etc/hosts`
You can then add `stable23.local`, `stable24.local` and so on to your `/etc/hosts` file to access it.
```
sudo sh -c "echo '127.0.0.1 nextcloud.local' >> /etc/hosts"
```
##### 6. 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:
- PHP 7.1: `71`
- PHP 7.2: `72`
- PHP 7.3: `73`
- PHP 7.4: `74`
- PHP 8.0: `80`
- PHP 8.1: `81`
##### 7. Starting the containers
- Minimum to run `master`: `docker-compose up proxy nextcloud` (nextcloud mysql redis mailhog)
- Start stable branches: `docker-compose up stable23 proxy`
- Start full setup: `docker-compose up`
##### 8. Switching between stable versions and master
Remove all relevant containers and volumes:
`docker-compose down -v`
Start master or the branch you want to run:
`docker-compose up stable23 proxy`
## 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.
- Sometimes it might help: `docker pull ghcr.io/juliushaertl/nextcloud-dev-php74:latest`
- In extreme cases, clean everything: `docker system prune --all`
- If you start your stable containers (not the master) and it wants to install Nextcloud even if it is not the first start, you may have removed the configuration with the last `docker-compose down` command. Try to use `docker-compose stop` instead or give the stable setup named values yourself.
## 🔒 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`
To update the hosts file automatically you can use the `update-hosts` script:
```
./scripts/update-hosts
```
You can generate self-signed certificates using:
```
cd data/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nextcloud.local.key -out nextcloud.local.crt
```
You can also override the default port used for HTTP and HTTPS bound on the host for the proxy by setting these environment variables in the `.env` file (don't forget to recreate the containers):
```
PROXY_PORT_HTTP=8080
PROXY_PORT_HTTPS=4443
```
### 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
```
To run dnsmasq in a container, you can use the following example:
```
docker run --rm -it \
-e DMQ_DHCP_RANGES=" " \
-e DMQ_DHCP_DNS=" " \
-e DMQ_DHCP_GATEWAY=" " \
-e DMQ_DNS_ADDRESS="address=/.local/127.0.0.1" \
-p 53:53 \
-p 53:53/udp \
drpsychick/dnsmasq:latest
```
### Use DNS Service Discovery on MacOS
You can also use the `dns-sd` tool on MacOS to advertise the container domains on the network. This is especially useful if you try to connect from an iPhone or iPad, since those devices do not allow to edit the `/etc/hosts` file. Use the tool like this:
```
dns-sd -P nextcloud _http._tcp local 80 nextcloud.local 192.168.0.10
```
Be aware that since this is advertised in the local network, it is not recommended to use it in a network where multiple instances could be running. In this case you might want to change the `DOMAIN_SUFFIX` in `.env` to prevent any collision.
### Use valid certificates trusted by your system
* Install [mkcert](https://github.com/FiloSottile/mkcert)
* Go to `data/ssl`
* `mkcert -cert-file nextcloud.local.crt -key-file nextcloud.local.key nextcloud.local`
* `docker-compose restart proxy`
## ✉ Mail
Sending/receiving mail 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`.
By default the PHP module for Blackfire is disabled, but you can enable or disable this through the following script:
```
./scripts/php-mod-config nextcloud blackfire on
```
After that you can use Blackfire through the browser plugin or curl as described below.
### 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/
```
## Xdebug
Xdebug is shipped but disabled by default. It can be turned on by running:
```
./scripts/php-mod-config nextcloud xdebug.mode debug
```
### Debugging cron, occ or other command line scripts
```
docker compose exec nextcloud bash
# use this if you have configured path mapping in PHPstorm to match the server name configured
export PHP_IDE_CONFIG=serverName=localhost
sudo -E -u www-data php -dxdebug.mode=debug -dxdebug.client_host=host.docker.internal -dxdebug.start_with_request=yes -dxdebug.idekey=PHPSTORM occ
```
## 👥 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`
- Clone, build and enable the [richdocuments](https://github.com/nextcloud/richdocuments) app
- 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](https://github.com/nextcloud/richdocuments) 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 ONLYOFFICE 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
## Talk HPB
- Make sure to have the signaling hostname setup in your `/etc/hosts` file: `127.0.0.1 talk-signaling.local`
- Automatically enable for one of your containers (e.g. the main `nextcloud` one):
- Run `./scripts/enable-talk-hpb.sh nextcloud`
- Manual setup
- Start the talk signaling server and janus in addition to your other containers `docker-compose up -d talk-signaling talk-janus`
- Go to the admin settings of talk and add the signaling server (`http://talk-signaling.local` with shared secret `1234`)
## Antivirus
```bash
docker-compose up -d proxy nextcloud av
```
The [ClamAV](https://www.clamav.net/) antivirus will then be exposed as a daemon with host `nextav` and
port `3310`.
## SAML
```
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 (SSO) 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's 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](https://github.com/nextcloud/fulltextsearch)
```
docker-compose up -d elasticsearch elasticsearch-ui
```
- Address for configuring in Nextcloud: `http://elastic:elastic@elasticsearch:9200`
- Address to access Elasticsearch 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
docker-compose up proxy nextcloud minio
```
## Development
### OCC
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
```
### Useful commands
- 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>`
## [Keycloak](https://www.keycloak.org/)
- 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 http://keycloak.dev.local/auth/realms/Example/.well-known/openid-configuration`
- http://keycloak.dev.local/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
```
## PhpMyAdmin
If you need to access the database, you can startup the `phpmyadmin` container that is already prepared.
```
docker-compose up -d phpmyadmin
```
Just add the domain to your `/etc/hosts` file and give it a try.
```
sudo sh -c "echo '127.0.0.1 phpmyadmin.local' >> /etc/hosts"
```
## pgAdmin
If you need to access the database and you are running PostgreSQL, you can use this additional container.
```
docker-compose up -d pgadmin
```
Add the domain to your `/etc/hosts` file:
```
sudo sh -c "echo '127.0.0.1 pgadmin.local' >> /etc/hosts"
```
After you have started the container open `pgadmin.local` in a web browser. The password for the `nextcloud.local` is `postgres`.
That's it, open the following path to see the Nextcloud tables: `Server group 1 -> nextcloud.local -> Databases -> nextcloud -> Schemas -> public -> Tables`
- Running stable Nextcloud versions in parallel
- Using different database backends
- Using HTTPS
+152 -14
View File
@@ -4,13 +4,122 @@ set -o errexit
set -o nounset
set -o pipefail
APPS_TO_INSTALL=(viewer recommendations files_pdfviewer profiler hmr_enabler)
APPS_TO_INSTALL=(viewer recommendations files_pdfviewer profiler hmr_enabler circles)
NEXTCLOUD_AUTOINSTALL_APPS=(viewer profiler hmr_enabler)
SERVER_CLONE=squashed
APPS_CLONE_FILTER=
print_help() {
cat << EOF
boottrap.sh [--full-clone|--clone-no-blobs] [--clone-all-apps-filtered] [--] APPS
This command will initialize the debug environment for app developers.
The following options can be provided:
--full-clone Clone the server repository with the complete history included
--clone-no-blobs Clone the server repository with the history but omitting the
file contents. A network connection might be required if checking
out commits is done.
--full-clone and --clone-no-blobs is mutually exclusive.
--clone-all-apps-filtered
Do not only reduce the history of the server repository but also
the cloned apps.
APPS The apps to add to the development setup on top of the default apps
The default apps to be installed: ${APPS_TO_INSTALL[@]}
EOF
}
while [ $# -gt 0 ]
do
case "$1" in
--full-clone)
SERVER_CLONE=full
;;
--clone-no-blobs)
SERVER_CLONE=filter-blobs
;;
--clone-all-apps-filtered)
APPS_CLONE_FILTER=y
;;
--help|-h)
print_help
exit 0
;;
--)
shift
break
;;
*)
APPS_TO_INSTALL+=("$1")
NEXTCLOUD_AUTOINSTALL_APPS+=("$1")
;;
esac
shift
done
# You can specify additional apps to install on the command line.
APPS_TO_INSTALL+=( "$@" )
NEXTCLOUD_AUTOINSTALL_APPS+=( "$@" )
# Already executed
if [ -f ".env" ]; then
echo "⏩ .env file found, so assuming you already ran this script."
echo " Validating the setup"
# shellcheck disable=SC1091
source .env
set +o errexit
echo "Server master repository path: ${REPO_PATH_SERVER}"
REPO_VERSION=$(grep "OC_VersionString" "${REPO_PATH_SERVER}/version.php" | cut -d "'" -f 2)
if [ -d "$REPO_PATH_SERVER" ] && [ -n "$REPO_VERSION" ]; then
echo "$REPO_VERSION"
elif [ -z "$REPO_VERSION" ]; then
echo "❌ Repository version.php cannot be detected"
else
echo "❌ Repository path does not exist"
fi
for i in stable26 stable27 stable28
do
echo "Stable $i repository path: ${STABLE_ROOT_PATH}/${i}"
STABLE_VERSION=$(grep "OC_VersionString" "${STABLE_ROOT_PATH}/${i}/version.php" | cut -d "'" -f 2)
if [ -d "${STABLE_ROOT_PATH}/${i}" ] && [ -n "$STABLE_VERSION" ]; then
echo "$STABLE_VERSION"
elif [ -z "$REPO_VERSION" ]; then
echo "$i version.php cannot be detected"
else
echo "$i repository path does not exist"
fi
done
exit 0
fi
case $SERVER_CLONE in
squashed)
CLONE_PARAMS=(--depth 1)
;;
clone-no-blobs)
CLONE_PARAMS=(--filter blob:none)
;;
full)
CLONE_PARAMS=()
;;
*)
echo "Unknown cloning parameter $SERVER_CLONE was found. Please report this."
exit 1
esac
if [ -n "$APPS_CLONE_FILTER" ]
then
APPS_CLONE_PARAMS=("${CLONE_PARAMS[@]}")
else
APPS_CLONE_PARAMS=()
fi
indent() {
sed 's/^/ /'
}
@@ -32,8 +141,8 @@ function install_server() {
(
(
echo "🌏 Fetching server (this might take a while to finish)" &&
git clone https://github.com/nextcloud/server.git --depth 1 workspace/server 2>&1 | indent_cli &&
cd workspace/server && git submodule update --init 2>&1 | indent_cli
git clone "${CLONE_PARAMS[@]}" https://github.com/nextcloud/server.git --depth 1 workspace/server --progress 2>&1 &&
cd workspace/server && git submodule update --init --progress 2>&1
) || echo "❌ Failed to clone Nextcloud server code"
) | indent
}
@@ -46,7 +155,7 @@ function install_app() {
fi
(
echo "🌏 Fetching $1"
(git clone https://github.com/nextcloud/"$1".git "$TARGET" 2>&1 | indent_cli &&
(git clone "${APPS_CLONE_PARAMS[@]}" https://github.com/nextcloud/"$1".git "$TARGET" 2>&1 | indent_cli &&
echo "$1 installed") ||
echo "❌ Failed to install $1"
) | indent
@@ -75,15 +184,6 @@ is_installed git
(echo "❌ Cannot run docker ps, you might need to check that your user is able to use docker properly" && exit 1)
) | indent
echo
echo "⏩ Setting up folder structure and fetching repositories"
install_server
mkdir -p workspace/server/apps-extra
for app in "${APPS_TO_INSTALL[@]}"
do
install_app "$app"
done
echo
echo
@@ -101,11 +201,12 @@ PORTBASE=821
PHP_XDEBUG_MODE=develop
# SQL variant to use, possible values: sqlite, mysql, pgsql
SQL=mysql
DB_SERVICE=database-mysql
# other values: "database-postgres"
EOT
fi
./scripts/update-hosts
if [[ $(uname -m) == 'arm64' ]]; then
echo "Setting custom containers for arm platform"
@@ -113,6 +214,15 @@ if [[ $(uname -m) == 'arm64' ]]; then
echo "CONTAINER_KEYCLOAK=mihaibob/keycloak:15.0.1" >> .env
fi
echo
echo "⏩ Setting up folder structure and fetching repositories"
install_server
mkdir -p workspace/server/apps-extra
for app in "${APPS_TO_INSTALL[@]}"
do
install_app "$app"
done
cat <<EOF
@@ -133,7 +243,11 @@ cat <<EOF
🗑 Fresh install and wipe all data
$ docker-compose down -v
EOF
case $SERVER_CLONE in
squashed)
cat <<EOF
Note that for performance reasons the server repository has been cloned with
--depth=1. To get the full history it is highly recommended to run:
@@ -145,6 +259,30 @@ cat <<EOF
This may take some time depending on your internet connection speed.
You might as well use the script in scripts/download-full-history.sh.
EOF
;;
clone-no-blobs)
cat <<EOF
Note that for performance reasons the server repository has been cloned with
--filter=blob:none. You have a complete history in the server repository.
If you checkout older commits, git will eventually download missing blobs on
the fly if they are not present locally.
You should be prepared to have a live internet connection when browsing the
history of the server repository.
You might as well use the script in scripts/download-full-history.sh.
EOF
;;
full)
;;
esac
cat <<EOF
For more details about the individual setup options see
the README.md file or checkout the repo at
+2 -66
View File
@@ -1,68 +1,4 @@
<?php
// FIXME: Move everything except the last part to the containers
// set the hostname to the VIRTUAL_HOST set for the docker container, otherwise fallback to the docker hostname
$hostname = gethostname();
$primary = isset($_ENV['PRIMARY']) ? $_ENV['PRIMARY'] : '';
$virtualHost = isset($_ENV['VIRTUAL_HOST']) ? $_ENV['VIRTUAL_HOST'] : '';
$virtualHost = explode(".", $virtualHost);
if (count($virtualHost) > 0) {
$hostname = array_shift($virtualHost);
}
$CONFIG = [];
if ($primary === 'minio') {
$CONFIG += [
'objectstore' =>
array (
'class' => 'OC\\Files\\ObjectStore\\S3',
'arguments' =>
array (
'bucket' => 'nc-' . $hostname,
'key' => 'nextcloud',
'secret' => 'nextcloud',
'hostname' => 'minio',
'port' => '9000',
'use_ssl' => false,
'use_path_style' => true,
'autocreate' => true,
'verify_bucket_exists' => true,
),
)
];
}
if ($primary === 'minio-multibucket') {
$CONFIG += [
'objectstore_multibucket' => array(
'class' => 'OC\\Files\\ObjectStore\\S3',
'arguments' => array(
// optional, defaults to 64
'num_buckets' => 64,
// n integer in the range from 0 to (num_buckets-1) will be appended
'bucket' => 'nc-' . $hostname,
'key' => 'nextcloud',
'secret' => 'nextcloud',
'hostname' => 'minio',
'port' => '9000',
'use_ssl' => false,
'use_path_style' => true,
),
),
];
}
// Useful config values during development
$CONFIG += array(
'debug' => true,
'loglevel' => 2,
// 'htaccess.RewriteBase' => '/',
'log_query' => false,
'query_log_file' => '/var/www/html/data/query.log',
'diagnostics.logging' => false,
'diagnostics.logging.threshold' => 0,
'log.condition' => [
'apps' => ['diagnostics', 'admin_audit'],
],
// This file is deprecated, please put your custom config in data/shared/config.php from now on
$CONFIG = array(
);
+1 -1
View File
@@ -13,7 +13,7 @@ use cases
```bash
#!/bin/bash
echo "🎉🎉🎉🎉🎉🎉🎉🎉 triggered hook before-start.sh"
echo "🤖 triggered hook before-start.sh"
env
export OC_PASS="mycustomuser"
occ user:add --password-from-env mycustomuser
+104 -63
View File
@@ -69,7 +69,7 @@ services:
image: ghcr.io/juliushaertl/nextcloud-dev-php${PHP_VERSION:-81}:latest
environment:
SQL: ${SQL:-mysql}
NEXTCLOUD_AUTOINSTALL: "YES"
NEXTCLOUD_AUTOINSTALL: ${NEXTCLOUD_AUTOINSTALL:-YES}
NEXTCLOUD_AUTOINSTALL_APPS:
WITH_REDIS: "YES"
VIRTUAL_HOST: "nextcloud${DOMAIN_SUFFIX}"
@@ -89,13 +89,11 @@ services:
- ./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}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -113,10 +111,10 @@ services:
ports:
- "${PORTBASE:-800}1:80"
depends_on:
- database-mysql
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -133,10 +131,10 @@ services:
- ./docker/configs/config.php:/var/www/html/config/writable.config.php:ro
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
depends_on:
- database-mysql
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -162,10 +160,10 @@ services:
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
depends_on:
- ${DB_SERVICE:-database-mysql}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -190,13 +188,11 @@ services:
- ./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}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -221,13 +217,11 @@ services:
- ./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}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -252,13 +246,11 @@ services:
- ./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}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -283,13 +275,11 @@ services:
- ./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}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -315,13 +305,11 @@ services:
- ./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}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -348,10 +336,10 @@ services:
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
depends_on:
- ${DB_SERVICE:-database-mysql}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -377,13 +365,11 @@ services:
- ./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}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -410,10 +396,10 @@ services:
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
depends_on:
- ${DB_SERVICE:-database-mysql}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -440,10 +426,10 @@ services:
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
depends_on:
- ${DB_SERVICE:-database-mysql}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -470,10 +456,10 @@ services:
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
depends_on:
- ${DB_SERVICE:-database-mysql}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -500,10 +486,10 @@ services:
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
depends_on:
- ${DB_SERVICE:-database-mysql}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -530,10 +516,10 @@ services:
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
- ./data/shared:/shared
depends_on:
- ${DB_SERVICE:-database-mysql}
- database-${SQL}
- redis
- mail
- proxy
- ${PROXY_SERVICE:-proxy}
extra_hosts:
- host.docker.internal:host-gateway
@@ -547,23 +533,75 @@ services:
MYSQL_PASSWORD: 'nextcloud'
MYSQL_USER: 'nextcloud'
MYSQL_DATABASE: 'nextcloud'
command: [
'--wait_timeout=300',
]
ports:
- "${PORTBASE:-800}2:3306"
volumes:
- mysql:/var/lib/mysql
database-mariadb-primary:
image: docker.io/bitnami/mariadb:10.6
ports:
- '3306'
volumes:
- 'mariadb_primary_data:/bitnami/mariadb'
environment:
- MARIADB_REPLICATION_MODE=master
- MARIADB_REPLICATION_USER=repl_user
- MARIADB_REPLICATION_PASSWORD=repl_password
- MARIADB_ROOT_PASSWORD=nextcloud
- MARIADB_USER=nextcloud
- MARIADB_PASSWORD=nextcloud
- MARIADB_DATABASE=nextcloud
database-mariadb-replica:
image: docker.io/bitnami/mariadb:10.6
ports:
- '3306'
depends_on:
- database-mariadb-primary
environment:
- MARIADB_REPLICATION_MODE=slave
- MARIADB_REPLICATION_USER=repl_user
- MARIADB_REPLICATION_PASSWORD=repl_password
- MARIADB_MASTER_HOST=database-mariadb-primary
- MARIADB_MASTER_PORT_NUMBER=3306
- MARIADB_MASTER_ROOT_PASSWORD=nextcloud
# This can be useful for testing but should be enabled only after a setup is completed
# - MARIADB_MASTER_DELAY=10
database-maxscale:
image: mariadb/maxscale:latest
depends_on:
- database-mariadb-primary
- database-mariadb-replica
volumes:
- './docker/maxscale/my-maxscale.cnf:/etc/maxscale.cnf.d/my-maxscale.cnf'
ports:
- '3306'
database-postgres:
image: postgres:latest
environment:
POSTGRES_DB: nextcloud
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
expose:
- 5432
- "${PORTBASE:-800}2:5432"
volumes:
- postgres:/var/lib/postgresql
database-oci:
image: ghcr.io/gvenzl/oracle-xe:18
environment:
ORACLE_PASSWORD: nextcloud
APP_USER: nextcloud
APP_USER_PASSWORD: nextcloud
ORACLE_DATABASE: nextcloud
ports:
- 1521:1521/tcp
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
@@ -577,7 +615,7 @@ services:
volumes:
- "./data/pgadmin/config:/pgadmin4/config"
depends_on:
- proxy
- ${PROXY_SERVICE:-proxy}
redis:
image: redis:7
@@ -670,17 +708,18 @@ services:
aliasgroup2: http://gs1${DOMAIN_SUFFIX}
aliasgroup3: http://gs2${DOMAIN_SUFFIX}
aliasgroup4: http://stable20${DOMAIN_SUFFIX}
aliasgroup5: http://stable26${DOMAIN_SUFFIX}
aliasgroup6: http://stable22${DOMAIN_SUFFIX}
aliasgroup7: http://stable23${DOMAIN_SUFFIX}
aliasgroup8: http://stable24${DOMAIN_SUFFIX}
aliasgroup9: http://stable25${DOMAIN_SUFFIX}
aliasgroup5: http://stable24${DOMAIN_SUFFIX}
aliasgroup6: http://stable25${DOMAIN_SUFFIX}
aliasgroup7: http://stable26${DOMAIN_SUFFIX}
aliasgroup8: http://stable27${DOMAIN_SUFFIX}
aliasgroup9: http://stable28${DOMAIN_SUFFIX}
dictionaries: de_DE en_US en_GB
username: admin
password: admin
VIRTUAL_HOST: collabora${DOMAIN_SUFFIX}
VIRTUAL_PORT: 9980
VIRTUAL_PROTO: http
server_name: collabora${DOMAIN_SUFFIX}
extra_params: "--o:ssl.enable=false --o:net.frame_ancestors=*${DOMAIN_SUFFIX} --o:home_mode.enable=true --o:ssl.termination=false ${COLLABORA_PARAMS:-}"
codedev:
@@ -700,6 +739,7 @@ services:
environment:
VIRTUAL_HOST: onlyoffice${DOMAIN_SUFFIX}
USE_UNAUTHORIZED_STORAGE: "true"
JWT_SECRET: secret
expose:
- '80'
volumes:
@@ -713,7 +753,7 @@ services:
VIRTUAL_PORT: 9001
MINIO_ROOT_USER: nextcloud
MINIO_ROOT_PASSWORD: nextcloud
MINIO_BROWSER_REDIRECT_URL: http://minio${DOMAIN_SUFFIX}
MINIO_BROWSER_REDIRECT_URL: ${PROTOCOL}://minio${DOMAIN_SUFFIX}
volumes:
- objectstorage_minio:/data
command: server /data --console-address :9001
@@ -800,8 +840,8 @@ services:
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
depends_on:
- proxy
- database-mysql
- ${PROXY_SERVICE:-proxy}
- database-${SQL}
- lookup
- redis
- mail
@@ -822,9 +862,9 @@ services:
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
depends_on:
- proxy
- ${PROXY_SERVICE:-proxy}
- portal
- database-mysql
- database-${SQL}
- lookup
- redis
- mail
@@ -845,9 +885,9 @@ services:
- ./data/skeleton/:/skeleton
- ./data/additional.config.php:/var/www/html/config/additional.config.php:ro
depends_on:
- proxy
- ${PROXY_SERVICE:-proxy}
- portal
- database-mysql
- database-${SQL}
- lookup
- redis
- mail
@@ -901,6 +941,7 @@ volumes:
smbhomes:
elasticsearch_data:
clam:
mariadb_primary_data:
networks:
default:
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+93 -52
View File
@@ -1,6 +1,8 @@
#!/bin/bash
# shellcheck disable=SC2181
# set -o xtrace
DOMAIN_SUFFIX=".$(echo "$VIRTUAL_HOST" | cut -d '.' -f2-)"
IS_STANDALONE=$([ -z "$VIRTUAL_HOST" ] && echo "true" )
@@ -9,11 +11,30 @@ indent() { sed 's/^/ /'; }
# Prepare waiting page during auto installation
cp /root/installing.html /var/www/html/installing.html
tee /etc/apache2/conf-enabled/install.conf << EOF
<Directory "/var/www/html">
AllowOverride None
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/installing.html$
RewriteRule .* /installing.html [L]
</Directory>
EOF
pkill -USR1 apache2
output() {
echo "$@"
echo "$@" >> /var/www/html/installing.html
}
fatal() {
output "======================================================================================="
output "$@"
output "======================================================================================="
exit 1
}
OCC() {
output "occ" "$@"
# shellcheck disable=SC2068
@@ -25,6 +46,11 @@ update_permission() {
chown -R www-data:www-data "$WEBROOT"/data
chown www-data:www-data "$WEBROOT"/config
chown www-data:www-data "$WEBROOT"/config/config.php 2>/dev/null
if [ -f /shared/config.php ]
then
ln -sf /shared/config.php "$WEBROOT"/config/user.config.php
fi
}
configure_xdebug_mode() {
@@ -39,19 +65,42 @@ configure_xdebug_mode() {
wait_for_other_containers() {
output "⌛ Waiting for other containers"
if [ "$SQL" = "mysql" ]
then
output " - MySQL"
while ! timeout 1 bash -c "(echo > /dev/tcp/database-mysql/3306) 2>/dev/null"; do sleep 2; done
[ $? -ne 0 ] && echo "⚠ Unable to connect to the MySQL server"
sleep 2
fi
if [ "$SQL" = "pgsql" ]
then
while ! timeout 1 bash -c "(echo > /dev/tcp/database-postgres/5432) 2>/dev/null"; do sleep 2; done
[ $? -ne 0 ] && echo "⚠ Unable to connect to the PostgreSQL server"
sleep 2
fi
retry_with_timeout() {
local cmd=$1
local timeout=$2
local error_message=$3
local START_TIME=$SECONDS
while ! bash -c "$cmd"; do
if [ "$((SECONDS - START_TIME))" -ge "$timeout" ]; then
fatal "$error_message"
fi
sleep 2
done
}
case "$SQL" in
"mysql" | "mariadb-replica")
output " - MySQL"
retry_with_timeout "(echo > /dev/tcp/database-$SQL/3306) 2>/dev/null" 30 "⚠ Unable to connect to the MySQL server"
sleep 2
;;
"pgsql")
retry_with_timeout "(echo > /dev/tcp/database-postgres/5432) 2>/dev/null" 30 "⚠ Unable to connect to the PostgreSQL server"
sleep 2
;;
"maxscale")
for node in database-mariadb-primary database-mariadb-replica; do
echo " - Waiting for $node"
retry_with_timeout "(echo > /dev/tcp/$node/3306) 2>/dev/null" 30 "⚠ Unable to reach to the $node"
retry_with_timeout "mysql -u root -pnextcloud -h $node -e 'SELECT 1' 2>/dev/null" 30 "⚠ Unable to connect to the $node"
echo "✅"
done
;;
*)
fatal 'Not implemented'
;;
esac
[ $? -eq 0 ] && output "✅ Database server ready"
}
@@ -166,36 +215,9 @@ configure_add_user() {
install() {
DBNAME=$(echo "$VIRTUAL_HOST" | cut -d '.' -f1)
SQLHOST="database-$SQL"
echo "database name will be $DBNAME"
if [ "$SQL" = "mysql" ]
then
cp /root/autoconfig_mysql.php "$WEBROOT"/config/autoconfig.php
sed -i "s/dbname' => 'nextcloud'/dbname' => '$DBNAME'/" "$WEBROOT/config/autoconfig.php"
SQLHOST=database-mysql
fi
if [ "$SQL" = "pgsql" ]
then
cp /root/autoconfig_pgsql.php "$WEBROOT"/config/autoconfig.php
sed -i "s/dbname' => 'nextcloud'/dbname' => '$DBNAME'/" "$WEBROOT/config/autoconfig.php"
SQLHOST=database-postgres
fi
if [ "$SQL" = "oci" ]
then
cp /root/autoconfig_oci.php "$WEBROOT"/config/autoconfig.php
fi
# We copy the default config to the container
cp /root/config.php "$WEBROOT"/config/config.php
chown -R www-data:www-data "$WEBROOT"/config/config.php
mkdir -p "$WEBROOT/apps-extra"
mkdir -p "$WEBROOT/apps-shared"
update_permission
USER="admin"
PASSWORD="admin"
@@ -208,6 +230,14 @@ install() {
OCC maintenance:install --admin-user=$USER --admin-pass=$PASSWORD --database="$SQL" --database-name="$DBNAME" --database-host="$SQLHOST" --database-user=postgres --database-pass=postgres
elif [ "$SQL" = "mysql" ]; then
OCC maintenance:install --admin-user=$USER --admin-pass=$PASSWORD --database="$SQL" --database-name="$DBNAME" --database-host="$SQLHOST" --database-user=root --database-pass=nextcloud
elif [ "$SQL" = "mariadb-replica" ]; then
OCC maintenance:install --admin-user=$USER --admin-pass=$PASSWORD --database="mysql" --database-name="$DBNAME" --database-host="database-mariadb-primary" --database-user=root --database-pass=nextcloud
elif [ "$SQL" = "maxscale" ]; then
sleep 10
# FIXME only works for main container as maxscale does not pass root along
OCC maintenance:install --admin-user=$USER --admin-pass=$PASSWORD --database="mysql" --database-name="$DBNAME" --database-host="database-mariadb-primary" --database-user=nextcloud --database-pass=nextcloud
OCC config:system:set dbhost --value="database-maxscale"
OCC config:system:set dbuser --value="nextcloud"
else
OCC maintenance:install --admin-user=$USER --admin-pass=$PASSWORD --database="$SQL"
fi;
@@ -324,10 +354,21 @@ setup() {
# configuration that should be applied on each start
configure_ssl_proxy
else
# We copy the default config to the container
cp /root/default.config.php "$WEBROOT"/config/config.php
chown -R www-data:www-data "$WEBROOT"/config/config.php
mkdir -p "$WEBROOT/apps-extra"
mkdir -p "$WEBROOT/apps-shared"
update_permission
if [ "$NEXTCLOUD_AUTOINSTALL" != "NO" ]
then
add_hosts
install
else
touch "${WEBROOT}/config/CAN_INSTALL"
fi
fi
}
@@ -336,6 +377,17 @@ check_source() {
if [ -f "$FILE" ]; then
output "Server source is mounted, continuing"
else
# Only autoinstall when not running in docker-compose
if [ -n "$NEXTCLOUD_AUTOINSTALL_APPS" ] && [ ! -f "$WEBROOT"/config/version.php ]
then
output "======================================================================================="
output " 🚨 Could not find a valid Nextcloud source in $WEBROOT "
output " Double check your REPO_PATH_SERVER and STABLE_ROOT_PATH environment variables in .env "
output "======================================================================================="
exit 1
fi
output "Server source is not present, fetching ${SERVER_BRANCH:-master}"
git clone --depth 1 --branch "${SERVER_BRANCH:-master}" https://github.com/nextcloud/server.git /tmp/server
(cd /tmp/server && git submodule update --init)
@@ -352,17 +404,6 @@ check_source() {
output "Nextcloud server source is ready"
}
tee /etc/apache2/conf-enabled/install.conf << EOF
<Directory "/var/www/html">
AllowOverride None
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !/installing.html$
RewriteRule .* /installing.html [L]
</Directory>
EOF
pkill -USR1 apache2
(
check_source
wait_for_other_containers
@@ -1,4 +1,13 @@
<?php $CONFIG=[
<?php
$hostname = gethostname();
$primary = isset($_ENV['PRIMARY']) ? $_ENV['PRIMARY'] : '';
$virtualHost = isset($_ENV['VIRTUAL_HOST']) ? $_ENV['VIRTUAL_HOST'] : '';
$virtualHost = explode(".", $virtualHost);
if (count($virtualHost) > 0) {
$hostname = array_shift($virtualHost);
}
$CONFIG=[
'debug' => true,
'profiler' => true,
'apps_paths' =>
@@ -44,5 +53,17 @@
'setup_create_db_user' => false,
//PLACEHOLDER
'debug' => true,
'loglevel' => 2,
// 'htaccess.RewriteBase' => '/',
'log_query' => false,
'query_log_file' => '/shared/log/querylog-' . $hostname .'.log',
'query_log_file_requestid' => 'yes',
'diagnostics.logging' => false,
'diagnostics.logging.threshold' => 0,
'log.condition' => [
'apps' => ['diagnostics', 'admin_audit'],
],
];
+6 -2
View File
@@ -3,7 +3,7 @@ xdebug.mode = off
xdebug.idekey=PHPSTORM
xdebug.trace_output_name=trace.%R.%u
xdebug.profiler_output_name=profile.%R.%u
xdebug.output_dir=/shared
xdebug.output_dir=/shared/xdebug
xdebug.log = /var/log/xdebug.log
xdebug.log_level = 1
@@ -15,4 +15,8 @@ xdebug.client_host=host.docker.internal
; When you cannot specify a trigger, use "xdebug.start_with_request = yes" to autostart debugging for all requests
; https://xdebug.org/docs/all_settings#start_with_request
xdebug.start_with_request = trigger
xdebug.trace_format=0
; Set xdebug.mode trace to use this
; More details at https://derickrethans.nl/flamboyant-flamegraphs.html
xdebug.trace_format=3
xdebug.trace_output_name=xdebug.%R.%u
+52
View File
@@ -0,0 +1,52 @@
<?php
// FIXME: Move everything except the last part to the containers
// set the hostname to the VIRTUAL_HOST set for the docker container, otherwise fallback to the docker hostname
$hostname = gethostname();
$primary = isset($_ENV['PRIMARY']) ? $_ENV['PRIMARY'] : '';
$virtualHost = isset($_ENV['VIRTUAL_HOST']) ? $_ENV['VIRTUAL_HOST'] : '';
$virtualHost = explode(".", $virtualHost);
if (count($virtualHost) > 0) {
$hostname = array_shift($virtualHost);
}
$CONFIG = [];
if ($primary === 'minio') {
$CONFIG += [
'objectstore' =>
array (
'class' => 'OC\\Files\\ObjectStore\\S3',
'arguments' =>
array (
'bucket' => 'nc-' . $hostname,
'key' => 'nextcloud',
'secret' => 'nextcloud',
'hostname' => 'minio',
'port' => '9000',
'use_ssl' => false,
'use_path_style' => true,
'autocreate' => true,
'verify_bucket_exists' => true,
),
)
];
}
if ($primary === 'minio-multibucket') {
$CONFIG += [
'objectstore_multibucket' => array(
'class' => 'OC\\Files\\ObjectStore\\S3',
'arguments' => array(
// optional, defaults to 64
'num_buckets' => 64,
// n integer in the range from 0 to (num_buckets-1) will be appended
'bucket' => 'nc-' . $hostname,
'key' => 'nextcloud',
'secret' => 'nextcloud',
'hostname' => 'minio',
'port' => '9000',
'use_ssl' => false,
'use_path_style' => true,
),
),
];
}
+31
View File
@@ -0,0 +1,31 @@
[primary]
type=server
address=database-mariadb-primary
port=3306
protocol=MariaDBBackend
[replica1]
type=server
address=database-mariadb-replica
port=3306
protocol=MariaDBBackend
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=primary,replica1
user=root
password=nextcloud
[RW-Split-Router]
type=service
router=readwritesplit
servers=primary,replica1
user=root
password=nextcloud
[RW-Split-Listener]
type=listener
service=RW-Split-Router
protocol=MariaDBClient
port=3306
+7 -6
View File
@@ -14,6 +14,7 @@ RUN install-php-extensions \
imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -28,7 +29,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -37,13 +38,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -95,5 +96,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+7 -6
View File
@@ -15,6 +15,7 @@ RUN install-php-extensions \
# imagick \
intl \
ldap \
memcached \
oci8 \
opcache \
pcntl \
@@ -29,7 +30,7 @@ RUN install-php-extensions \
# 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 rsync \
git curl vim sudo cron smbclient iproute2 lnav wget iputils-ping gnupg2 jq ripgrep rsync mariadb-client \
&& rm -rf /var/lib/apt/lists/*
# Install PHPUnit
@@ -38,13 +39,13 @@ RUN wget -O /usr/local/bin/phpunit8 https://phar.phpunit.de/phpunit-8.phar \
&& wget -O /usr/local/bin/phpunit9 https://phar.phpunit.de/phpunit-9.phar \
&& chmod +x /usr/local/bin/phpunit9
# Install NVM (Fermium = v14, Gallium = v16)
# Install NVM
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash \
&& export NVM_DIR="/root/.nvm" \
&& . "$NVM_DIR/nvm.sh" \
&& nvm install lts/gallium \
&& nvm install lts/fermium \
&& npm install -g npm@7
&& nvm install 14 && nvm install 16 && nvm install 20 \
&& nvm alias default 20
RUN wget https://gist.githubusercontent.com/nickvergessen/e21ee0a09ee3b3f7fd1b04c83dd3e114/raw/83142be1e50c23e8de1bd7aae88a95e5d6ae1ce2/nextcloud_log.json && lnav -i nextcloud_log.json && rm nextcloud_log.json
RUN { \
@@ -96,5 +97,5 @@ ENTRYPOINT ["/usr/local/bin/bootstrap.sh"]
CMD ["apache2-foreground"]
ADD data/installing.html /root/installing.html
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/s3.php configs/config.php configs/redis.config.php configs/apcu.config.php /root/
ADD configs/autoconfig_mysql.php configs/autoconfig_pgsql.php configs/autoconfig_oci.php configs/default.config.php configs/storage.config.php configs/redis.config.php configs/apcu.config.php /root/
ADD bin/bootstrap.sh bin/occ /usr/local/bin/
+77
View File
@@ -0,0 +1,77 @@
# Getting started
## Tutorial
You can find a [step by step tutorial on how to use this setup](https://cloud.nextcloud.com/s/iyNGp8ryWxc7Efa?path=%2F1%20Setting%20up%20a%20development%20environment) in the [Nextcloud Developer Portal](https://nextcloud.com/developer/). It will guide you through the setup and show you how to use it for app development.
There are two ways of using this setup. **A persistent setup is the most common one** where you have a local git clone of all required repositories. The other one is a standalone setup that can be used to quickly run parts of the Nextcloud ecosystem source code without having to clone everything.
## Persistent development setup
!!! note
This is the recommended way to run the setup for development. You will have a local clone of all required source code.
To start the setup run the following commands to clone the repository and bootstrap the setup. This will prepare your setp and clone the Nextcloud server repository and required apps into the `workspace` folder.
```bash
git clone https://github.com/juliushaertl/nextcloud-docker-dev
cd nextcloud-docker-dev
./bootstrap.sh
```
This may take some time depending on your internet connection speed.
Once done you can start the Nextcloud container using:
```bash
docker-compose up nextcloud
```
You can also start it in the background using `docker-compose up -d nextcloud`.
You can then access your Nextcloud instance at [http://nextcloud.local](http://nextcloud.local). The default username is `admin` and the password is `admin`. [Other users can be found in the documentation](https://juliushaertl.github.io/nextcloud-docker-dev/basics/overview/#default-users).
!!! warning
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
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
```
## Standalone containers
!!! note
This is a very simple way but doesn't cover all features. If you are looking for a fully featured setup you may skip to the next section
There is a standalone version of the Nextcloud containers available that can be used to run Nextcloud without the other services. This is useful if you are just wanting to get started with app development against a specific server version, or to just have a quick way to develop, test or debug.
These containers support automatic fetching of the server source code and use SQLite as the database. The server source code is fetched from the official Nextcloud server repository and the version can be specified using the `NEXTCLOUD_VERSION` environment variable. The default version is `master`.
Running the containers does not need this repository to be cloned.
Example for running a Nextcloud server from the master branch of server:
```bash
docker run --rm -p 8080:80 ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
For app development you can mount your app directly into the container:
```bash
docker run --rm -p 8080:80 -v ~/path/to/appid:/var/www/html/apps-extra/appid ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
The `SERVER_BRANCH` environment variable can be used to run different versions of Nextcloud by specificing either a server branch or git tag.
```bash
docker run --rm -p 8080:80 -e SERVER_BRANCH=v24.0.1 ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
You can also mount your local server source code into the container to run a local version of Nextcloud:
```bash
docker run --rm -p 8080:80 -e SERVER_BRANCH=v24.0.1 -v /tmp/server:/var/www/html ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
+44
View File
@@ -0,0 +1,44 @@
# Hostnames
## Using /etc/hosts
In order to use the hostnames provided by the environment you need to add them to the /etc/hosts file (which is the simplest method).
You can do this by running the following command, which will automatically update entires:
```bash
./scripts/update-hosts.sh
```
## 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
```
To run dnsmasq in a container, you can use the following example:
```
docker run --rm -it \
-e DMQ_DHCP_RANGES=" " \
-e DMQ_DHCP_DNS=" " \
-e DMQ_DHCP_GATEWAY=" " \
-e DMQ_DNS_ADDRESS="address=/.local/127.0.0.1" \
-p 53:53 \
-p 53:53/udp \
drpsychick/dnsmasq:latest
```
## Use DNS Service Discovery on MacOS
You can also use the `dns-sd` tool on MacOS to advertise the container domains on the network. This is especially useful if you try to connect from an iPhone or iPad, since those devices do not allow to edit the `/etc/hosts` file. Use the tool like this:
```
dns-sd -P nextcloud _http._tcp local 80 nextcloud.local 192.168.0.10
```
Be aware that since this is advertised in the local network, it is not recommended to use it in a network where multiple instances could be running. In this case you might want to change the `DOMAIN_SUFFIX` in `.env` to prevent any collision.
+47
View File
@@ -0,0 +1,47 @@
# Overview
## Nextcloud containers
There are multiple containers that can be started for Nextcloud. The main `nextcloud` container is targetting the main workspace directly (usually for running the master/main branch of Nextcloud server and apps) of the latest development version. In addition there are stable containers for running the stable major version branches in parallel.
Additional services like databases, redis cache, minio object storage and others are provided as separate containers and are shared between the different Nextcloud containers. They still isolate data of the individual Nextcloud containers from each other.
For any HTTP services a nginx proxy container is used to route requests to the correct container. This proxy is automatically started.
## Default users
The following user accounts are available by default:
- `admin` / `admin`
- `alice` / `alice`
- `bob` / `bob`
- `user1` / `user1`
- `user2` / `user2`
- `user3` / `user3`
- `user4` / `user4`
## App directories
The Nextcloud containers are configured to use multiple app directories.
- Use `apps/` for required apps (like `viewer`)
- Use `apps-extra/` for apps that support only one specific nextcloud version (like `talk`)
- Use `apps-shared/` for apps that support multiple nextcloud versions as this directory is shared between all containers
## Cronjobs
The cronjobs are configured to run every 5 minutes in the individual containers.
For testing you can also run them manually:
```bash
docker-compose exec nextcloud php cron.php
```
### occ
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
+23
View File
@@ -0,0 +1,23 @@
# HTTPS
A nginx proxy container is used to route requests to the correct container. This proxy is automatically started. It can be configured to use HTTPS by setting the `PROTOCOL` environment variable to `https` in the `.env` file. The container will pick up SSL certificates automatically from `data/ssl/` named by the domain name.
# Use mkcert
mkcert is a simple tool for making locally-trusted development certificates. It requires no configuration. This would be the recommended way to generate certificates for local development.
* Install [mkcert](https://github.com/FiloSottile/mkcert)
* Go to `data/ssl`
* `mkcert -cert-file nextcloud.local.crt -key-file nextcloud.local.key nextcloud.local`
* Add `PROTOCOL=https` to your `.env` file
* `docker-compose restart proxy`
* There is also a script to generate/update all certs: `./scripts/update-certs`
## Use self-signed certificates
You can generate self-signed certificates using:
```
cd data/ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nextcloud.local.key -out nextcloud.local.crt
```
+37
View File
@@ -0,0 +1,37 @@
# Stable Nextcloud versions
As described in the [overview](overview.md) there are multiple Nextcloud containers available. The main `nextcloud` container is targetting the main workspace directly (usually for running the master/main branch of Nextcloud server and apps) of the latest development version. In addition there are stable containers for running the stable major version branches in parallel.
## Prepare your git checkouts for running a stable version
In order to run a stable version you need to have the corresponding git checkouts available. 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 and is the recommended way to work with stable branches in parallel.
Assuimg you have already cloned the repository into `~/nextcloud-docker-dev/workspace/server` you can run the following commands to create a new worktree for the stable28 branch:
```bash
# create a new worktree for the stable28 branch
cd ~/nextcloud-docker-dev/workspace/server
git worktree add ../stable28 stable28
cd ~/nextcloud-docker-dev/workspace/stable28
# make sure submodules are installed in the stable server root directory
git submodule update --init
```
### Add worktree for additional apps
This will be required for every app that you need on the stable branches, so run this for viewer but also for any other app you need.
```bash
cd ~/nextcloud-docker-dev/workspace/server/apps/viewer
git worktree add ../../../stable28/apps/viewer stable28
```
## Start the stable28 container
```bash
docker-compose up -d stable28
```
## Apps without stable branches
Some apps do not have stable branches or cover multiple Nextcloud version. You can use the `ADDITIONAL_APPS_PATH` variable in your `.env` file to add add a cloned app to all Nextcloud containers. By default this is set to `./data/apps-extra`
+33
View File
@@ -0,0 +1,33 @@
# Standalone containers
There is a standalone version of the Nextcloud containers available that can be used to run Nextcloud without the other services. This is useful if you are just wanting to get started with app development against a specific server version, or to just have a quick way to develop, test or debug.
These containers support automatic fetching of the server source code and use SQLite as the database. The server source code is fetched from the official Nextcloud server repository and the version can be specified using the `NEXTCLOUD_VERSION` environment variable. The default version is `master`.
Running the containers does not need this repository to be cloned.
Example for running a Nextcloud server from the master branch of server:
```bash
docker run --rm -p 8080:80 ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
For app development you can mount your app directly into the container:
```bash
docker run --rm -p 8080:80 \
-v ~/path/to/appid:/var/www/html/apps-extra/appid \
ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
The `SERVER_BRANCH` environment variable can be used to run different versions of Nextcloud by specificing either a server branch or git tag.
```bash
docker run --rm -p 8080:80 -e SERVER_BRANCH=v24.0.1 ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
You can also mount your local server source code into the container to run a local version of Nextcloud:
```bash
docker run --rm -p 8080:80 -e SERVER_BRANCH=v24.0.1 -v /tmp/server:/var/www/html ghcr.io/juliushaertl/nextcloud-dev-php80:latest
```
+13
View File
@@ -0,0 +1,13 @@
# Troubleshooting
- 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.
- You can run `./bootstrap.sh` again to check the setup and detected paths for your source code destination
- In extreme cases, clean everything: `docker system prune --all`
- If you start your stable containers (not the master) and it wants to install Nextcloud even if it is not the first start, you may have removed the configuration with the last `docker-compose down` command. Try to use `docker-compose stop` instead or give the stable setup named values yourself.
## Logs
- You can use `docker-compose logs -f` to follow the logs of all containers
- You can use `docker-compose logs -f nextcloud` to follow the logs of the Nextcloud container
+22
View File
@@ -0,0 +1,22 @@
# Update
## Updating the development environment
- `git pull` to get the latest changes
- `make pull-installed` to pull the latest versions of all images that are already downloaded
- `make pull-all` to pull the latest versions of all images
- After pulling make sure to either recreate the containers manually or recreate the full development environment through `docker compose down -v` and `docker compose up -d proxy nextcloud ...` for the containers in use.
## Updating the Nextcloud server
As Nextcloud containers are bound to a server major version and the code is updated through manual git pull, you only need to call occ update on demand
```bash
docker-compose exec nextcloud occ upgrade
```
### Major version bump
In case Nextcloud server bumps the major version, you will need to pull all repositories again to the latest state to get the compatibility changes.
You might want to take the opportunity to then setup the previous version as a new stable version setup. See [stable versions](stable-versions.md) for more information.
+13
View File
@@ -0,0 +1,13 @@
# Build containers
This is usually only required if you want to test changes to the containers or if you want to build the containers yourself instead of using the prebuilt images.
You can build the containers manually for testing local changes by calling make with the Dockerfile as the target:
```bash
make docker/php82/Dockerfile
make docker/Dockerfile.php81
make docker/Dockerfile.php80
```
Afterwards you can recrate the container with `docker-compose up -d --force-recreate nextcloud` to run the new image or use `docker-compose down -v` before to also reinstall Nextcloud.
+36
View File
@@ -0,0 +1,36 @@
# Config
## PHP Version
The PHP version can be changed by setting the `PHP_VERSION` environment variable in your local `.env` file. If no value is set the minimum required version for the current Nextcloud version will be used depending on the Nextcloud container.
```bash
# For using PHP 8.3
PHP_VERSION=83
```
The variable supports the following values:
- PHP 7.1: `71`
- PHP 7.2: `72`
- PHP 7.3: `73`
- PHP 7.4: `74`
- PHP 8.0: `80`
- PHP 8.1: `81`
- PHP 8.2: `82`
- PHP 8.3: `83` (currently the xdebug and imagick php extensions are not available for this version)
## Nextcloud config.php
The config.php file of Nextcloud is pre-seeded with lots of configuration values. In order to change them you can place a personal config.php file in `data/shared/config.php`. This file will be included after the default config.php file for all Nextcloud containers.
```php
<?php
$CONFIG = [
'loglevel' => 2,
'log_query' => true,
'log.condition' => [
'apps' => ['myapp'],
],
];
```
+29
View File
@@ -0,0 +1,29 @@
# Setup hooks
In order to customize the behavior of the application, you can use hooks. Hooks need to be placed in the `data/shared/hooks/` directory. They will be picked up by the docker containers automatically. They can be used for automating setup specific to a developers use cases. For example, you can use them to create a user, install an app, or run a script before or after the installation of Nextcloud.
The following hooks are currently available:
- before-install.sh Runs before the installation of Nextcloud
- after-install.sh Runs after the installation of Nextcloud
- before-start.sh Runs before the start of Nextcloud webserver
- after-start.sh Runs after the start of Nextcloud webserver
## Example for after-install.sh
```bash
#!/bin/bash
echo 'Create some users'
export OC_PASS=mycustomuser
occ user:add --password-from-env mycustomuser
```
## Example for before-start.sh
```bash
#!/bin/bash
echo 'Always disable the firstrunwizard'
occ app:disable firstrunwizard
```
+15
View File
@@ -0,0 +1,15 @@
# Tips
## Shell aliases
It can be useful to be able to access your setup quickly through your shell. Here are some examples that you could add to your bashrc or zshrc:
## nc-dev
The following shell function allows you to run `nc-dev` instead of `docker-compose` in any location. This way you can run for example `nc-dev up -d nextcloud`, `nc-dev exec nextcloud bash` or `nc-dev exec nextcloud occ`.
````
nc-dev() {
(cd ~/path/to/nextcloud-docker-dev && docker-compose $@)
}
```
+17
View File
@@ -0,0 +1,17 @@
This documentation covers a Nextcloud development environment using docker-compose providing a large variety of services for Nextcloud server and app development and testing.
**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 containers for running multiple versions
- 🐘 Multiple PHP versions
- 🔒 Nginx proxy with optional SSL termination
- 🛢️ MySQL/PostgreSQL/MariaDB/SQLite/MaxScale, Redis cache
- 💾 Local or S3 primary storage
- 👥 LDAP with example user data, Keycloak
- ✉ Mailhog for testing mail sending
- 🚀 Blackfire, Xdebug for profiling and debugging
- 📄 Lots of integrating service containers: Collabora Online, Onlyoffice, Elasticsearch, ...
Follow the [getting started guide](https://juliushaertl.github.io/nextcloud-docker-dev/basics/getting-started/) or the [Nextcloud developer tutorial](https://nextcloud.com/developer/) to get started.
+8
View File
@@ -0,0 +1,8 @@
# Antivirus
```bash
docker-compose up -d proxy nextcloud av
```
The [ClamAV](https://www.clamav.net/) antivirus will then be exposed as a daemon with host `nextav` and
port `3310`.
+74
View File
@@ -0,0 +1,74 @@
# Database
## Introduction
By default MySQL will be used as database backend. You can change this by setting the `SQL` variable in the `.env` file. The following databases are supported:
- `mysql`
- `pgsql`
- `sqlite`
- `mariadb-replica`
- `maxscale`
Changing the database env value will require to recreate your setup. You can do this by running `docker-compose down -v` and then `docker-compose up -d nextcloud`.
All databases use the following credentials by default:
- Root password: `nextcloud`
- Username: `nextcloud`
- Password: `nextcloud`
- Database: `nextcloud` or the name of the stable container e.g. `stable27``
## Accessing the database
### MySQL/MariaDB
You can access the database with the following command:
```bash
docker-compose exec mariadb mysql -u root -pnextcloud
```
If you prefer a GUI frontend you can additionally launch the phpmyadmin container with `docker-compose up -d phpmyadmin` and access it via <http://phpmyadmin.local>.
Alternatively you can use a database client to access the database from the host system. The port can be obtained with `docker-compose port database-mysql 3306`. The host is `localhost` and the credentials are the same as above.
### PostgreSQL
You can access the database with the following command:
```bash
docker-compose exec postgres psql -U nextcloud -d nextcloud
```
If you prefer a GUI frontend you can additionally launch the pgadmin container with `docker-compose up -d pgadmin` and access it via <http://pgadmin.local>.
Alternatively you can use a database client to access the database from the host system. The port can be obtained with `docker-compose port database-postgresql 5432`. The host is `localhost` and the credentials are the same as above.
After you have started the container open `pgadmin.local` in a web browser. The password for the `nextcloud.local` is `postgres`.
That's it, open the following path to see the Nextcloud tables: `Server group 1 -> nextcloud.local -> Databases -> nextcloud -> Schemas -> public -> Tables`
### SQLite
You can access the database with the following command:
```bash
docker-compose exec nextcloud sqlite3 /var/www/html/data/nextcloud.db
```
### MariaDB Replica
This mode runs a mariadb primary and read replica setup. The primary is used for writes and the replica for reads. This is useful for larger setups where you want to scale the database.
You can access the database with the following command:
```bash
docker-compose exec database-mariadb-primary mysql -u root -pnextcloud
docker-compose exec database-mariadb-replica mysql -u root -pnextcloud
```
### MaxScale
This mode runs a mariadb primary and read replica setup with maxscale as load balancer. The primary is used for writes and the replica for reads where MaxScale is used to perform a read-write-split.
The logs of MaxScale can be accessed with `docker-compose exec maxscale cat /var/log/maxscale/maxscale.log`.
+8
View File
@@ -0,0 +1,8 @@
# Imaginary
Enable the imaginary server for generating previews
```bash
docker-compose up proxy nextcloud previews_hpb
./scripts/enable-preview-imaginary.sh
```
+11
View File
@@ -0,0 +1,11 @@
# 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
- 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>`
- `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*))"`
+3
View File
@@ -0,0 +1,3 @@
# Mail
Sending mails from Nextcloud usually requires an email server and account to be configured. This setup provides a [mailhog](https://github.com/mailhog/MailHog) installation that is autoconfigured, so you can browse all mails sent from Nextcloud in the webui by opening [mail.local](http://mail.local) in your browser.
+19
View File
@@ -0,0 +1,19 @@
## 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`
## [Fulltextsearch](https://github.com/nextcloud/fulltextsearch)
```
docker-compose up -d elasticsearch elasticsearch-ui
```
- Address for configuring in Nextcloud: `http://elastic:elastic@elasticsearch:9200`
- Address to access Elasticsearch from outside: `http://elastic:elastic@elasticsearch.local`
- Address for accessing the UI: <http://elasticsearch-ui.local/>
`sudo sysctl -w vm.max_map_count=262144`
+29
View File
@@ -0,0 +1,29 @@
# Nextcloud Office / Collabora Online
Nextcloud Office is a self-hosted and online office suite that can be used with Nextcloud based on Collabora Online.
## Automatic setup
A script is available to automatically setup Collabora Online for you combined with an already running Nextcloud container.
It requires to have the [richdocuments](https://github.com/nextcloud/richdocuments) app cloned into your apps directory.
```bash
./scripts/enable-collabora <container-name>
```
## Manual steps
- Make sure to have the Collabora hostname setup in your `/etc/hosts` file: `127.0.0.1 collabora.local`
- Clone, build and enable the [richdocuments](https://github.com/nextcloud/richdocuments) app
- Start the Collabora Online server in addition to your other containers `docker-compose up -d collabora`
- Make sure you have the [richdocuments app](https://github.com/nextcloud/richdocuments) 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
## Using with HTTPS
To properly work with HTTPS, you need to add the following parameter to the Collabora container in the `.env`file:
```
COLLABORA_PARAMS="--o:ssl.termination=true"
```
+20
View File
@@ -0,0 +1,20 @@
# ONLYOFFICE
ONLYOFFICE is a self-hosted office suite that can be used with Nextcloud.
## Automatic setup
A script is available to automatically setup ONLYOFFICE for you combined with an already running Nextcloud container.
It requires to have the onlyoffice integration app cloned into your apps directory.
```bash
./scripts/enable-onlyoffice <container-name>
```
## Manual steps
- Make sure to have the ONLYOFFICE hostname setup in your `/etc/hosts` file: `127.0.0.1 onlyoffice.local`
- 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
+9
View File
@@ -0,0 +1,9 @@
# S3 / Object storage
## Primary 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-compose up nextcloud minio
```
+77
View File
@@ -0,0 +1,77 @@
# SSO/SAML/OpenID Connect
## [Keycloak](https://www.keycloak.org/)
- 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 http://keycloak.dev.local/auth/realms/Example/.well-known/openid-configuration`
- <http://keycloak.dev.local/auth/realms/Example/.well-known/openid-configuration>
- nextcloud
- 09e3c268-d8bc-42f1-b7c6-74d307ef5fde
## SAML
```
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 (SSO) 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's 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>
```
+8
View File
@@ -0,0 +1,8 @@
# Talk HPB
- Make sure to have the signaling hostname setup in your `/etc/hosts` file: `127.0.0.1 talk-signaling.local`
- Automatically enable for one of your containers (e.g. the main `nextcloud` one):
- Run `./scripts/enable-talk-hpb.sh nextcloud`
- Manual setup
- Start the talk signaling server and janus in addition to your other containers `docker-compose up -d talk-signaling talk-janus`
- Go to the admin settings of talk and add the signaling server (`http://talk-signaling.local` with shared secret `1234`)
+18
View File
@@ -0,0 +1,18 @@
# 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`.
By default the PHP module for Blackfire is disabled, but you can enable or disable this through the following script:
```
./scripts/php-mod-config nextcloud blackfire on
```
After that you can use Blackfire through the browser plugin or curl as described below.
### 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/
```
+22
View File
@@ -0,0 +1,22 @@
# Xdebug
Xdebug is shipped but disabled by default. It can be turned on by running:
```
./scripts/php-mod-config nextcloud xdebug.mode debug
```
You can also enable other modes, e.g. trace:
````
./scripts/php-mod-config nextcloud xdebug.mode debug,trace
```
### Debugging cron, occ or other command line scripts
```
docker compose exec nextcloud bash
# use this if you have configured path mapping in PHPstorm to match the server name configured
export PHP_IDE_CONFIG=serverName=localhost
sudo -E -u www-data php -dxdebug.mode=debug -dxdebug.client_host=host.docker.internal -dxdebug.start_with_request=yes -dxdebug.idekey=PHPSTORM occ
```
+4 -5
View File
@@ -5,13 +5,13 @@ COMPOSE_PROJECT_NAME=master
PROTOCOL=http
# Paths
REPO_PATH_SERVER=/home/jus/workspace/server
# REPO_PATH_SERVER=/home/alice/nextcloud-docker-dev/workspace/server
# Specify a path to apps which will be shared between all containers. Useful for apps that support multiple nextcloud versions
ADDITIONAL_APPS_PATH=/home/jus/workspace/server/apps-shared
# ADDITIONAL_APPS_PATH=/home/alice/nextcloud-docker-dev/workspace/server/apps-shared
# Stable releases root directory
STABLE_ROOT_PATH=/home/jus/workspace/
# STABLE_ROOT_PATH=/home/alice/nextcloud-docker-dev/workspace
# Install Nextcloud apps per default
# NEXTCLOUD_AUTOINSTALL_APPS="viewer activity"
@@ -43,9 +43,8 @@ DOMAIN_SUFFIX=.local
# PHP_VERSION=80
# PHP_VERSION=81
# May be used to choose database. Both SQL and DB_SERVICE have to be set if used. Defaults to mysql.
# May be used to choose database (sqlite, pgsql, mysql)
# SQL=pgsql
# DB_SERVICE=database-postgres
# The mode of the xdebuger extention. This can be a comma separated list of
# the entries none, develop, debug, trace, and profile.
+5
View File
@@ -0,0 +1,5 @@
site_name: nextcloud-docker-dev
theme:
name: readthedocs
markdown_extensions:
- admonition
+86
View File
@@ -0,0 +1,86 @@
#!/bin/bash -e
isShallow() {
# Reference: https://stackoverflow.com/a/37533086
local isShallow
isShallow="$(git rev-parse --is-shallow-repository)"
if [ "$isShallow" = 'true' ]
then
return 0
else
return 1
fi
}
unshallow() {
echo "Unshallowing installation as it is needed"
git fetch --unshallow
}
isPartialClone() {
git config --get "remote.$1.partialclonefilter" &> /dev/null && return 0 || return 1
}
unpartial () {
git config --unset "remote.$1.partialclonefilter"
git fetch --refetch
}
UNSHALLOW=1
UNPARTIAL=1
REPOSITORY=workspace/server
ORIGIN=origin
while [ $# -gt 0 ]
do
case "$1" in
--no-unshallow)
UNSHALLOW=0
;;
--unshallow)
UNSHALLOW=1
;;
--no-unpartial)
UNPARTIAL=0
;;
--unpartial)
UNPARTIAL=1
;;
--repository)
REPOSITORY="$2"
shift
;;
--origin)
ORIGIN="$2"
shift
;;
*)
echo "Unknown parameter '$1' found. Exiting."
exit 1
;;
esac
shift
done
cd "$REPOSITORY"
if [ "$UNSHALLOW" = 1 ]
then
if isShallow
then
unshallow
else
echo 'The repository is already unshallowed'
fi
fi
if [ "$UNPARTIAL" = 1 ]
then
if isPartialClone "$ORIGIN"
then
echo 'Partial clone found'
unpartial "$ORIGIN"
else
echo 'Repository does not contain partial clones'
fi
fi
+10 -7
View File
@@ -1,13 +1,12 @@
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "Usage $0 CONTAINER"
exit 1
then
CONTAINER=nextcloud
else
CONTAINER=$1
fi
CONTAINER=$1
function occ() {
docker compose exec "$CONTAINER" sudo -E -u www-data "./occ" "$@"
}
@@ -18,7 +17,11 @@ source .env
echo "Setting up ONLYOFFICE with onlyoffice$DOMAIN_SUFFIX on $CONTAINER"
docker-compose up -d onlyoffice
occ app:enable onlyoffice --force
occ config:app:set onlyoffice DocumentServerUrl --value="http://onlyoffice$DOMAIN_SUFFIX"
occ config:app:set onlyoffice DocumentServerUrl --value="$PROTOCOL://onlyoffice$DOMAIN_SUFFIX"
occ config:app:set onlyoffice jwt_secret --value="secret"
occ config:app:set onlyoffice DocumentServerInternalUrl --value="http://onlyoffice/"
occ config:app:set onlyoffice StorageUrl --value="http://nextcloud/"
occ onlyoffice:documentserver --check
docker-compose exec onlyoffice /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
docker-compose exec onlyoffice /var/www/onlyoffice/documentserver/npm/json -f /etc/onlyoffice/documentserver/local.json 'services.CoAuthoring.secret.session.string'
+19
View File
@@ -0,0 +1,19 @@
import { test, expect, type Page } from '@playwright/test';
test.beforeEach(async ({ page }) => {
await page.goto('http://nextcloud.local');
});
test.describe('New Todo', () => {
test('see the nextcloud login page', async ({ page }) => {
await expect(page).toHaveTitle('Login Nextcloud');
});
test('login to nextcloud as admin', async ({ page }) => {
await page.fill('#user', 'admin');
await page.fill('#password', 'admin');
await page.getByRole('button', { name: 'Log in' }).click();
await page.goto('http://nextcloud.local/index.php/apps/files');
});
});
+91
View File
@@ -0,0 +1,91 @@
{
"name": "tests",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "tests",
"version": "1.0.0",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.40.1",
"@types/node": "^20.10.2"
}
},
"node_modules/@playwright/test": {
"version": "1.40.1",
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.1.tgz",
"integrity": "sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==",
"dev": true,
"dependencies": {
"playwright": "1.40.1"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=16"
}
},
"node_modules/@types/node": {
"version": "20.10.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.2.tgz",
"integrity": "sha512-37MXfxkb0vuIlRKHNxwCkb60PNBpR94u4efQuN4JgIAm66zfCDXGSAFCef9XUWFovX2R1ok6Z7MHhtdVXXkkIw==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
}
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/playwright": {
"version": "1.40.1",
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz",
"integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==",
"dev": true,
"dependencies": {
"playwright-core": "1.40.1"
},
"bin": {
"playwright": "cli.js"
},
"engines": {
"node": ">=16"
},
"optionalDependencies": {
"fsevents": "2.3.2"
}
},
"node_modules/playwright-core": {
"version": "1.40.1",
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz",
"integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==",
"dev": true,
"bin": {
"playwright-core": "cli.js"
},
"engines": {
"node": ">=16"
}
},
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==",
"dev": true
}
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"name": "tests",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.40.1",
"@types/node": "^20.10.2"
}
}
+77
View File
@@ -0,0 +1,77 @@
import { defineConfig, devices } from '@playwright/test';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './.',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },
/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});