PHPStorm + docker + xdebug + db ssh tunnel
up vote
0
down vote
favorite
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has xdebug installed into it, I can easily connect to it from PHPStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PHPStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PHPStorm doesn't see my ssh tunnel?
UPD
I've changed host of clickhouse to docker container and changed php
container definition to the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
Now everything works
docker ssh-tunnel phpstorm xdebug
add a comment |
up vote
0
down vote
favorite
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has xdebug installed into it, I can easily connect to it from PHPStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PHPStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PHPStorm doesn't see my ssh tunnel?
UPD
I've changed host of clickhouse to docker container and changed php
container definition to the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
Now everything works
docker ssh-tunnel phpstorm xdebug
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has xdebug installed into it, I can easily connect to it from PHPStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PHPStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PHPStorm doesn't see my ssh tunnel?
UPD
I've changed host of clickhouse to docker container and changed php
container definition to the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
Now everything works
docker ssh-tunnel phpstorm xdebug
Locally I have following docker-compose configuration:
nginx:
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./../logs:/home/web/logs/
- ./../:/home/web/my-website.com/
depends_on:
- php
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
php
container has xdebug installed into it, I can easily connect to it from PHPStorm.
I have remote ClickHouse database which is connected via SSH Tunnel. When I start my container I just go into my container and execute:
ssh -4 login@host.com -p 2211 -L 8123:localhost:8123 -oStrictHostKeyChecking=no -Nf
After this, my site is able to use this connection, but when I execute console command
./yii analysis/start-charts 003b56fe-db47-11e8-bcc0-52540010e5bc 205
from PHPStorm, I'm getting an exception:
Failed to connect to 127.0.0.1 port 8123: Connection refused
If I jump into the container and launch the same command, everything works fine.
What's wrong? Why PHPStorm doesn't see my ssh tunnel?
UPD
I've changed host of clickhouse to docker container and changed php
container definition to the following:
php:
build:
context: ./php
volumes:
- ./../:/home/web/my-website.com/
working_dir: /home/web/my-website.com/
expose:
- "8123"
ports:
- "8123:8123"
Now everything works
docker ssh-tunnel phpstorm xdebug
docker ssh-tunnel phpstorm xdebug
edited Nov 17 at 9:43
asked Nov 11 at 13:35
Nikita Leshchev
1034
1034
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Your ssh tunnel is created inside your container on the socket 127.0.0.1:8123
. You expose Port 8123 to the Host (maybe you should expose 127.0.0.1:8123). But the actual problem is that you try to Access 127.0.0.1:8123
from your Host machine, whereas you should access <ContainerIP>:8123
.
You could try to change the network_mode use the network_mode: "host"
in your compose file as a solution.
1
Thank you for your answer it helped me. But I have to add that I had to addports
node to the definition ofphp
container. I add this edit to the question
– Nikita Leshchev
Nov 17 at 9:40
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Your ssh tunnel is created inside your container on the socket 127.0.0.1:8123
. You expose Port 8123 to the Host (maybe you should expose 127.0.0.1:8123). But the actual problem is that you try to Access 127.0.0.1:8123
from your Host machine, whereas you should access <ContainerIP>:8123
.
You could try to change the network_mode use the network_mode: "host"
in your compose file as a solution.
1
Thank you for your answer it helped me. But I have to add that I had to addports
node to the definition ofphp
container. I add this edit to the question
– Nikita Leshchev
Nov 17 at 9:40
add a comment |
up vote
1
down vote
accepted
Your ssh tunnel is created inside your container on the socket 127.0.0.1:8123
. You expose Port 8123 to the Host (maybe you should expose 127.0.0.1:8123). But the actual problem is that you try to Access 127.0.0.1:8123
from your Host machine, whereas you should access <ContainerIP>:8123
.
You could try to change the network_mode use the network_mode: "host"
in your compose file as a solution.
1
Thank you for your answer it helped me. But I have to add that I had to addports
node to the definition ofphp
container. I add this edit to the question
– Nikita Leshchev
Nov 17 at 9:40
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Your ssh tunnel is created inside your container on the socket 127.0.0.1:8123
. You expose Port 8123 to the Host (maybe you should expose 127.0.0.1:8123). But the actual problem is that you try to Access 127.0.0.1:8123
from your Host machine, whereas you should access <ContainerIP>:8123
.
You could try to change the network_mode use the network_mode: "host"
in your compose file as a solution.
Your ssh tunnel is created inside your container on the socket 127.0.0.1:8123
. You expose Port 8123 to the Host (maybe you should expose 127.0.0.1:8123). But the actual problem is that you try to Access 127.0.0.1:8123
from your Host machine, whereas you should access <ContainerIP>:8123
.
You could try to change the network_mode use the network_mode: "host"
in your compose file as a solution.
answered Nov 16 at 11:24
Ben
1503
1503
1
Thank you for your answer it helped me. But I have to add that I had to addports
node to the definition ofphp
container. I add this edit to the question
– Nikita Leshchev
Nov 17 at 9:40
add a comment |
1
Thank you for your answer it helped me. But I have to add that I had to addports
node to the definition ofphp
container. I add this edit to the question
– Nikita Leshchev
Nov 17 at 9:40
1
1
Thank you for your answer it helped me. But I have to add that I had to add
ports
node to the definition of php
container. I add this edit to the question– Nikita Leshchev
Nov 17 at 9:40
Thank you for your answer it helped me. But I have to add that I had to add
ports
node to the definition of php
container. I add this edit to the question– Nikita Leshchev
Nov 17 at 9:40
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1374463%2fphpstorm-docker-xdebug-db-ssh-tunnel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown