Browse Source

Updates to configuration

www
Fernando Alegre 7 months ago
parent
commit
2fb8fd23c1
  1. 90
      nextcloud/Containerfile
  2. 8
      nextcloud/Initfile
  3. 0
      nextcloud/assets/nextcloud/.empty
  4. 12
      nextcloud/data/host.config.php
  5. 12
      nextcloud/data/ncconfig/host.config.php
  6. 8
      nextcloud/data/ncconfig/secret.config.php

90
nextcloud/Containerfile

@ -5,15 +5,16 @@ FROM localhost/debian
# deploy options
# -p (port) and -v (volume) both go host:container
ARG EXT_HOME
LABEL config_default="\
-p 9080:80 \
-v $HOME/vol/nextcloud/files:/vol/files \
-v $HOME/vol/nextcloud/data:/vol/data \
-v $EXT_HOME/vol/nextcloud/files:/vol/files \
-v $EXT_HOME/vol/nextcloud/data:/vol/data \
--shm-size=1g"
# Build Variables
# uid that the files owner user should have
ARG FILESUID=5000
### ARG FILESUID=5000
# database name and user
ENV DBUSER=ncadmin
ENV DBNAME=nextcloud
@ -28,37 +29,41 @@ RUN apt update -y && apt install -y apache2 php-fpm php-gd php-zip php-pgsql \
redis php-redis postgresql postgresql-doc php-ldap php-bcmath cron
# autodetect versions of php and postgres and put them in /etc/environment
# put database variables in /etc/environment so anyone can access them
# also autodetect versions of php and postgres and put them in /etc/environment as well
RUN echo "DBUSER=$DBUSER" >> /etc/environment && \
echo "DBNAME=$DBNAME" >> /etc/environment && \
echo "PSQLV=$(psql -V | cut -d ' ' -f 3 | cut -d '.' -f 1)" >> /etc/environment && \
echo "PHPV=$(echo $(php -r 'echo PHP_VERSION;') | cut -d '.' -f 1-2)" >> /etc/environment
RUN export PSQLV="$(psql -V | cut -d ' ' -f 3 | cut -d '.' -f 1)" && \
export PHPV="$(echo $(php -r 'echo PHP_VERSION;') | cut -d '.' -f 1-2)" && \
rm -f /vol/data/etc/environment && \
echo "export PSQLV=$PSQLV" >> /vol/data/etc/environment && \
echo "export PHPV=$PHPV" >> /vol/data/etc/environment && \
echo "export DBUSER=$DBUSER" >> /vol/data/etc/environment && \
echo "export DBNAME=$DBNAME" >> /vol/data/etc/environment
# change www-data's UID to the file owner UID
RUN usermod --uid $FILESUID www-data && \
groupmod --gid $FILESUID www-data && \
### RUN usermod --uid $FILESUID www-data && \
### groupmod --gid $FILESUID www-data
# make sure volume dirs exist, and copy sample data
### COPY --chown=www-data:www-data data/ /vol/data/
RUN mkdir -p /vol/data /vol/files && \
chown -R www-data:www-data /vol/data && \
chown -R www-data:www-data /var/www
# copy our custom scripts
COPY assets/bin/ /usr/local/bin/
# make sure volume dirs exist, and copy sample data
RUN mkdir -p /vol/data /vol/files
COPY --chown=www-data:www-data data/ /vol/data/
###
### PHP
###
# enable PHP interpreter
RUN systemctl enable php${PHPV:?}-fpm
# copy php configuration
COPY assets/php/ php/
RUN mv php/php.ini /etc/php/${PHPV:?}/fpm/ && \
# enable PHP interpreter
RUN . /vol/data/etc/environment && \
mv php/php.ini /etc/php/${PHPV:?}/fpm/ && \
mv php/www.conf /etc/php/${PHPV:?}/fpm/pool.d/ && \
systemctl enable php${PHPV:?}-fpm && \
rmdir php
###
@ -69,7 +74,8 @@ RUN mv php/php.ini /etc/php/${PHPV:?}/fpm/ && \
COPY --chown=postgres:postgres assets/postgresql/ postgresql/
# If the posgresql.conf file contains multiple entries for the same parameter, all but the last one is ignored.
# So we can just append our settings to the already-existing postgresql.conf file.
RUN mv postgresql/pg_hba.conf /etc/postgresql/${PSQLV:?}/main/ && \
RUN . /vol/data/etc/environment && \
mv postgresql/pg_hba.conf /etc/postgresql/${PSQLV:?}/main/ && \
cat postgresql/postgresql.conf >> /etc/postgresql/${PSQLV:?}/main/postgresql.conf && \
rm -rf postgresql
@ -79,7 +85,8 @@ RUN mv postgresql/pg_hba.conf /etc/postgresql/${PSQLV:?}/main/ && \
###
# enable modules we need
RUN a2enmod rewrite headers env dir mime proxy_fcgi && \
RUN . /vol/data/etc/environment && \
a2enmod rewrite headers env dir mime proxy_fcgi && \
a2enconf php${PHPV:?}-fpm
# copy site config
@ -102,26 +109,27 @@ RUN usermod -a -G redis www-data
# download nextcloud
COPY assets/nextcloud/ ./
RUN test -f latest.zip || \
wget --progress=dot:giga https://download.nextcloud.com/server/releases/latest.zip
# copy nextcloud config
COPY --chown=www-data:www-data assets/config/ nextcloud/config/
### RUN test -f latest.zip || \
### wget --progress=dot:giga https://download.nextcloud.com/server/releases/latest.zip
WORKDIR /var/www/html
RUN echo "Unzipping ..." && \
RUN echo "Unzipping nextcloud ..." && \
unzip -q $HOME/latest.zip && \
chown -R www-data:www-data nextcloud && \
rm $HOME/latest.zip
# create data dir for nextcloud
RUN mkdir -p /vol/files && \
chown -R www-data:www-data /vol/files
# copy nextcloud config
COPY --chown=www-data:www-data assets/config/ nextcloud/config/
# make link to host config & secret config
RUN cd nextcloud/config && \
ln -s /vol/data/host.config.php && \
ln -s /vol/data/secret.config.php
rm $HOME/latest.zip && \
echo "Creating files dir for nextcloud ..." && \
mkdir -p /vol/files && \
chown -R www-data:www-data /vol/files && \
echo "Making link to host config & secret config ..." && \
cd nextcloud/config && \
ln -s /vol/data/ncconfig/host.config.php && \
ln -s /vol/data/ncconfig/secret.config.php && \
echo "... finished installing nextcloud"
###
### DB Auto Load/Dump
@ -138,7 +146,8 @@ RUN systemctl enable db-updown.service
###
COPY assets/crontab /root/
# crontab for www-data
RUN crontab -u www-data /root/crontab
RUN crontab -u www-data /root/crontab && \
rm -f /root/crontab
###
### Bugfix
@ -151,10 +160,13 @@ COPY assets/bugfix/apache2.override /etc/systemd/system/apache2.service.d/overri
# bugfix for cron
COPY assets/bugfix/cronfix /root/
RUN chmod +x /root/cronfix && /root/cronfix
RUN chmod +x /root/cronfix && \
/root/cronfix && \
rm -f /root/cronfix
###
### Workdir
###
WORKDIR /vol/data
### WORKDIR /vol/data

