mirror of
https://github.com/hoellen/dockerfiles.git
synced 2025-04-19 20:09:16 +00:00
move owncloud to nextcloud
This commit is contained in:
parent
fc9b9b9115
commit
58c1d7d027
@ -1,11 +1,11 @@
|
||||
FROM alpine:edge
|
||||
MAINTAINER Wonderfall <wonderfall@schrodinger.io>
|
||||
|
||||
ARG OWNCLOUD_VERSION=9.0.2
|
||||
ARG NEXTCLOUD_VERSION=9.0.50
|
||||
ARG APCU_VERSION=5.1.5
|
||||
ARG APCUBC_VERSION=1.0.3
|
||||
|
||||
ARG GPG_owncloud="E303 6906 AD9F 3080 7351 FAC3 2D5D 5E97 F697 8A26"
|
||||
ARG GPG_nextcloud="2880 6A87 8AE4 23A2 8372 792E D758 99B9 A724 937A"
|
||||
|
||||
ENV GID=991 UID=991
|
||||
|
||||
@ -46,23 +46,24 @@ RUN echo "@commuedge http://nl.alpinelinux.org/alpine/edge/community" >> /etc/ap
|
||||
php7-openssl@testing \
|
||||
php7-dev@testing \
|
||||
php7-pear@testing \
|
||||
&& mkdir /owncloud && cd /tmp \
|
||||
&& OWNCLOUD_TARBALL="owncloud-${OWNCLOUD_VERSION}.tar.bz2" \
|
||||
&& wget -q https://download.owncloud.org/community/${OWNCLOUD_TARBALL} \
|
||||
&& wget -q https://download.owncloud.org/community/${OWNCLOUD_TARBALL}.sha256 \
|
||||
&& wget -q https://download.owncloud.org/community/${OWNCLOUD_TARBALL}.asc \
|
||||
&& mkdir /nextcloud && cd /tmp \
|
||||
&& NEXTCLOUD_TARBALL="nextcloud-${NEXTCLOUD_VERSION}.tar.bz2" \
|
||||
&& wget -q https://download.nextcloud.com/server/releases/${NEXTCLOUD_TARBALL} \
|
||||
&& wget -q https://download.nextcloud.com/server/releases/${NEXTCLOUD_TARBALL}.sha256 \
|
||||
&& wget -q https://download.nextcloud.com/server/releases/${NEXTCLOUD_TARBALL}.asc \
|
||||
&& wget -q https://pecl.php.net/get/apcu-${APCU_VERSION}.tgz \
|
||||
&& wget -q https://pecl.php.net/get/apcu_bc-${APCUBC_VERSION}.tgz \
|
||||
&& echo "Verifying both integrity and authenticity of ${OWNCLOUD_TARBALL}..." \
|
||||
&& CHECKSUM_STATE=$(echo -n $(sha256sum -c ${OWNCLOUD_TARBALL}.sha256) | tail -c 2) \
|
||||
&& echo "Verifying both integrity and authenticity of ${NEXTCLOUD_TARBALL}..." \
|
||||
&& CHECKSUM_STATE=$(echo -n $(sha256sum -c ${NEXTCLOUD_TARBALL}.sha256) | tail -c 2) \
|
||||
&& if [ "${CHECKSUM_STATE}" != "OK" ]; then echo "Warning! Checksum does not match!" && exit 1; fi \
|
||||
&& gpg --recv-keys F6978A26 \
|
||||
&& FINGERPRINT="$(LANG=C gpg --verify ${OWNCLOUD_TARBALL}.asc ${OWNCLOUD_TARBALL} 2>&1 \
|
||||
&& wget -q https://nextcloud.com/nextcloud.asc \
|
||||
&& gpg --import nextcloud.asc \
|
||||
&& FINGERPRINT="$(LANG=C gpg --verify ${NEXTCLOUD_TARBALL}.asc ${NEXTCLOUD_TARBALL} 2>&1 \
|
||||
| sed -n "s#Primary key fingerprint: \(.*\)#\1#p")" \
|
||||
&& if [ -z "${FINGERPRINT}" ]; then echo "Warning! Invalid GPG signature!" && exit 1; fi \
|
||||
&& if [ "${FINGERPRINT}" != "${GPG_owncloud}" ]; then echo "Warning! Wrong GPG fingerprint!" && exit 1; fi \
|
||||
&& echo "All seems good, now unpacking ${OWNCLOUD_TARBALL}..." \
|
||||
&& tar xjf ${OWNCLOUD_TARBALL} --strip 1 -C /owncloud \
|
||||
&& if [ "${FINGERPRINT}" != "${GPG_nextcloud}" ]; then echo "Warning! Wrong GPG fingerprint!" && exit 1; fi \
|
||||
&& echo "All seems good, now unpacking ${NEXTCLOUD_TARBALL}..." \
|
||||
&& tar xjf ${NEXTCLOUD_TARBALL} --strip 1 -C /nextcloud \
|
||||
&& tar xzf apcu-${APCU_VERSION}.tgz && tar xzf apcu_bc-${APCUBC_VERSION}.tgz \
|
||||
&& cd apcu-${APCU_VERSION} && phpize7 && ./configure --with-php-config=/usr/bin/php-config7 && make && make install \
|
||||
&& cd ../apcu_bc-${APCUBC_VERSION} && phpize7 && ./configure --with-php-config=/usr/bin/php-config7 && make && make install \
|
||||
@ -76,15 +77,15 @@ COPY opcache.ini /etc/php7/conf.d/00_opcache.ini
|
||||
COPY apcu.ini /etc/php7/conf.d/00_apcu.ini
|
||||
COPY supervisord.conf /etc/supervisor/supervisord.conf
|
||||
COPY run.sh /usr/local/bin/run.sh
|
||||
COPY cron /etc/periodic/15min/owncloud
|
||||
COPY cron /etc/periodic/15min/nextcloud
|
||||
|
||||
RUN chmod +x /usr/local/bin/run.sh /etc/periodic/15min/owncloud
|
||||
RUN chmod +x /usr/local/bin/run.sh /etc/periodic/15min/nextcloud
|
||||
|
||||
VOLUME /data /config /apps2
|
||||
EXPOSE 80
|
||||
|
||||
LABEL description="A server software for creating file hosting services" \
|
||||
owncloud="ownCloud v${OWNCLOUD_VERSION}" \
|
||||
nextcloud="ownCloud v${NEXTCLOUD_VERSION}" \
|
||||
apcu="apcu v${APCU_VERSION}" \
|
||||
apcu_bc="apcu_bc v${APCUBC_VERSION}"
|
||||
|
117
nextcloud/README.md
Normal file
117
nextcloud/README.md
Normal file
@ -0,0 +1,117 @@
|
||||
## wonderfall/nextcloud
|
||||
|
||||

