visiblevc / wordpress-starter

A slightly less shitty wordpress development workflow
688 stars 167 forks source link

Integrate into an exsisting project #155

Closed danyeah closed 5 years ago

danyeah commented 5 years ago

Hello, thanks for this project, I'm trying to integrate it in my team workflow, i wanted to provide a development server in each of our project repository, so any team member can docker-compose up in the repo and have a server up and running.

I've successfully tried your example and it works, and i can point it in one of my project directory, but as soon as i try to port all the necessary files, docker fails me.

Overview

version: "3"
services:
    wordpress:
        image: visiblevc/wordpress

        # required for mounting bindfs
        cap_add:
            - SYS_ADMIN
        devices:
            - /dev/fuse
        # required on certain cloud hosts
        security_opt:
            - apparmor:unconfined

        ports:
            - 8080:80
            - 443:443
        volumes:
            - ./data:/data
            - ./docker-scripts:/docker-entrypoint-initwp.d
            - ./wp-content/uploads:/app/wp-content/uploads
            - ./wp-content/themes:/app/wp-content/themes
        environment:
            DB_NAME: wordpress
            DB_PASS: root
            URL_REPLACE: http://localhost:8080
            DB_PREFIX: autobase_
            # THEMES: [ground]https://github.com/fabioquarantini/ground/archive/feature/1.0.zip
            PLUGINS: >-
                contact-form-7
                wpcf7-redirect
                regenerate-thumbnails
                duplicate-post
                [ACF-PRO]https://connect.advancedcustomfields.com/index.php?a=download&p=pro
                [WP-API]https://github.com/WP-API/WP-API/archive/master.zip

    db:
        image: mariadb:10 
        volumes:
            - data:/var/lib/mysql
        environment:
            MYSQL_ROOT_PASSWORD: root

    phpmyadmin:
        image: phpmyadmin/phpmyadmin
        ports:
            - 22222:80

volumes:
    data:

Project structure

This is my project repo, i copied DockerFile, run.sh and docker-compose.yml into my root and i did docker-compose up


/data
  /database.sql
mysite.com
  /wp-content
    /uploads
    /themes
      /my-theme
/scripts
/init.sh
/DockerFile
/docker-compose.yml
/run.sh
/.htaccess
/wp-config.php
/.gitignore

docker-compose up output

wordpress_1   | ==> Waiting for MySQL to initialize...
wordpress_1   | ==> Configuring WordPress
wordpress_1   |          ERROR 1130 (HY000): Host '172.21.0.4' is not allowed to
wordpress_1   |          connect to this MariaDB server
wordpress_1   | ==> Checking database
wordpress_1   |   Error: 'wp-config.php' not found.
wordpress_1   |          Either create one manually or use `wp config create`.
wordpress_1   |   Error: 'wp-config.php' not found.
wordpress_1   |          Either create one manually or use `wp config create`.
wordpress_1   | ==> Checking themes
wordpress_1   | Error: 'wp-config.php' not found.
wordpress_1   | Either create one manually or use `wp config create`.
wordpress_1   | Error: 'wp-config.php' not found.
wordpress_1   | Either create one manually or use `wp config create`.
wordpress_1   |   Error: 'wp-config.php' not found.
wordpress_1   |          Either create one manually or use `wp config create`.
wordpress_1   | ==> Checking plugins
wordpress_1   | Error: 'wp-config.php' not found.
wordpress_1   | Either create one manually or use `wp config create`.
wordpress_1   | Error: 'wp-config.php' not found.
wordpress_1   | Either create one manually or use `wp config create`.
wordpress_1   |   Error: 'wp-config.php' not found.
wordpress_1   |          Either create one manually or use `wp config create`.
wordpress_1   | Error: 'wp-config.php' not found.
wordpress_1   | Either create one manually or use `wp config create`.
wordpress_1   | ==> Finalizing
wordpress_1   |   Error: 'wp-config.php' not found.
wordpress_1   |          Either create one manually or use `wp config create`.
wordpress_1   | ==> Executing user init scripts

It seems like it can't execute run.sh, but im not sure, what am i missing?

dsifford commented 5 years ago

Looks like your volume mappings are incorrect. Specifically, it looks like you're missing mysite.com (instead of wp-content/themes it should be mysite.com/wp-content/themes.

Also, you don't need to copy the dockerfile and run.sh file into your project. Docker compose pulls that in the image from dockerhub.

danyeah commented 5 years ago

Thanks a lot it works now.