No internet connection
  1. Home
  2. Support

How to use with a Docker compose setup?

By Leon Stafford @leonstafford2018-12-17 08:03:24.151Z

With a Docker compose file like below, how should I setup my export options?

version: '3.3'

     image: mysql:5.7
       - db_data:/var/lib/mysql
     restart: always
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress

       - db
     image: wordpress:latest
       - "8000:80"
     restart: always
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
  • 6 replies
  1. G
    Guillaume Moigneu @gmoigneu2019-02-20 10:48:11.876Z

    Thank you for this answer.

    However it would be more efficient to be able to define the base url that the crawler should use. The same way you are doing this with the port.

    That way we could use whatever address we want to access WP and use https://wordpress as the crawler target.

    This will be useful when your nginx container is not the same as the php one:

          image: phpdockerio/nginx:latest
          container_name: bma-webserver
          working_dir: /application
              - .:/application
              - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
           - "1025:80"
           - php-fpm
            context: .
            dockerfile: phpdocker/php-fpm/Dockerfile
          container_name: bma-php-fpm
          working_dir: /application
            - .:/application
            - ./phpdocker/php-fpm/php-ini-overrides.ini:/etc/php5/fpm/conf.d/99-overrides.ini

    I'll try to work on a PR if that's ok for you.

    1. Leon Stafford @leonstafford2019-02-23 16:10:03.473Z

      Hi @gmoigneu,

      Sorry for the late response. Great idea. I've started sketching out a simpler way for the plugin to work.

      If it's a small PR, by all means, I'd be super happy to receive it. At the moment, we're about to restructure quite a bit for version 7. If you can base your work off of the develop branch and get it working, even if we diverge, I can re-apply if it gets messy.

      There's quite a bit of "why does it do it like that?" in the plugin code at the moment, if you don't mind adventuring through that and manage to get a PR in, bon chance!



    2. In reply toleonstafford:
      Leon Stafford @leonstafford2018-12-17 08:09:37.801Z

      After running docker compose up, completing the WP setup and installing the WP2Static plugin, the following settings have been tested to work fine without any other configuration needed:

      Depending on your site's theme, post and page URLs, you may need to adjust your Permalinks as below to get things working. This is an issue which should be resolved in a future version.

      1. C
        In reply toleonstafford:
        @CoyoteKG2019-05-28 22:03:04.566Z

        Hello, I'm trying also to setup it in docker, but it not works, and I don't know how to troubleshot it.
        Here are my docker-compose.txt (1.17 kB) and my Dockerfile.txt (935 B)

        I tried to export like zip, and in subdirectories. If I do that from admin panel I'm not getting any error. Like everything is OK and links to zip or site.
        I tried to do that with wp-cli and in case of subdirectory setup this it looks like it is done

        [root@52d7cbd0c785 html]# wp wp2static generate
        Success: Generated static site archive in 208.961487 seconds

        Folder is there, but it's empty.

        I changed to zip and generated again, and I have warning, but I got this warning, and status "Success".

        [root@52d7cbd0c785 html]# wp wp2static generate
        PHP Warning: rename(/var/www/html/wp-content/uploads/wp-static-html-output-1559077603.tmp,/var/www/html/wp-content/uploads/ No such file or directory in /var/www/html/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/ArchiveProcessor.php on line 2
        Warning: rename(/var/www/html/wp-content/uploads/wp-static-html-output-1559077603.tmp,/var/www/html/wp-content/uploads/ No such file or directory in /var/www/html/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/ArchiveProcessor.php on line 2
        Success: Generated static site archive in 208.977974 seconds

        Can you direct me how to troubleshoot this problem?

        1. R
          In reply toleonstafford:
          Russell @rfair2019-11-14 23:21:26.864Z

          Having similar problems. Local docker container is running fine. No matter what I do, I can't seem to get it to crawl or generate the zip

          1. Leon Stafford @leonstafford2019-11-15 03:04:49.667Z

            One way to test, is to ssh into your docker container (bit rusty, but something like docker exec -it container_id /bin/sh) and check that the container can access WordPress on it's URL (curl or wget may need to be installed first within the container). Adding your WordPress Site URL as an entry in the container's /etc/hosts may help to resolve.