welaika / docker-wordmove

Docker image to run Wordmove
https://hub.docker.com/r/welaika/wordmove/
16 stars 9 forks source link

PHP 7 image does not read volumes #11

Closed AndreaBarghigiani closed 5 years ago

AndreaBarghigiani commented 5 years ago

Hi all, recently we've discussed in #10 that in order to use this image with WordPress 5.2 we need to pull the welaika/wordmove:php7 image.

The problem is that if I use this image when I get into it I will be logged in the /html folder.

I am using this script to jump start the building of my dev environment (on my machine I've edited it to use the :php7 tag) and in it I have my volumes declared like this:

volumes:
      - ./public:/home/wordmove
      - ./public:/var/www/html
      - ~/.ssh:/home/wordmove/.ssh

With the :php7 tag I've lost this connection and I am not able to connect via SSH to my servers. Here's the error message:

The authenticity of host '[xxx.xxx.xxx.xxx]:xxx ([xxx.xxx.xxx.xxx]:xxx)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[xxx.xxx.xxx.xxx]:xxx' (ECDSA) to the list of known hosts.
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(235) [Receiver=3.1.2]

This thing does not happen when I try to connect to the same server from a container that's running the old (stable) version of WordMove.

I am sorry to keep asking for help but I do not know where and how fix this issue.

Thank you all for the future help!

alessandro-fazzi commented 5 years ago

Hey @AndreaBarghigiani ,

your help in identifying problems is absolutely helpful. Thank you.

the short answer is: update your config to

volumes:
      - ./public:/html
      - ~/.ssh:/root/.ssh

I can't get why you had doubled mount of ./public folder, so in my snippet I got rid of it.

The long answer is:

docker run -it --rm -v ~/.ssh:/home/wordmove/.ssh:ro welaika/wordmove

to this

docker run -it --rm -v ~/.ssh:/root/.ssh:ro welaika/wordmove

my fault.


If you could test the proposed configuration and if it would work, I'll proceed to write down more info in the README's "Usage" section.

Please let me know and thanks again for your time and patience.

AndreaBarghigiani commented 5 years ago

Thank you @pioneerskies for your help, your advices resolved my problem. Now I am able tu push/pull to my server and I am ready to properly work!

I can't get why you had doubled mount of ./public folder, so in my snippet I got rid of it.

Actually I do not know either because I am usign the wp-docker script and that is the default setting. I will fork the project and propose a PR.

Anyway I would like to let you know that I do not use your snippet because I am running a docker-container command. The wp-docker creates several containers with the project folder name as a starter.

For example the container running WordPress is foldername_wordpress_1, the one with phpMyAdmin is foldername_phpmyadmin_1 and so on...

To connect to the container with WordMove I type: docker exec -it foldername_wordmove_1 /bin/bash

I don't know if this is the best way or if I can use it because I am running inside a docker-container environment, in #10 I told you that I do not properly know what I am doing 😅, but it works.

Reading this I understand that with run you create and access to the container instead exec is used to run a command (that in this case is the bash) inside a container.

Do I need to know something more related to WordMove? I am asking just to improve my knowledge 😉

alessandro-fazzi commented 5 years ago

:)

I'm glad it worked. I'll update the readme even if it's not useful for you. The readme of a docker container is absolutely generic; the actual usage you will do with it is totally up to you ;)

I don't know what wp-docker is, but as far as I can understand it's using docker-compose to up en entire stack of containers. In that scenario (containers already running in background) using exec sounds totally good to me.

Since in this container /bin/bash is the ENTRYPOINT directive you could also do something like

docker exec container_name wordmove push -t

but it's just for the sake of science I'm pointing that out :P

Do you feel like we could close this issue? Have you tried the shiny new :alpine version of this container (⚠️ advertising!!! ⚠️ ) ?

Have a nice evening

AndreaBarghigiani commented 5 years ago

Hi @pioneerskies, wp-docker is a simple bash script that creates and environment with Docker containers. We wrote about it in our (italian) website and I use since then.

Thanks for the shortcut, I am sure I'll use a lot your command 😉

I do not have tryed the :alpine version yet because I am afraid to mess things up. Do you advice it for the small size or there is anything else that I need to be aware of?

Thank you again for all the help man, really apprecciated!

I've wrote and article about WordMove and I am planning to release a course to teach how to create a WordPress development workflow where I surely mention WordMove!

alessandro-fazzi commented 5 years ago

@AndreaBarghigiani :alpine is simply almost 1/3 of the :php7 image. Being this one a single command scoped container, there's nothing else to be aware of. You should feel free to simply use it as a drop-in replacement :)

