vccw-team/vccw

phpmyadmin

Opened this issue ยท 4 comments

Operating System: Windows
Vagrant Version: Vagrant 2.0.3
Virtual Box Version: Versie 5.2.8 r121009

First of all, I love this ๐Ÿ‘ . But I was wondering if it is possible to install phpmyadmin.
When you change the site.yml

Hi dseegers, you could download phpMyAdmin from its own website (https://www.phpmyadmin.net/) and place it in a separate folder in the wordpress folder (eg. named phpMyAdmin). After that you can access it from the url as vccw.test/phpMyAdmin/index.php

Hey Folks,
I am running vccw and vagrant box on my mac. What would be involved in having one myphpmyadmin directory for all my vagrant sites instead of copying the whole phpmyadmin folder over to each wordpress folder. Any insight/links/suggestions is greatly appreciated

There is a built-in way to add a post-provision step and you can place Ansible instructions to install PhpMyAdmin there. Simply create a playbook-post.yml next to Vagrantfile with these contents:

- hosts: all
  become: yes

  tasks:
    - name: Update apt cache
      apt: update_cache=yes            
    - name: debconf for PhpMyAdmin
      debconf: name=phpmyadmin question='phpmyadmin/dbconfig-install' value='true' vtype='boolean'
    
    - name: debconf for PhpMyAdmin
      debconf: name=phpmyadmin question='phpmyadmin/app-password-confirm' value='{{ vccw.db_pass }}' vtype='password'
    
    - name: debconf for PhpMyAdmin
      debconf: name=phpmyadmin question='phpmyadmin/mysql/admin-pass' value='{{ vccw.db_pass }}' vtype='password'
    
    - name: debconf for PhpMyAdmin
      debconf: name=phpmyadmin question='phpmyadmin/mysql/app-pass' value='{{ vccw.db_pass }}' vtype='password'
    
    - name: debconf for PhpMyAdmin
      debconf: name=phpmyadmin question='phpmyadmin/reconfigure-webserver' value='' vtype='multiselect'
    
    - name: install PhpMyAdmin
      apt: pkg=phpmyadmin state=present
    
    - name: Create apache conf link 
      file:
        src: "/etc/phpmyadmin/apache.conf"
        dest: "/etc/apache2/sites-available/phpmyadmin.conf"
        state: link
    - name: Create apache conf link 
      file:
        src: "/etc/phpmyadmin/apache.conf"
        dest: "/etc/apache2/sites-enabled/phpmyadmin.conf"
        state: link

    - name: configure site
      file: path=/var/www/phpmyadmin src=/usr/share/phpmyadmin state=link

    - name: restart apache
      become: yes
      service: name=apache2 state=restarted

After that, you need to re-provision your instance or re-create it. Either way, you need to run vagrant provision

An alternative to this would be to do vagrant ssh and install phpmyadmin via APT: sudo apt-get update && sudo apt-get install -y phpmyadmin. Disadvantage to this would be that if you ever destroy your VM or delete it or lose it in some way, phpmyadmin won't install when you re-create it via vagrant up.

PhpMyAdmin will be available at /phpmyadmin. Your access credentials are identical to those specified in your wp-config.php or in site.yml (db_name and db_pass)

This install is global to the machine, so no copies to each Wordpress folder are required (note @PDM2020).

Hope this helps someone.