|
@@ -0,0 +1,122 @@
|
|
|
+#!/bin/bash
|
|
|
+admin=root
|
|
|
+Passwordadmind=
|
|
|
+ContainerName=Nextcloud
|
|
|
+Path="/mnt/bigpart/Docker_files/"$ContainerName
|
|
|
+
|
|
|
+echo "Stop conteners"
|
|
|
+ docker stop $ContainerName-nginx $ContainerName $ContainerName-postgresql
|
|
|
+ docker rm $ContainerName-nginx $ContainerName $ContainerName-postgresql
|
|
|
+#echo "Starting $Path/tmpfs_backup.sh"
|
|
|
+#sh $Path/tmpfs_backup.sh
|
|
|
+
|
|
|
+# --cpuset-cpus="1"\
|
|
|
+ # --memory 256M\
|
|
|
+ # --memory-swap 256M\
|
|
|
+
|
|
|
+ echo "__________________________________________________________________________________________________________"
|
|
|
+
|
|
|
+ docker run -d \
|
|
|
+ --name $ContainerName-postgresql \
|
|
|
+ -e POSTGRES_PASSWORD=myseceret \
|
|
|
+ -v $Path/init_user-db.sh:/docker-entrypoint-initdb.d/init_user-db.sh \
|
|
|
+ -v $Path/root/postgresql:/var/lib/postgresql/data \
|
|
|
+ postgres:10
|
|
|
+
|
|
|
+ #--restart=always
|
|
|
+
|
|
|
+ echo "__________________________________________________________________________________________________________"
|
|
|
+
|
|
|
+# --link Collabora \
|
|
|
+ docker run -d \
|
|
|
+ --name $ContainerName \
|
|
|
+ --link ldap-service:ldap-host \
|
|
|
+ --link $ContainerName-postgresql:postgres \
|
|
|
+ -v $Path/root/nextcloud:/var/www/html \
|
|
|
+ -v $Path/ext-storige.json:/ext-storige.json \
|
|
|
+ -e POSTGRES_PASSWORD= \
|
|
|
+ -e POSTGRES_DB=nextcloud \
|
|
|
+ -e POSTGRES_USER=nextcloud \
|
|
|
+ -e POSTGRES_HOST=postgres \
|
|
|
+ -e NEXTCLOUD_ADMIN_USER=$admin \
|
|
|
+ -e NEXTCLOUD_ADMIN_PASSWORD=$Passwordadmind \
|
|
|
+ --volume /xxx/NC12:/mnt/NFSUsers \
|
|
|
+ --volume /xxx/Media:/mnt/LocMedia \
|
|
|
+ nextcloud:fpm
|
|
|
+ docker logs $ContainerName
|
|
|
+ #--volume /mnt/bigpart/Media/Podcast:/mnt/Podcast \
|
|
|
+ echo "----------------------------------------------------------------------------------------------------------"
|
|
|
+
|
|
|
+ docker run -d \
|
|
|
+ --name $ContainerName-nginx \
|
|
|
+ --link $ContainerName:app\
|
|
|
+ -p 84:80 \
|
|
|
+ -v $Path/root/nextcloud:/var/www/html:ro \
|
|
|
+ -v $Path/nginx.conf:/etc/nginx/nginx.conf \
|
|
|
+ -e "VIRTUAL_HOST=nextcloud.openhoofd.nl" \
|
|
|
+ -e "LETSENCRYPT_HOST=nextcloud.openhoofd.nl" \
|
|
|
+ -e "LETSENCRYPT_EMAIL=thierry14@zeelandnet.nl" \
|
|
|
+ nginx
|
|
|
+
|
|
|
+ echo "----------------------------------------------------------------------------------------------------------"
|
|
|
+
|
|
|
+ docker logs $ContainerName-postgresql
|
|
|
+ docker logs $ContainerName
|
|
|
+ docker logs $ContainerName-nginx
|
|
|
+
|
|
|
+echo "----------------------------------------------------------------------------------------------------------"
|
|
|
+
|
|
|
+
|
|
|
+if [ "$1" = 1 ]
|
|
|
+ then
|
|
|
+#<<install
|
|
|
+ echo "wait for nextcloud to fully started (top_docker)"
|
|
|
+ echo "open browser and login to complite full install"
|
|
|
+ read -t 120 -p "Press enter to continue (sleeps for 120 seconds)"
|
|
|
+ curl --retry 10 --retry-delay 10 -s -k 127.0.0.1:84 > /dev/null
|
|
|
+ echo "sleep 60 to do first instal"
|
|
|
+ sleep 60
|
|
|
+
|
|
|
+echo "*----Installing apps"
|
|
|
+ docker exec --user www-data $ContainerName php occ app:enable files_external
|
|
|
+ docker exec --user www-data $ContainerName php occ app:enable user_ldap
|
|
|
+echo "*----Configer trusted_domains"
|
|
|
+ #docker exec --user www-data $ContainerName php occ config:system:get trusted_domains
|
|
|
+ docker exec --user www-data $ContainerName php occ config:system:set trusted_domains 0 --value=nextcloud.openhoofd.nl
|
|
|
+ docker exec --user www-data $ContainerName php occ config:system:set trusted_domains 1 --value=10.0.0.1:84
|
|
|
+ echo "*----Configer external_storige"
|
|
|
+ #docker exec --user www-data Nextcloud_new php occ files_external:export >> /ext-storige.json
|
|
|
+ docker exec --user www-data $ContainerName php occ files_external:import /ext-storige.json
|
|
|
+echo "*----Configer Ldap settings"
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:create-empty-config
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapHost ldap-host
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapPort 389
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 homeFolderNamingRule attr:homeDirectory
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapAgentName cn=admin,dc=openhoofd,dc=loc
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapAgentPassword
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapBase dc=openhoofd,dc=loc
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapBaseGroups ou=groups,dc=openhoofd,dc=loc
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapBaseUsers ou=NextCloud,ou=users,dc=openhoofd,dc=loc
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapExpertUUIDUserAttr givenName
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapGidNumber ldapGidNumber
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapGroupFilter "(&(|(objectclass=top)))"
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapGroupFilterObjectclass top
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapGroupMemberAssocAttr memberUid
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapLoginFilter "(&(|(objectclass=posixAccount))(|(uid=%uid)(|(givenName=%uid)(objectClass=%uid))))"
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapLoginFilterAttributes "givenName;objectClass "
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapUserDisplayName givenName
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapUserFilter "(|(objectclass=posixAccount))"
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapUserFilterObjectclass posixAccount
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 hasMemberOfFilterSupport 0
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:set-config s01 ldapConfigurationActive 1
|
|
|
+ docker exec --user www-data $ContainerName php occ ldap:test-config s01
|
|
|
+echo "*----file:scan --all & remove firstrun no needed files"
|
|
|
+ docker exec --user www-data $ContainerName php occ files:scan --all
|
|
|
+rm -r $Path/root/nextcloud/core/skeleton/Documents
|
|
|
+rm -r $Path/root/nextcloud/core/skeleton/Photos
|
|
|
+rm -r $Path/root/nextcloud/core/skeleton/Nextcloud.mp4
|
|
|
+#install
|
|
|
+ else
|
|
|
+ echo "nextcloud shoud be installed alredy"
|
|
|
+fi
|
|
|
+echo "DONE! :-D"
|