Cambios para el documento Instalacion (docker)
Última modificación por dFa el 2025/02/24 10:01
Resumen
-
Propiedades de página (1 modificado, 0 añadido, 0 eliminado)
-
Adjuntos (0 modificado, 6 añadido, 0 eliminado)
Detalles
- Propiedades de página
-
- Contenido
-
... ... @@ -8,6 +8,9 @@ 8 8 ))) 9 9 ))) 10 10 11 +---- 12 + 13 + 11 11 {{toc/}} 12 12 13 13 (% class="row" %) ... ... @@ -14,17 +14,310 @@ 14 14 ((( 15 15 (% class="col-xs-12 col-sm-8" %) 16 16 ((( 20 +---- 21 + 17 17 = INICIO = 18 18 19 -== Instalaci on ==24 +== Instalación == 20 20 26 +La instalación consta de 4 servicios: 21 21 28 +* db: Base de datos mariadb 29 +* redes: Base de datos de memoria caché redis 30 +* app: Aplicativo nextcloud 31 +* web: Servidor web nginx 22 22 33 +El primer paso es generar nuestro docker-compose: 23 23 35 +{{code language="yaml"}} 36 +services: 37 + db: 38 + image: mariadb:10.11 39 + container_name: nextcloud-db 40 + restart: unless-stopped 41 + command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW 42 + volumes: 43 + - database:/var/lib/mysql 44 + environment: 45 + MYSQL_ROOT_PASSWORD: Ko5b0sq977j1saaCQ3SD55 46 + MYSQL_DATABASE: nextcloud 47 + MYSQL_USER: nextcloud 48 + MYSQL_PASSWORD: Ko5b0sq977j1saaCQ3SD55 49 + 50 + redis: 51 + image: redis:alpine 52 + container_name: nextcloud-redis 53 + restart: unless-stopped 54 + volumes: 55 + - redis:/data 56 + 57 + app: 58 + image: nextcloud:fpm 59 + container_name: nextcloud-app 60 + restart: unless-stopped 61 + ports: 62 + - 9000:9000 63 + depends_on: 64 + - db 65 + - redis 66 + volumes: 67 + - data:/var/www/html 68 + - user:/var/nextcloud/data 69 + - /datos/dFa:/mnt 70 + environment: 71 + MYSQL_HOST: db 72 + MYSQL_DATABASE: nextcloud 73 + MYSQL_USER: nextcloud 74 + MYSQL_PASSWORD: Ko5b0sq977j1saaCQ3SD55 75 + REDIS_HOST: redis 76 + PHP_UPLOAD_LIMIT: 0 77 + web: 78 + image: nginx 79 + container_name: nextcloud-web 80 + restart: always 81 + ports: 82 + - 8080:80 83 + depends_on: 84 + - app 85 + volumes: 86 + - nginx_conf:/etc/nginx 87 + - data:/var/www/html 88 + volumes_from: 89 + - app 90 + 91 +volumes: 92 + data: 93 + driver: local 94 + database: 95 + driver: local 96 + redis: 97 + driver: local 98 + nginx_conf: 99 + driver: local 100 + user: 101 + driver: local 102 +{{/code}} 103 + 104 +Los volúmenes se han configurado por las siguientes razones: 105 + 106 +* database: Ficheros de la base de datos mysql 107 +* redis: Ficheros de la base de datos redes 108 +* data: Ficheros del aplicativo nextcloud (es necesario que lo usen tanto el contenedor app como el contenedor web) 109 +* user: Ficheros de los perfiles de usuarios creados para nextcloud 110 +* nginx_conf: Fichero nginx.conf 111 + 112 +Además, en este caso, se ha realizado un bind de nuestro disco /datos para que sea utilizado como punto de montaje en nextcloud. Dado que es un contenedor, es necesario mapearlo para que la interfaz web tenga acceso al recurso de alguna manera. 113 + 114 +Desplegamos los contenedores: 115 + 116 +[[image:1740216653242-590.png]] 117 + 118 +Y vemos que se han creado los volumenes correctamente: 119 + 120 +[[image:1740216641833-376.png]] 121 + 122 +== Configuración == 123 + 124 +Con los volumenes creados, todavía nextcloud no es accesible, dado que debemos configurar tanto el config.php como como el nginx.conf. 125 + 126 +El fichero nginx.conf se encuentra en el volumen nextcloud_nginx_conf. Realizamos previamente un backup y reemplazamos por el siguiente: 127 + 128 +{{code language="yaml"}} 129 +worker_processes auto; 130 + 131 +error_log /var/log/nginx/error.log warn; 132 +pid /var/run/nginx.pid; 133 + 134 +events { 135 + worker_connections 1024; 136 +} 137 + 138 +http { 139 + include mime.types; 140 + default_type application/octet-stream; 141 + types { 142 + text/javascript mjs; 143 + application/wasm wasm; 144 + } 145 + 146 + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 147 + '$status $body_bytes_sent "$http_referer" ' 148 + '"$http_user_agent" "$http_x_forwarded_for"'; 149 + 150 + access_log /var/log/nginx/access.log main; 151 + 152 + sendfile on; 153 + keepalive_timeout 65; 154 + 155 + # Define asset_immutable variable properly 156 + map $arg_v $asset_immutable { 157 + default ""; 158 + "" ", immutable"; 159 + } 160 + 161 + upstream php-handler { 162 + server app:9000; 163 + } 164 + 165 + server { 166 + listen 80; 167 + 168 + client_max_body_size 512M; 169 + client_body_timeout 300s; 170 + fastcgi_buffers 64 4K; 171 + 172 + client_body_buffer_size 512k; 173 + 174 + gzip on; 175 + gzip_vary on; 176 + gzip_comp_level 4; 177 + gzip_min_length 256; 178 + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; 179 + gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; 180 + 181 + add_header Referrer-Policy "no-referrer" always; 182 + add_header X-Content-Type-Options "nosniff" always; 183 + add_header X-Frame-Options "SAMEORIGIN" always; 184 + add_header X-Permitted-Cross-Domain-Policies "none" always; 185 + add_header X-Robots-Tag "noindex, nofollow" always; 186 + add_header X-XSS-Protection "1; mode=block" always; 187 + 188 + fastcgi_hide_header X-Powered-By; 189 + 190 + root /var/www/html; 191 + 192 + index index.php index.html /index.php$request_uri; 193 + 194 + location = / { 195 + if ( $http_user_agent ~ ^DavClnt ) { 196 + return 302 /remote.php/webdav/$is_args$args; 197 + } 198 + } 199 + 200 + location = /robots.txt { 201 + allow all; 202 + log_not_found off; 203 + access_log off; 204 + } 205 + 206 + location ^~ /.well-known { 207 + location = /.well-known/carddav { return 301 /remote.php/dav/; } 208 + location = /.well-known/caldav { return 301 /remote.php/dav/; } 209 + location /.well-known/acme-challenge { try_files $uri $uri/ =404; } 210 + location /.well-known/pki-validation { try_files $uri $uri/ =404; } 211 + return 301 /index.php$request_uri; 212 + } 213 + 214 + location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } 215 + location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } 216 + 217 + location ~ \.php(?:$|/) { 218 + rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /index.php$request_uri; 219 + 220 + fastcgi_split_path_info ^(.+?\.php)(/.*)$; 221 + set $path_info $fastcgi_path_info; 222 + 223 + try_files $fastcgi_script_name =404; 224 + 225 + include fastcgi_params; 226 + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 227 + fastcgi_param PATH_INFO $path_info; 228 + fastcgi_param HTTPS on; 229 + 230 + fastcgi_param modHeadersAvailable true; 231 + fastcgi_param front_controller_active true; 232 + fastcgi_pass php-handler; 233 + 234 + fastcgi_intercept_errors on; 235 + fastcgi_request_buffering off; 236 + 237 + fastcgi_max_temp_file_size 0; 238 + } 239 + 240 + location ~ \.(?:css|js|mjs|svg|gif|ico|jpg|png|webp|wasm|tflite|map|ogg|flac)$ { 241 + try_files $uri /index.php$request_uri; 242 + add_header Cache-Control "public, max-age=15778463$asset_immutable"; 243 + access_log off; 244 + } 245 + 246 + location ~ \.wasm$ { 247 + default_type application/wasm; 248 + } 249 + 250 + location /remote { 251 + return 301 /remote.php$request_uri; 252 + } 253 + 254 + location / { 255 + try_files $uri $uri/ /index.php$request_uri; 256 + } 257 + } 258 +} 259 +{{/code}} 260 + 261 +Hacemos lo mismo con el fichero config.php que se encuentra en el volumen app dentro del directorio config: 262 + 263 +{{code language="php"}} 264 +<?php 265 +$CONFIG = array ( 266 + 'memcache.local' => '\\OC\\Memcache\\APCu', 267 + 'apps_paths' => 268 + array ( 269 + 0 => 270 + array ( 271 + 'path' => '/var/www/html/apps', 272 + 'url' => '/apps', 273 + 'writable' => true, 274 + ), 275 + 1 => 276 + array ( 277 + 'path' => '/var/www/html/custom_apps', 278 + 'url' => '/custom_apps', 279 + 'writable' => true, 280 + ), 281 + ), 282 + 'memcache.distributed' => '\\OC\\Memcache\\Redis', 283 + 'memcache.locking' => '\\OC\\Memcache\\Redis', 284 + 'redis' => 285 + array ( 286 + 'host' => 'redis', 287 + 'password' => '', 288 + 'port' => 6379, 289 + ), 290 + 'upgrade.disable-web' => true, 291 + 'instanceid' => 'ocxuwrcpcats', 292 + 'passwordsalt' => 'bFuPjx3NMpliQCtY729Uob2SRp19xe', 293 + 'secret' => 'eFMG77LAdbjw6oPSJM7hL/IDPBnP3qDxE7xlX6/uPMOvQ/kG', 294 + 'trusted_domains' => 295 + array ( 296 + 0 => '10.100.200.35:8080', 297 + 1 => 'dfacloud.ddns.net', 298 + 299 + ), 300 + 'datadirectory' => '/var/nextcloud/data', 301 + 'dbtype' => 'mysql', 302 + 'version' => '30.0.6.2', 303 + 'overwrite.cli.url' => 'https://dfacloud.ddns.net', 304 + 'dbname' => 'nextcloud', 305 + 'dbhost' => 'db', 306 + 'dbport' => '', 307 + 'dbtableprefix' => 'oc_', 308 + 'mysql.utf8mb4' => true, 309 + 'dbuser' => 'nextcloud', 310 + 'dbpassword' => 'Ko5b0sq977j1saaCQ3SD55', 311 + 'installed' => true, 312 +); 313 +{{/code}} 314 + 315 +En este fichero php tendremos que tener en cuenta modificar los valores nuestra dirección ip:puerto y nuestra dns en consecuencia. 316 + 24 24 25 25 ))) 26 26 27 27 321 + 322 + 323 + 28 28 (% class="col-xs-12 col-sm-4" %) 29 29 ((( 30 30
- 1740216568396-284.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.dFa - Tamaño
-
... ... @@ -1,0 +1,1 @@ 1 +19.9 KB - Contenido
- 1740216585269-265.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.dFa - Tamaño
-
... ... @@ -1,0 +1,1 @@ 1 +19.9 KB - Contenido
- 1740216587698-323.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.dFa - Tamaño
-
... ... @@ -1,0 +1,1 @@ 1 +19.9 KB - Contenido
- 1740216603834-462.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.dFa - Tamaño
-
... ... @@ -1,0 +1,1 @@ 1 +21.8 KB - Contenido
- 1740216641833-376.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.dFa - Tamaño
-
... ... @@ -1,0 +1,1 @@ 1 +4.6 KB - Contenido
- 1740216653242-590.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.dFa - Tamaño
-
... ... @@ -1,0 +1,1 @@ 1 +19.9 KB - Contenido