---
title: Installazione del server di Campiaperti
sidebar: mydoc_sidebar
summary: "Installazione di una macchina per i dati della comunità - server"
permalink: mydoc_server.html
folder: mydoc
---

Seguito il tutorial [https://linuxize.com/post/how-to-install-and-use-docker-compose-on-debian-9/](https://linuxize.com/post/how-to-install-and-use-docker-compose-on-debian-9/)

## installato docker

[https://docs.docker.com/install/linux/docker-ce/debian/#install-using-the-repository](tutorial seguito)

installato dipendenze, aggiunto repository di docker, aggiunto chiave GPG di docker, scaricato e aggiornato i repo, quindi installato docker sull server.

        apt-get update

	apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg2 \
    software-properties-common

	curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -

	sudo apt-key fingerprint 0EBFCD88

confrontare le fingerprint: 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

	add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/debian \
   $(lsb_release -cs) \
   stable"

	apt update

	apt install docker-ce

## Installare docker-compose

[https://linuxize.com/post/how-to-install-and-use-docker-compose-on-debian-9/](https://linuxize.com/post/how-to-install-and-use-docker-compose-on-debian-9/)


Verificare che davvero docker stia andando:

	systemctl start docker
	systemctl enable docker	

Installiamo docker-compose su debian 9

<pre>
curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-comp$

docker-ce -v

chmod +x /usr/local/bin/docker-compose

ls -l /usr/local/bin/ | grep docker

docker-compose --version

</pre>

Creiamo un network di container che si parlano

	
	docker network create nextcloud_network


Scriviamo il nostro file di configurazioni di docker compose

	nano docker-compose.yml

ATTENZIONE: in questo file alcuni valori sono da cambiare! non abbiamo usato dei nomi di default e le passw non ci sono :)

<pre>version: '3' 

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: nextcloud-proxy
    networks:
      - nextcloud_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./proxy/conf.d:/etc/nginx/conf.d:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - ./proxy/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: unless-stopped
  
  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: nextcloud-letsencrypt
    depends_on:
      - proxy
    networks:
      - nextcloud_network
    volumes:
      - ./proxy/certs:/etc/nginx/certs:rw
      - ./proxy/vhost.d:/etc/nginx/vhost.d:rw
      - ./proxy/html:/usr/share/nginx/html:rw
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped

  db:
    image: mariadb
    container_name: nextcloud-mariadb
    networks:
      - nextcloud_network
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=toor
      - MYSQL_PASSWORD=mysql
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    restart: unless-stopped
  
  app:
    image: nextcloud:latest
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    depends_on:
      - letsencrypt
      - proxy
      - db
    volumes:
      - nextcloud:/var/www/html
      - ./app/config:/var/www/html/config
      - ./app/custom_apps:/var/www/html/custom_apps
      - ./app/data:/var/www/html/data
      - ./app/themes:/var/www/html/themes
      - /etc/localtime:/etc/localtime:ro
    environment:
      - VIRTUAL_HOST=nextcloud.YOUR-DOMAIN
      - LETSENCRYPT_HOST=nextcloud.YOUR-DOMAIN
      - LETSENCRYPT_EMAIL=YOUR-EMAIL
    restart: unless-stopped

volumes:
  nextcloud:
  db:

networks:
  nextcloud_network:
</pre>

Ora facciamo partire il tutto:

	docker-compose up -d

Verifichiamo che funzioni

	docker ps -a
	docker stats

## Personalizzare il thema grafico, esistente di nextcloud

[https://docs.nextcloud.com/server/12/developer_manual/core/theming.html#changing-the-default-colours](https://docs.nextcloud.com/server/12/developer_manual/core/theming.html)

Quindi davvero ci copiamo doppia la cartella del thema

	nano dispensatheme/core/css/server.css

Per ora l'unica cosa diversa è il logo! che è stato caricato nella cartella del tema dentro a core/img


{% include links.html %}
