pygmystack / pygmy

the pygmy stack is a container stack for local development
MIT License
25 stars 13 forks source link

provide example configuration for a system-wide phpmyadmin container #56

Closed tobybellwood closed 4 years ago

tobybellwood commented 4 years ago

A lot of users are familiar with using phpmyadmin to administer/examine their local databases. There is a phpmyadmin docker image (https://hub.docker.com/r/phpmyadmin/phpmyadmin/) that we could base off.

Looks like there is a way to start it without specifying a server to connect to, but specify a connection via the UI - it might require a bit of docco, but would be good to provide guidance.

fubarhouse commented 4 years ago

If you can provide a POC command to do the job I can make this work. Alternatively make it work and send me the output of docker container inspect amazeeio-phpmyadmin (or the container name you give it).

In the meantime, the following works but doesn't connect to a server, so this definitely needs work:

services:
  amazeeio-phpmyadmin:
    Name: amazeeio-phpmyadmin
    Config:
      Image: phpmyadmin/phpmyadmin
      Env:
        - "PMA_ARBITRARY=1"
    HostConfig:
      PortBindings:
        80/tcp:
          -
            HostPort: 8080

networks:
  amazeeio-network:
    - amazeeio-haproxy
    - amazeeio-phpmyadmin
tobybellwood commented 4 years ago

so - what I got to work was providing the env PMA_ARBITRARY=1 to phpmyadmin - how do we specify that in the config above?

on the login screen you then get the option to specify a server - you can use the bridge gateway IP address, and the port of the MySQL/mariadb image you need to connect to. image

fubarhouse commented 4 years ago

I've just updated my example to include:

      Env:
        - "PMA_ARBITRARY=1"

Testing shows it works as expected, let me know 🙂

tobybellwood commented 4 years ago

perfect - It's awesome being able to do this!

fubarhouse commented 4 years ago

Note that networks have changed given #88:

Networks:
  amazeeio-network:
    Config:
      IPAM:
        Config:
        - Gateway: 10.99.99.1
          Subnet: 10.99.99.0/24
    Containers:
    - amazeeio-haproxy
    - amazeeio-phpmyadmin
    Name: amazeeio-network
fubarhouse commented 4 years ago

Improvements and compatibility with master after #123 is merged - this will be compatible with v0.2.

services:
  amazeeio-phpmyadmin:
    Config:
      Image: phpmyadmin/phpmyadmin
      Env:
        - "AMAZEEIO=AMAZEEIO"
        - "AMAZEEIO_URL=phpmyadmin.docker.amazee.io"
        - "AMAZEEIO_HTTP_PORT=80"
        - "PMA_ARBITRARY=1"
      Labels:
        - pygmy: pygmy
        - pygmy.enable: true
        - pygmy.name: amazeeio-phpmyadmin
        - pygmy.weight: 20
        - pygmy.url: http://phpmyadmin.docker.amazee.io
    HostConfig:
      PortBindings:
        80/tcp:
          - HostPort: 8080

networks:
  amazeeio-network:
    Containers:
      amazeeio-phpmyadmin: 
        Name: amazeeio-phpmyadmin