From 65d48d287f031de6e4fdd4035eab0a14eb0fbbe0 Mon Sep 17 00:00:00 2001 From: tobias ollive Date: Mon, 19 Dec 2022 12:35:58 +0100 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'Initialiser=20un?= =?UTF-8?q?=20nextcloud=20de=20test'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Initialiser-un-nextcloud-de-test.md | 151 ++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 Initialiser-un-nextcloud-de-test.md diff --git a/Initialiser-un-nextcloud-de-test.md b/Initialiser-un-nextcloud-de-test.md new file mode 100644 index 0000000..052f2e3 --- /dev/null +++ b/Initialiser-un-nextcloud-de-test.md @@ -0,0 +1,151 @@ +{On considère que nextcloud est lancé avec **docker-compose** et que le conteneur s'appelle **nextcloud-app** + +### Lancer la post install : +``` +docker compose exec -u www-data nextcloud-app bash -c \ + 'php occ maintenance:install --no-interaction \ + --admin-user=oasis --admin-pass=********** \ + --admin-email=email@domain.tld \ + --database-name=$POSTGRES_DB \ + --database-host=$POSTGRES_HOST \ + --database-user=$POSTGRES_USER \ + --database-pass=$POSTGRES_PASSWORD \ + --database=pgsql' +``` +### changer l'url du service + +``` + '**************', + 'passwordsalt' => '**************************', + 'secret' => '************************************', + 'trusted_domains' => + array ( + 0 => 'cloud.test.oasis21.org', + ), + 'overwritehost' => 'cloud.test.oasis21.org', + 'overwriteprotocol' => 'https', + 'datadirectory' => '/var/www/html/data', + 'dbtype' => 'pgsql', + 'version' => '23.0.11.1', + 'overwrite.cli.url' => 'https://cloud.test.oasis21.org', + 'dbname' => 'nc', + 'dbhost' => 'nextcloud-db', + 'dbport' => '', + 'dbtableprefix' => 'oc_', + 'dbuser' => 'nc', + 'dbpassword' => '***********', + 'installed' => true, + 'logfile' => '/var/www/html/data/nextcloud.log', + 'log_type' => 'file', + 'htaccess.RewriteBase' => '/', + 'skeletondirectory' => '', + 'memcache.local' => '\\OC\\Memcache\\APCu', + 'memcache.locking' => '\\OC\\Memcache\\Redis', + 'memcache.distributed' => '\\OC\\Memcache\\Redis', + 'redis' => + array ( + 'host' => 'redis', + 'password' => '', + 'port' => 6379, + ), + 'default_phone_region' => 'FR', + 'defaultapp' => 'files', + 'encryption.legacy_format_support' => false, + 'simpleSignUpLink.shown' => false, + 'updater.release.channel' => 'stable', + 'mail_domain' => 'oasis21.org', + 'mail_from_address' => 'nextcloud', + 'mail_smtpmode' => 'smtp', + 'loglevel' => 2, + 'integrity.check.disabled' => false, + 'ldapUserCleanupInterval' => '10', + 'default_language' => 'fr', + 'maintenance' => false, + 'mail_sendmailmode' => 'smtp', + 'trusted_proxies' => + array ( + 0 => '172.21.0.1', + ), + 'apps_paths' => + array ( + 0 => + array ( + 'path' => '/var/www/html/apps', + 'url' => '/apps', + 'writable' => false, + ), + 1 => + array ( + 'path' => '/var/www/html/custom_apps', + 'url' => '/custom_apps', + 'writable' => true, + ), + ), + 'app_install_overwrite' => + array ( + 0 => 'richdocuments', + ), + 'theme' => '', + 'data-fingerprint' => '3cbf0ccb482448aa5635ece6440a0f67', + +); +``` + + +``` +sed -i "s/localhost/cloud.test.oasis21.org/g" /var/lib/docker/volumes/docker_nextcloud-conf/_data/config/config.php + +``` + +### Créer des utilateurs et groupes +``` +users="rincewind Tawneee vetinari gaspode conina ysabell" +groups="morkpork other" + +function random_string() { +tr -dc A-Za-z0-9 < /dev/urandom | dd bs=$1 count=1 2> /dev/null +} + +for group in $groups +do + docker compose exec -u www-data nextcloud-app php occ group:add $group +done + +for user in $users +do + + docker compose exec -u www-data nextcloud-app bash -c " \ + export OC_PASS=$(random_string 10); \ + php occ user:add \ + --password-from-env \ + --display-name=$user --group=morkpork $user +done +``` + +### Intaller les applications +``` +docker compose exec -u www-data nextcloud-app php occ app:install announcementcenter +docker compose exec -u www-data nextcloud-app php occ app:install calendar +docker compose exec -u www-data nextcloud-app php occ app:install contacts +docker compose exec -u www-data nextcloud-app php occ app:install impersonate +docker compose exec -u www-data nextcloud-app php occ app:install oidc +docker compose exec -u www-data nextcloud-app php occ app:install cfg_share_links +docker compose exec -u www-data nextcloud-app php occ app:install bruteforcesettings +docker compose exec -u www-data nextcloud-app php occ app:install external +docker compose exec -u www-data nextcloud-app php occ app:install groupfolders +docker compose exec -u www-data nextcloud-app php occ app:install onlyoffice +``` + +### Configuration de groupfolders +``` +group_number=$(docker compose exec -u www-data nextcloud-app php occ groupfolders:create morkpork) +docker compose exec -u www-data nextcloud-app php occ groupfolders:group $group_number morpork write share delete +docker compose exec -u www-data nextcloud-app php occ groupfolders:quota $group_number 100G +``` + +### Configuration de onlyoffice +doit se faire via l'interface web + +