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'

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

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
volumes:
    db_data:
  • 4 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:

        webserver:
          image: phpdockerio/nginx:latest
          container_name: bma-webserver
          working_dir: /application
          volumes:
              - .:/application
              - ./phpdocker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf
          ports:
           - "1025:80"
          links:
           - php-fpm
    
        php-fpm:
          build:
            context: .
            dockerfile: phpdocker/php-fpm/Dockerfile
          container_name: bma-php-fpm
          working_dir: /application
          volumes:
            - .:/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!

      Cheers,

      Leon

    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/wp-static-html-output-1559077603.zip): 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/wp-static-html-output-1559077603.zip): 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?