Tag: Docker

  • How to Set up Nextcloud with Richard Applegate Repo with Portainer?

    So easy, I recommend you guy to do use Repo and then enjoy the services you use.

    1. Open my git repo Nextcloud to copy all the environment variables, or you will get an error.
    2. Go to your Portainer site, then go to create stack.
    3. click git repo, and copy and paste my Nextcloud repo, https://gitlab.richardapplegate.io/docker/nextcloud.git
    4. Scroll Down until Environments variables and paste all environment variables
    5. Start the services and go check your Nextcloud http://yourIP:Port
    6. If you want proxy Services Coming soon for tutorial.

  • How to build a Dockerfile on Windows 10?

    Step-by-step Instructions:

    1. Open Visual Studio, and open the folder where your Dockerfile is. Open Visual Studio, and open the folder where your Dockerfile is.
    2. Click Settings bottom then click Extension.
    3. Please install the extension ‘Docker’.
    4. After you install, go ahead and change the Dockerfile. After you finish, save it.
    5. Go to the left side where the file manager is. Go to Dockerfile, highlight it on your mouse, right click, then click build with Docker.
    6. then open cmd.exe to docker login and docker push
    7. Please fill out your username and password for the docker login.
    8. If you then command this ‘docker push username/imagename:tag’, then your image will now be on the Docker Hub.
  • DNS amplification attack | closing the 53 port on my AdGuard Home Server.

    Today, I turned off the DNS port 53. Since we have been cutting off our store’s DNS server, it has been a DNS amplification attack. So I found out that my Router does have a DNS Proxy, My DNS Server does have HTTP over TLS and DNS-over-HTTPS. Everything is working and attacking is currently stopped after I set up 853 port encryptions and disable Plain DNS. I also want to keep my stores safe.

    Disable Plain DNS and DNS over TLS is 853.

    My router has a DNS Proxy option, so I added my DNS IP Server,

    Then I have gone to Wired Networks → LAN, then go to Admin

    If you change DNS Server to your DNS, please change to Auto So DNS Proxy to do the job.

    Now we have an encrypted DNS over TLS.

  • How to set up MariaDB with Portainer Stacks +(Docker-compose)

    We’re using MariaDB for our business because it’s meant for big business, and it’s my favorite database to use for small businesses. And I have a lot of skill experience with MariaDB than any other database, but few other databases are lacking in my experience. Therefore, I do not have sufficient time to undertake these experiences. After I document all my notes and work for sure, I will study these (MongoDB, PostgreSQL) I use some on app after I document all my notes and work for sure. I will study these after I document all my notes and work for sure. Which is a pain for me, but I got the app working and stable. So let get start to Tutorial for MariaDB.

    Please ensure that you complete this first. Before starting build this,

    How to set up Portainer with nginx Proxy Manager

    We need to create a network for the MariaDB database for another app to communicate. We prefer to refrain from exposing our port.

    docker network create mariadb

    Now we can begin to create details for the MariaDB Database on Portainer.

     version: '2'
    services:
      mariadb:
        container_name: mariadb
        networks:
          - mariadb
        image: mariadb
        command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
        restart: always
        environment:
          - MYSQL_ROOT_PASSWORD=yourownpassword
          - MARIADB_AUTO_UPGRADE=1
          - MARIADB_DISABLE_UPGRADE_BACKUP=1
        volumes:
          - /mnt/nasdrive/mariadb/:/var/lib/mysql
    networks:
      mariadb:
        external: true

    Then you deploy the stacks. Your app will then be operational. Thereafter, you can easily add PhpMyAdmin to this docker-compose. But I like stacks because we can use the same app for many server databases.

    OPTIONAL BONUS for PhpMyAdmin How to set up.

  • How to set up PhpMyAdmin with MariaDB on Portainer with NGINX Proxy Manger.

    PhpMyAdmin is easy to set up for any app and fix the table database or troubleshoot. So, we will set up PhpMyAdmin with NGINX SSL secure for our HTTPS. Due to the possibility of a grabber username and password exploit, we would prefer not to expose this on HTTP.

    Please ensure that you complete this first. Before starting, we should make sure that this tutorial prevents hacking and exposes our port to the public. We do not want that to happen. We only want 80 and 443 to be open.

    How to set up Portainer with nginx Proxy Manager

    After you complete Portainer and nginx, we are good to go to build this app with nginx and PhpMyAdmin.

    Open Portainer → Stacks→ create stacks

    version: '3'
    services:
      pma:
        networks:
          - nginx
          - mariadb
        image: phpmyadmin/phpmyadmin
        container_name: pma
        environment:
          PMA_ARBITRARY: 1
        restart: always
        #ports:
         # - 8081:80
    networks:
      nginx:
        external: true
      mariadb:
        external: true

    I put hashtags on ports and port numbers because we don’t need them. We’ll just use nginx network on this app. Nginx proxy can talk to PhpMyAdmin instead of port or public. It is more secure to build our app before it is published to the public. Your sites can be injected with any insecure port.

    After deploying the stacks, your PhpMyAdmin is now online, but it won’t show up on the site because you didn’t set up the nginx proxy info. That would be our next step.

    You should open the nginx proxy manager for your site. My will be nginx__.richardapplegate.io.

    Thereafter, you’ll need to access your admin account. Add proxy host, then fill this detail.

    I configured the PMA to forward hostname/IP as a result of setting docker-compose on the PhpMyAdmin container_name to the PMA. And this app uses 80 ports on the NGINX network.
    Make sure you enable SSL and HTTP/2 and HSTS.

    Now you may be able to open your site with a domain without port. My will be phpmyadmin.richardapplegate.io. and working!

    Server: your database container_name on docker-compose. Mine is mariadatabase
    Username: your primary account for all database control. Mine is root.
    Password: you create the password and the password should on your docker-compose. You won’t be possible to log in my PhpMyAdmin because 3 times incorrect information, then you will be banned. You won’t access from my server or see my sites anymore for 1 week.

    You’re in the MariaDB database.

    “SSL is not being used” is normal because itself PhpMyAdmin is not on public, it is on nginx proxy manager. So, PhpMyAdmin is not public, it is full secured under the nginx. And you can see that we can create databases or tables or control user accounts.
  • How to set up agent edge on multiserver

    Docker-compose is my go-to for secondary or distributed servers. It’s better than docker run because it’s more clean and organized and easier to set up. And one time, too.

    So all you need to do is make sure the Secondary Server or Multiserver needs to install Docker and Docker Compose. Please follow this step by step.

    Install Docker Engine on Ubuntu | Docker Documentation

    Now that we have created the docker-compose files, we can create them where you want them to be saved. The secondary server has not yet set up Portainer, so this tutorial is for using SSH instead of Portainer. The docker compose will do the job, and our primary server will attach secondary from an outside server. This is cool, no need to use a port or anything else.

    Open the Portainer site on the primary server, then go to environment, add environment, Docker standalone, start wizard, and edge agent standard. Write down your edge ID and key in this way.

    You should see Edge ID and Edge Key on the primary Portainer site.

    Please ensure that you obtain the Edge ID and Edge Key. Make sure to change your volume path and change your volume path. Look for the highlights below.

    Version: '3.9'
    services:
        agent:
            image: 'portainer/agent:2.20.2'
            container_name: portainer_edge_agent
            environment:
                - EDGE_INSECURE_POLL=1
                - EDGE_KEY=
                - EDGE_ID=
                - EDGE=1
            restart: always
            volumes:
                - '/yourpathportainer/data:/data'
                - '/:/host'
                - '/var/lib/docker/volumes:/var/lib/docker/volumes'
                - '/var/run/docker.sock:/var/run/docker.sock'
    

    After deploying the stack, your secondary portainer should be active and should appear on your primary portainer. Look like this:

    Continue to deploy and build Docker Portainer many more servers to benefit the future!

  • Backup and Restore with Docker Compose

    All of my data is on folder drive mounts that where our data is to make backup and restore operations easier. Stopping your stack with docker-compose down will allow you to back up all the files and subfolders in the folder next to the docker-compose.yml file.

    For example, if you want to create a ZIP archive, you can use the following command:

    zip -r myarchive.zip .
    

    To restore from a ZIP archive, please unzip the archive into the original folder using the following command.

    unzip myarchive.zip -d /path/to/original/folder
    

    Once your backup has been completed, you can start your stack again with the following command:

    docker-compose up -d
    

    This is all. With these simple steps, you can easily backup and restore your data volumes with Docker Compose.

  • How to Install Immich(v1.99.0) on Docker Portainer with Nginx Proxy Manager

    This document presents Docker compose version 3.8 for Immich Latest (1.99.0). I just changed the volume to the correct path because I want them to save in our large storage data and permission user so that any users can’t see our file except root.

    I added networks because they’re going to be proxied by Nginx Proxy Manager and own Redis.

    version: "3.8"
    
    services:
      immich-server:
        container_name: immich_server
        image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
        command: [ "start.sh", "immich" ]
        volumes:
          - ${UPLOAD_LOCATION}:/usr/src/app/upload
          - /etc/localtime:/etc/localtime:ro
        env_file:
          - stack.env
        networks:
          - nginx
          - personalphotos
        labels:
          - com.centurylinklabs.watchtower.enable=false
        depends_on:
          - redis
          - database
        restart: always
    
      immich-microservices:
        container_name: immich_microservices
        image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
        command: [ "start.sh", "microservices" ]
        volumes:
          - ${UPLOAD_LOCATION}:/usr/src/app/upload
          - /etc/localtime:/etc/localtime:ro
        env_file:
          - stack.env
        networks:
          - personalphotos
        labels:
          - com.centurylinklabs.watchtower.enable=false
        depends_on:
          - redis
          - database
    
        restart: always
    
      immich-machine-learning:
        container_name: immich_machine_learning
        image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
        volumes:
          - ${MODEL_CACHE}:/cache
        labels:
          - com.centurylinklabs.watchtower.enable=false
        env_file:
          - stack.env
        networks:
          - personalphotos
        restart: always
    
    
      redis:
        container_name: immich_redis
        image: redis:6.2-alpine
        env_file:
          - stack.env
        labels:
          - com.centurylinklabs.watchtower.enable=false
        networks:
          - personalphotos
        restart: always
    
      database:
        container_name: immich_postgres
        image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
        labels:
          - com.centurylinklabs.watchtower.enable=false
        environment:
          POSTGRES_PASSWORD: ${DB_PASSWORD}
          POSTGRES_USER: ${DB_USERNAME}
          POSTGRES_DB: ${DB_DATABASE_NAME}
        networks:
          - personalphotos
        volumes:
          - ${PGDATA}:/var/lib/postgresql/data
    
        restart: always
    networks:
      nginx:
         external: true
      personalphotos:
         external: true
    

    Here is Environment variables

    DB_HOSTNAME=immich_postgres
    DB_USERNAME=postgres
    DB_PASSWORD=postgres
    DB_DATABASE_NAME=immich
    TZ=America/Los_Angeles
    REDIS_HOSTNAME=immich_redis
    UPLOAD_LOCATION=changeyourpath/data
    TYPESENSE_API_KEY=Your own create random letter
    PUBLIC_LOGIN_PAGE_MESSAGE=
    IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
    MODEL_CACHE=/changeyourpath/model_cache
    PGDATA=/changeyourpath/postgresqlbackup
    TSDATA=/changeyourpath/tsdata
  • Mailcow : renew Certification with nginx proxy manager

    Make a file called “scriptmailssl.sh” and open the nano file editor. Paste these codes and save it!

    
    #!/bin/bash
    
    # This script takes the certs generated by Nginx Proxy Manager
    # and copies it to the mailcow docker container.
    # Before use, make sure you update the path to your docker data and locate which cert belongs to mailcow
    
    cp /home/applegater/docker/nginx/letsencrypt/live/npm-7/fullchain.pem /home/applegater/docker/mailu/mailcow-dockerized/data/assets/ssl/my.richardapplegate.io/cert.pem
    cp /home/applegater/docker/nginx/letsencrypt/live/npm-7/privkey.pem /home/applegater/docker/mailu/mailcow-dockerized/data/assets/ssl/my.richardapplegate.io/key.pem
    postfix_c=$(docker ps -qaf name=postfix-mailcow)
    dovecot_c=$(docker ps -qaf name=dovecot-mailcow)
    nginx_c=$(docker ps -qaf name=nginx-mailcow)
    docker restart ${postfix_c} ${dovecot_c} ${nginx_c}
    chmod +x /home/applegater/docker/scriptmailssl.sh
    
    

    Add a cronjob every month.

    crontab -e 
    0 1 * */2 * bash /home/applegater/docker/scriptmailssl.sh >/dev/null 2>&1

    It’s going to do the job for you every month.

  • Nextcloud After Update and get this Error Message. I am Use Portainer, Docker.

    Nextcloud After Update and get this Error Message. I am Use Portainer, Docker.

    Error Message:

    Go to Portainer Web and log in with your admin account. Then select the correct environment server. Then go to Nextcloud Container to enter the console.

    Please make sure you change the user root to www-data, then connect.

    Now you can see that you have a terminal on your webgui and fill out this command line.

    php occ db:add-missing-indices
    Sucess and now Error gone.

    Before:

    After