Tag: Mariadb

  • 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.