DEV Community

César M. Cristóbal for CallePuzzle Dev

Posted on • Originally published at dev.callepuzzle.com

2 2

Desplegar Nextcloud en Docker usando Ansible

Nextcloud nos permite tener nuestro propio servidor de archivos a lo Dropbox. Pero a mí lo que más me gusta es poder tener mi calendario y mis contactos independiente del todopoderoso Google.

Vamos a ver como podemos desplegar Nextcloud en una Debian usando Docker y todo ello automatizado con Ansible.

El esquema que vamos a tener es una máquina Debian con tres contenedores dentro:

  • haproxy
  • nextcloud
  • mariadb

Nextcloud containerized

Requisitos

  • Tener acceso root a la máquina Debian.
  • Tener instalado Ansible.

A mí personalmente me gusta instalar Ansible en un virtualenv de python:

$ virtualenv3 venv/py3
$ source venv/py3/bin/activate
(py3)$ pip install ansible
Enter fullscreen mode Exit fullscreen mode

Instalamos los roles necesarios:

(py3)$ ansible-galaxy install jilgue.ansible_role_docker_nextcloud
(py3)$ ansible-galaxy install jilgue.ansible_role_docker_haproxy
Enter fullscreen mode Exit fullscreen mode

Playbook

A continuación vamos a generar la configuración de Ansible.

Necesitamos generar el inventario:

nextcloud ansible_ssh_host=192.168.56.20
Enter fullscreen mode Exit fullscreen mode

También la configuracion del haproxy:

global
    daemon
    maxconn 256

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http-in
    bind *:80
    mode http
    default_backend servers

backend servers
    server server1 nextcloud:80 maxconn 32
Enter fullscreen mode Exit fullscreen mode

Y por último el playbook:

---
- hosts: all
  become: true
  become_method: sudo

  vars:
    nextcloud_trusted_domains: 192.168.56.20
    nextcloud_ports: []
    haproxy_cfg_template_path: "{{ playbook_dir }}/"
    haproxy_links:
      - nextcloud
    haproxy_ports:
      - 80:80

  roles:
    - { role: nextcloud, tags: [ 'nextcloud' ] }
    - { role: haproxy, tags: [ 'haproxy' ] }
Enter fullscreen mode Exit fullscreen mode

Y con esto tendríamos todo, al aplicar el playbook y entrar en la url http://192.168.56.20/ podremos ver nuestro nextcloud instalado.

El usuario y contraseña por defecto son admin / admin.

Nextcloud welcome

Podéis ver la configuración de mi propio servidor en github.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up