0

noob here.

recently I was working on the Raspberry Pi 4 project which includes installing the following:

  • Nextcloud (not Nextcloudpi)
  • Pi-Hole
  • MariaDB
  • Docker
  • Pontainer

I wanted the just Nextcloud to be reachable from the internet. Everything else shall be kept local.

What I have:

  • A Raspberry Pi 4 which is operating on Raspbian Os 64x with desktop. (Needed for the Collabora office to operate properly in Nextcloud)

  • An Argon one casing with m.2 SSD connected to it with a mount point /mnt/ssd and added to the /etc/fstab.

  • Free domain on DDNSS.de example.ddnss.de which supports subdomain with wildcard.

  • Router Netgear R7500-Nighthawk X4 AC2350 which support DynamicDns but sadly enough only noip which in its turn doesn't support wildcard unless you have a paid membership. Thus, I am forced to use ddclient.

  • On the router the Raspberry has a static IP and the port forwarding settings are set properly [ip-raspeberr]80:80, [ip-raspeberr]443:443.

  • For SSL the cerbot is installed.


Current work:

I kind of understand the Problem that this imposes with the ports and that two services cannot access the same port.

Thus, after some research I stumbled on this Answer of this post. (credit goes to @ecas develop).

Now the docker-compose.yml file looks like this:

version: '3.6'
services:
  nextcloud:
    volumes:
    - ./volumes/nextcloud/html:/var/www/html

    image: nextcloud
    container_name: nextcloud
    ports:
    - "9321:80"
    restart: unless-stopped
    depends_on:
    - nextcloud_db
    links:
    - nextcloud_db
    networks:
    - iotstack_nw
    - nextcloud_internal
    environment:
    - MYSQL_HOST=nextcloud_db
    - MYSQL_PASSWORD=mySQL_password
    - MYSQL_DATABASE=nextcloud
    - MYSQL_USER=nextcloud

  nextcloud_db:
    environment:
    - MYSQL_ROOT_PASSWORD=root_password
    - MYSQL_PASSWORD=mySQL_password
    - MYSQL_DATABASE=nextcloud
    - MYSQL_USER=nextcloud

    image: linuxserver/mariadb
    container_name: nextcloud_db
    volumes:
    - ./volumes/nextcloud/db:/config
    restart: unless-stopped
    networks:
    - nextcloud_internal

  mariadb:
    environment:
    - MYSQL_ROOT_PASSWORD=root_password
    - MYSQL_PASSWORD=mySQL_password
    - MYSQL_DATABASE=nextcloud
    - MYSQL_USER=nextcloud
    image: linuxserver/mariadb
    container_name: mariadb
    volumes:
    - ./volumes/mariadb/config:/config
    ports:
    - "3306:3306"
    restart: unless-stopped
    networks:
    - iotstack_nw
  portainer-ce:
    container_name: portainer-ce
    image: portainer/portainer-ce
    restart: unless-stopped
    ports:
    - "8000:8000"
    - "9000:9000"
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - ./volumes/portainer-ce/data:/data
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    restart: unless-stopped
    ports:
    - "5053:53/udp"
    - "5053:53/tcp"
    - "9322:80"
    - "8443:443"
    environment:
    - TZ:America/Chicago
    volumes:
    - ./etc-pihole/:/etc/pihole/
    - ./etc-dnsmasq.d/:/etc/dnsmasq.d/
    dns:
    - 127.0.0.1
    - 1.1.1.1
  apacheserver:
    container_name: apache
    image: httpd:2.4
    restart: unless-stopped
    ports:
    - "9320:80"
    - "9443:443"
    volumes:
    - ./volumes/apache/:/usr/local/apache2/htdocs

networks:
  iotstack_nw: # Exposed by your host.
    # external: true
    name: IOTstack_Net
    driver: bridge
    ipam:
      driver: default
      config:
      - subnet: 10.77.60.0/24
        # - gateway: 10.77.60.1

  iotstack_nw_internal: # For interservice communication. No access to outside
    name: IOTstack_Net_Internal
    driver: bridge
    internal: true
    ipam:
      driver: default
      config:
      - subnet: 10.77.76.0/24
        # - gateway: 10.77.76.1 
  nextcloud_internal: # Network for NextCloud service
    name: IOTstack_NextCloud
    driver: bridge
    internal: true

  # default:
  #   external: true
  #   name: iotstack_nw

  # hosts_nw:
  #   driver: hosts

Now everything works locally.

Well the problems in my case:

  • It seems to me that the main problem with that solution is that I am not able to get everything connected with ddclient, example.ddnss.de and the cerbot.
  • Plus how to set the Nextcloud to store data on the /mnt/ssd on a path outside the docker is still unknown to me.
  • force HTTPS/ redirect each HTTP request into HTTPS.

Any detailed help would be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.