|
||||
|
||||
#### Features
|
||||
- Based on **Alpine Linux** (edge).
|
||||
- **Ready to update** : data and apps persistence.
|
||||
- **nginx** is the webserver.
|
||||
- **PHP 7** version is used.
|
||||
- **OPCache** (opcode cache) is configured to provide better performances.
|
||||
- **APCu** (data store) is installed, so you can benefit from memory caching.
|
||||
- **system cron** is already configured (you can disable AJAX cron).
|
||||
- **MySQL/MariaDB** compatibility (server not built-in).
|
||||
- **Secure installation**, it verifies both integrity and authenticity (sha256sum && gpg).
|
||||
- **UID/GID flexibility**, you won't bother about permissions.
|
||||
|
||||
**This image is meant to be used behind a secure reverse proxy.**
|
||||
|
||||
#### Tags
|
||||
- `latest`, `9.0` : nextcloud 9.0.x (actual version : 9.0.50).
|
||||
|
||||
#### Build-time variables
|
||||
- **NEXTCLOUD_VERSION** : version of nextcloud
|
||||
- **APCU_VERSION** : version of apcu pecl ext
|
||||
- **APCUBC_VERSION** : version of apcu_bc pecl ext
|
||||
- **GPG_nextcloud** : fingerprint of the signing key
|
||||
|
||||
#### Environment variables
|
||||
- **UID** : nextcloud user id *(default : 991)*
|
||||
- **GID** : nextcloud group id *(default : 991)*
|
||||
|
||||
#### Volumes
|
||||
- **/data** : nextcloud data (your files!).
|
||||
- **/config** : configuration files (contains config.php).
|
||||
- **/apps2** : nextcloud downloaded apps (like calendar, contacts, etc.).
|
||||
|
||||
Hey, you should add the following code to your config.php in order to enable apps persistence :
|
||||
|
||||
```
|
||||
"apps_paths" => array (
|
||||
0 => array (
|
||||
"path" => "/nextcloud/apps",
|
||||
"url" => "/apps",
|
||||
"writable" => false,
|
||||
),
|
||||
1 => array (
|
||||
"path" => "/apps2",
|
||||
"url" => "/apps2",
|
||||
"writable" => true,
|
||||
),
|
||||
),
|
||||
```
|
||||
|
||||
#### About the database
|
||||
You have to use an external database container, it is thus allowing better security and less complexity. I suggest you to use MariaDB, which is a reliable database server. For instance, you can use the official `mariadb` image available as an automated build that you can find on Docker Hub. Since sqlite is supected by nextcloud to cause some troubles with sync clients, sqlite databases are not suported.
|
||||
|
||||
#### Once runned!
|
||||
Go to your nextcloud instance, change `/ocwww/data` to `/data` (recommended), and fill in all the fields to configure your database. Don't forget to type a strong password. You should also avoid to name your admin account "admin".
|
||||
|
||||
#### Configure
|
||||
When you mount `/config`, you don't really mount `/ocwww/nextcloud/config`. `/config` should contain `config.php`, although this is not the one actually used by nextcloud. However, each time you restart the container, `/config/config.php` overwrites `/ocwww/config/config.php`. Before that, `/ocwww/config/config.php` is copied as `/config/config.php.bkp`, so you can easily revert changes.
|
||||
|
||||
Now, nextcloud should be 100% functionnal. APCu can be enabled if you set it correctly in the config.php file (see further). **system cron is already active**. **You should switch** from `AJAX cron` to `cron` (system cron) in the admin pannel. By the way, **I highly recommend encryption**! My buid is fully-compatible with the encryption module.
|
||||
|
||||
*config.php parameters can be found [here](https://doc.nextcloud.org/server/9.0/admin_manual/configuration_server/config_sample_php_parameters.html) and [there](https://doc.nextcloud.org/server/9.0/admin_manual/installation/apps_management_installation.html)* This is espacially useful when you're using a reverse proxy, and/or if you'd like to keep your 3rd-party plugins across updates (you should use the /apps volume to do that). **READ THE DOCUMENTATION.**
|
||||
|
||||
#### How do I update?
|
||||
Just pull the newer image, and recreate the container. As you may know, backups are highly recommended (don't fear that, Docker just makes things a lot easier!), and even if it's boring, do it, do it, do it! The version directive in your `/config/config.php` is automatically updated with the one eventually generated by nextcloud after an upgrade.
|
||||
|
||||
#### Enable APCU
|
||||
Add this line to your config.php :
|
||||
|
||||
```
|
||||
'memcache.local' => '\OC\Memcache\APCu',
|
||||
```
|
||||
|
||||
#### Docker Compose (example)
|
||||
```
|
||||
reverse:
|
||||
...
|
||||
links:
|
||||
- nextcloud:nextcloud
|
||||
...
|
||||
|
||||
nextcloud:
|
||||
image: wonderfall/nextcloud:9.0
|
||||
links:
|
||||
- db_nextcloud:db_nextcloud
|
||||
environment:
|
||||
- UID=1000
|
||||
- GID=1000
|
||||
volumes:
|
||||
- /mnt/nextcloud/data:/data
|
||||
- /mnt/nextcloud/config:/config
|
||||
- /mnt/nextcloud/apps:/apps2
|
||||
|
||||
db_nextcloud:
|
||||
image: mariadb:10
|
||||
volumes:
|
||||
- /mnt/nextcloud/db:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=supersecretpassword
|
||||
- MYSQL_DATABASE=nextcloud
|
||||
- MYSQL_USER=nextcloud
|
||||
- MYSQL_PASSWORD=supersecretpassword
|
||||
```
|
||||
|
||||
#### Port
|
||||
- **80** (cf Reverse Proxy).
|
||||
|
||||
|
||||
#### Reverse proxy
|
||||
https://github.com/hardware/mailserver/wiki/Reverse-proxy-configuration
|
||||
Note that you don't have to add any headers since they're already included in the container (you avoid useless warnings from nextcloud). It is strongly recommended to use nextcloud through an encrypted connection (HTTPS).
|
||||
|
||||
#### Enjoy!
|
||||
Go to your admin pannel, and check the **Security & setup warnings** section. If you see **"All checks passed"**, then you can congratulate yourself!
|
2
nextcloud/cron
Normal file
2
nextcloud/cron
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
su - nextcloud -c "php7 -f /nextcloud/cron.php" > /dev/null 2>&1
|
@ -1,4 +1,4 @@
|
||||
user owncloud;
|
||||
user nextcloud;
|
||||
worker_processes auto;
|
||||
pid /var/run/nginx.pid;
|
||||
daemon off;
|
||||
@ -52,7 +52,7 @@ http {
|
||||
server {
|
||||
listen 80;
|
||||
index index.php;
|
||||
root /owncloud;
|
||||
root /nextcloud;
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
|
@ -2,11 +2,11 @@
|
||||
daemonize = no
|
||||
|
||||
[www]
|
||||
user = owncloud
|
||||
group = owncloud
|
||||
user = nextcloud
|
||||
group = nextcloud
|
||||
listen = /var/run/php-fpm.sock
|
||||
listen.owner = owncloud
|
||||
listen.group = owncloud
|
||||
listen.owner = nextcloud
|
||||
listen.group = nextcloud
|
||||
pm = dynamic
|
||||
pm.max_children = 10
|
||||
pm.start_servers = 2
|
23
nextcloud/run.sh
Normal file
23
nextcloud/run.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
addgroup -g ${GID} nextcloud && adduser -h /nextcloud -s /bin/sh -D -G nextcloud -u ${UID} nextcloud
|
||||
|
||||
if [ -f /nextcloud/config/config.php ] && [ ! -f /config/config.php ]; then
|
||||
cp /nextcloud/config/config.php /config/config.php
|
||||
elif [ -f /config/config.php ]; then
|
||||
if [ -f /nextcloud/config/config.php ]; then
|
||||
sed -i "s/.*version.*/`grep "version" \/nextcloud\/config\/config.php`/" /config/config.php
|
||||
CONFIG=`md5sum /config/config.php | awk '{ print $1 }'`
|
||||
CONFIGINS=`md5sum /nextcloud/config/config.php | awk '{ print $1 }'`
|
||||
if [ $CONFIG != $CONFIGINS ]; then
|
||||
mv /nextcloud/config/config.php /config/config.php.bkp
|
||||
fi
|
||||
fi
|
||||
cp /config/config.php /nextcloud/config/config.php
|
||||
fi
|
||||
|
||||
touch /var/run/php-fpm.sock
|
||||
mkdir /tmp/fastcgi /tmp/client_body
|
||||
chown -R nextcloud:nextcloud /nextcloud /data /config /apps2 /var/run/php-fpm.sock /var/lib/nginx /tmp
|
||||
ln -s /apps2 /nextcloud
|
||||
|
||||
supervisord -c /etc/supervisor/supervisord.conf
|
@ -1,119 +0,0 @@
|
||||
## wonderfall/owncloud
|
||||
|
||||

|
||||
|
||||
#### Features
|
||||
- Based on **Alpine Linux** (edge).
|
||||
- **Ready to update** : data and apps persistence.
|
||||
- **nginx** is the webserver.
|
||||
- **PHP 7** version is used.
|
||||
- **OPCache** (opcode cache) is configured to provide better performances.
|
||||
- **APCu** (data store) is installed, so you can benefit from memory caching.
|
||||
- **system cron** is already configured (you can disable AJAX cron).
|
||||
- **MySQL/MariaDB** compatibility (server not built-in).
|
||||
- **Secure installation**, it verifies both integrity and authenticity (sha256sum && gpg).
|
||||
- **UID/GID flexibility**, you won't bother about permissions.
|
||||
|
||||
**This image is meant to be used behind a secure reverse proxy.**
|
||||
|
||||
#### Tags
|
||||
- `latest`, `9.0` : ownCloud 9.0.x (actual version : 9.0.1).
|
||||
|
||||
If you want some security, versioning with tags should be available since 9.0 (e.g. the next tags will be 9.1, 9.2, etc. major updates as you can notice). I do not make tags for minor updates, like 8.2.1, 8.2.2, 8.2.x, since there are only bugfixes and security patches, which are strongly recommended.
|
||||
|
||||
#### Build-time variables
|
||||
- **OWNCLOUD_VERSION** : version of ownCloud
|
||||
- **APCU_VERSION** : version of apcu pecl ext
|
||||
- **APCUBC_VERSION** : version of apcu_bc pecl ext
|
||||
- **GPG_owncloud** : fingerprint of the signing key
|
||||
|
||||
#### Environment variables
|
||||
- **UID** : owncloud user id *(default : 991)*
|
||||
- **GID** : owncloud group id *(default : 991)*
|
||||
|
||||
#### Volumes
|
||||
- **/data** : owncloud data (your files!).
|
||||
- **/config** : configuration files (contains config.php).
|
||||
- **/apps2** : owncloud downloaded apps (like calendar, contacts, etc.).
|
||||
|
||||
Hey, you should add the following code to your config.php in order to enable apps persistence :
|
||||
|
||||
```
|
||||
"apps_paths" => array (
|
||||
0 => array (
|
||||
"path" => "/owncloud/apps",
|
||||
"url" => "/apps",
|
||||
"writable" => false,
|
||||
),
|
||||
1 => array (
|
||||
"path" => "/apps2",
|
||||
"url" => "/apps2",
|
||||
"writable" => true,
|
||||
),
|
||||
),
|
||||
```
|
||||
|
||||
#### About the database
|
||||
You have to use an external database container, it is thus allowing better security and less complexity. I suggest you to use MariaDB, which is a reliable database server. For instance, you can use the official `mariadb` image available as an automated build that you can find on Docker Hub. Since sqlite is supected by ownCloud to cause some troubles with sync clients, sqlite databases are not suported.
|
||||
|
||||
#### Once runned!
|
||||
Go to your ownCloud instance, change `/ocwww/data` to `/data` (recommended), and fill in all the fields to configure your database. Don't forget to type a strong password. You should also avoid to name your admin account "admin".
|
||||
|
||||
#### Configure
|
||||
When you mount `/config`, you don't really mount `/ocwww/owncloud/config`. `/config` should contain `config.php`, although this is not the one actually used by ownCloud. However, each time you restart the container, `/config/config.php` overwrites `/ocwww/config/config.php`. Before that, `/ocwww/config/config.php` is copied as `/config/config.php.bkp`, so you can easily revert changes.
|
||||
|
||||
Now, ownCloud should be 100% functionnal. APCu can be enabled if you set it correctly in the config.php file (see further). **system cron is already active**. **You should switch** from `AJAX cron` to `cron` (system cron) in the admin pannel. By the way, **I highly recommend encryption**! My buid is fully-compatible with the encryption module.
|
||||
|
||||
*config.php parameters can be found [here](https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/config_sample_php_parameters.html) and [there](https://doc.owncloud.org/server/9.0/admin_manual/installation/apps_management_installation.html)* This is espacially useful when you're using a reverse proxy, and/or if you'd like to keep your 3rd-party plugins across updates (you should use the /apps volume to do that). **READ THE DOCUMENTATION.**
|
||||
|
||||
#### How do I update?
|
||||
Just pull the newer image, and recreate the container. As you may know, backups are highly recommended (don't fear that, Docker just makes things a lot easier!), and even if it's boring, do it, do it, do it! The version directive in your `/config/config.php` is automatically updated with the one eventually generated by ownCloud after an upgrade.
|
||||
|
||||
#### Enable APCU
|
||||
Add this line to your config.php :
|
||||
|
||||
```
|
||||
'memcache.local' => '\OC\Memcache\APCu',
|
||||
```
|
||||
|
||||
#### Docker Compose (example)
|
||||
```
|
||||
reverse:
|
||||
...
|
||||
links:
|
||||
- owncloud:owncloud
|
||||
...
|
||||
|
||||
owncloud:
|
||||
image: wonderfall/owncloud:9.0
|
||||
links:
|
||||
- db_owncloud:db_owncloud
|
||||
environment:
|
||||
- UID=1000
|
||||
- GID=1000
|
||||
volumes:
|
||||
- /mnt/owncloud/data:/data
|
||||
- /mnt/owncloud/config:/config
|
||||
- /mnt/owncloud/apps:/apps2
|
||||
|
||||
db_owncloud:
|
||||
image: mariadb:10
|
||||
volumes:
|
||||
- /mnt/owncloud/db:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=supersecretpassword
|
||||
- MYSQL_DATABASE=owncloud
|
||||
- MYSQL_USER=owncloud
|
||||
- MYSQL_PASSWORD=supersecretpassword
|
||||
```
|
||||
|
||||
#### Port
|
||||
- **80** (cf Reverse Proxy).
|
||||
|
||||
|
||||
#### Reverse proxy
|
||||
https://github.com/hardware/mailserver/wiki/Reverse-proxy-configuration
|
||||
Note that you don't have to add any headers since they're already included in the container (you avoid useless warnings from owncloud). It is strongly recommended to use ownCloud through an encrypted connection (HTTPS).
|
||||
|
||||
#### Enjoy!
|
||||
Go to your admin pannel, and check the **Security & setup warnings** section. If you see **"All checks passed"**, then you can congratulate yourself!
|
@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
su - owncloud -c "php7 -f /owncloud/cron.php" > /dev/null 2>&1
|
@ -1,23 +0,0 @@
|
||||
#!/bin/sh
|
||||
addgroup -g ${GID} owncloud && adduser -h /owncloud -s /bin/sh -D -G owncloud -u ${UID} owncloud
|
||||
|
||||
if [ -f /owncloud/config/config.php ] && [ ! -f /config/config.php ]; then
|
||||
cp /owncloud/config/config.php /config/config.php
|
||||
elif [ -f /config/config.php ]; then
|
||||
if [ -f /owncloud/config/config.php ]; then
|
||||
sed -i "s/.*version.*/`grep "version" \/owncloud\/config\/config.php`/" /config/config.php
|
||||
CONFIG=`md5sum /config/config.php | awk '{ print $1 }'`
|
||||
CONFIGINS=`md5sum /owncloud/config/config.php | awk '{ print $1 }'`
|
||||
if [ $CONFIG != $CONFIGINS ]; then
|
||||
mv /owncloud/config/config.php /config/config.php.bkp
|
||||
fi
|
||||
fi
|
||||
cp /config/config.php /owncloud/config/config.php
|
||||
fi
|
||||
|
||||
touch /var/run/php-fpm.sock
|
||||
mkdir /tmp/fastcgi /tmp/client_body
|
||||
chown -R owncloud:owncloud /owncloud /data /config /apps2 /var/run/php-fpm.sock /var/lib/nginx /tmp
|
||||
ln -s /apps2 /owncloud
|
||||
|
||||
supervisord -c /etc/supervisor/supervisord.conf
|
Loading…
x
Reference in New Issue
Block a user