As soon as I can I'll update the latest tag to the php7 one. I hope other projects maintainers will read the new README and will update their default config or will choose to switch to a tagged image and not to the latest one.

Cheers and thanks for helping us.

AndreaBarghigiani commented 5 years ago

Hi @pioneerskies, thanks for the explanation!

I am commenting also because I have a strange problem, I am not able to use the /html forlder 😞

The docker-compose.yml configuration that is working for me is like the following:

services:
  mariadb:
    image: mariadb
    ports:
      - "8081:3306"
    environment:
      ...
  wordpress:
    image: wordpress:latest
    volumes:
      - ./public:/var/www/html
    ports:
      - "8080:80"
    links:
      - mariadb:mysql
    environment:
      ...
    links:
      - mariadb:mysql
    environment:
      ...
  wordmove:
    tty: true
    depends_on:
      - wordpress
    links:
      - mariadb:mysql
    image: welaika/wordmove:php7
    volumes:
      - ./public:/var/www/html
      - ~/.ssh:/root/.ssh

If I change the volume of WordMove for ./public to /html when I run the commands it looks like everithyng runs smootly but when I try to see the website I get a blank screen.

Even if I change the ./public volume for WordPress and use the /html I am not able to see the website as well. I know this is probably an issue with the web server but I am in the middle of a project with straight deadline so I do not have much time to deal with it.

The workaround I found right now is to leave the ./public volume for WordMove with the same path of the WordPress container and I can sync my local environment with the production one without problems.

The only thing is that each time I enter in the WordMove container I have to cd /var/www/html. Can I change the entry point when I run docker exec? Or do you have any idea on how to solve this issue?

Thank you so much for your time and your help man, really apprecciated!

Sorry if I am writing on a closed issue, if you prefer I can open a new one.

All the best, Andrea

alessandro-fazzi commented 5 years ago

Hey no problem at all.

AFAIK

wordpress:
    volumes:
      - ./public:/var/www/html

wordmove:
    volumes:
      - ./public:/html

should just work. I can't see the point about changing the volume in wordmove container and getting blank page when connecting to wordpress container. It sounds really weird to me.

That said...as a last chance you could override the entrypoint in the docker-compse.yml following this doc. But it is a workaround for me and you should let every container work as it is intended to do...

P.S.: under wordpress image you've doubled the links key ;)

AndreaBarghigiani commented 5 years ago

I'll run some tests and let you know how it goes. Thanks again!

AndreaBarghigiani commented 5 years ago

I know that this is strange but I've noticed that if I use /html some folder are missing, for example the /uploads one.

If I run ls wp-content/ inside the wordmove container at /html I get:

root@a79da921f4c9:/html# ls wp-content/
index.php 
plugins
themes

Instead if I run ls /var/www/html/wp-content/, always inside wordmove container, this is what I get:

root@a79da921f4c9:/html# ls /var/www/html/wp-content/
languages/                      
local-backup-1559114083.sql.gz  
plugins/                        
themes/                         
uploads/

And this happen on a fresh install.

I am sure that I am using something wrong here, maybe is during the installation of the script I mentioned before but I really do not understand why this is happening.

💡Idea: Maybe I have to update the wordpress_path inside my movefile.yml from "/var/www/html" to just /html?

PS: about the double link I've removed the phpMyAdmin section and forgot to remove links as well 😊

PPS: if you check the script that I use to configure Docker I've edited the WordMove path in my local environment but not (yet) in the script on GitHub 😉

alessandro-fazzi commented 5 years ago

I do not know if you're running ls after/before a specific wordmove's command there...

About what to write as path into the movefile.yml, I had that problem in mind and adopted a solution that I've documented in the README @ https://github.com/welaika/docker-wordmove#env

Let me know if that helps and if it seems a nice and practical approach to you

AndreaBarghigiani commented 5 years ago

You're great!

The problem was the wordpress_path, sorry to have you work on this silly issue and thank you to point me to the right line in the README.md (I didn't see it).

Anyway to give you some context about the ls command I ran both of them after a wordmove pull. I was inside the container because I use

docker exec -it container_name /bin/bash

but with your solution now I can also run

docker exec container_name wordmove push -t

Thank you a lot man to help me out with it!

alessandro-fazzi commented 5 years ago

WoW. I'm really glad it worked. I hope you'll have the opportunity to update your script with new default, since now I'll plan to update the latest ASAP :)

You are always welcome back for firther help. Best luck with your course.

Cheers! 🎉