8
nextcloud/Systemdfile → nextcloud/Initfile

@ -14,7 +14,6 @@ nc-occ maintenance:install --data-dir "/vol/files" --database "pgsql" --database
# do post-installation steps
nc-occ maintenance:update:htaccess
nc-occ db:add-missing-indices
nc-occ db:add-missing-columns
nc-occ db:convert-filecache-bigint
@ -29,5 +28,8 @@ nc-occ app:install mail
nc-occ app:disable comments dashboard federation files_trashbin firstrunwizard recommendations support survey_client systemtags
# configure apps
# set calendar to refresh subscriptions once a day (to set to one hour use 'PT1H' instead)
nc-occ config:app:set dav calendarSubscriptionRefreshRate --value P1D
# set calendar to refresh subscriptions once a day ('PT1H' for 1 hour, 'P1D' for a day)
nc-occ config:app:set dav calendarSubscriptionRefreshRate --value PT1H
# finish configuration
nc-occ db:add-missing-indices

0
nextcloud/assets/nextcloud/.empty

12
nextcloud/data/host.config.php

@ -1,12 +0,0 @@
<?php
$CONFIG = array(
'trusted_domains' =>
array (
0 => 'example.domain.com',
),
'overwriteprotocol' => 'https',
'overwritehost' => 'example.domain.com',
'overwritewebroot' => '/nextcloud',
'default_phone_region' => 'US'
);

12
nextcloud/data/ncconfig/host.config.php

@ -0,0 +1,12 @@
<?php
$CONFIG = array(
'trusted_domains' =>
array (
0 => 'cloud.alemor.org',
),
'overwriteprotocol' => 'https',
'overwritehost' => 'cloud.alemor.org',
### 'overwritewebroot' => '/nextcloud',
'overwrite.cli.url' => 'https://cloud.alemor.org/',
'default_phone_region' => 'US'
);

8
nextcloud/data/secret.config.php → nextcloud/data/ncconfig/secret.config.php

@ -2,9 +2,7 @@
$CONFIG = array(
/** After your first install, place the auto-generated values for these parameters here
and uncomment them, so that they persist across re-deploys. */
/**
'passwordsalt' => '',
'secret' => '',
'instanceid' => '',
*/
'passwordsalt' => 'Tor00eCxYW7hxUzeBhdzEU0+MJWwg/',
'secret' => 'jBL6XxrYZs7h5TQcLDB33vB5N4RzHxomGGgUEer25K4wdSwc',
'instanceid' => 'oc3sbo2jitqd',
);
Loading…
Cancel
Save