jolicode/JoliCi

Support service

Closed this issue · 4 comments

The goal is to have external services when running test image, like mysql, postgresql, mongodb, etc ...

clue commented

Support for running services in external docker containers has been added with PR #38.

While this is good first step, it would be even better if we could access them like local services. Most of the services appear to expose a single TCP/IP port, so we can probably set up some local port forwarding.

We can keep track of the assigned ports for each service in the servicesMapping and then set up a port forwarding for each one.

One possibly option would be to run socat in the main container, in order to avoid messing with kernel/firewall settings.

clue commented

We can […] set up a port forwarding for each one

FWIW: This also appears to to be how Drone handles external services (reference):

Why point to localhost when Postgres is running in a different container? This is a feature of many of Drone’s built-in images. They are configured to proxy connections from the local host to the correct services containers.

While this is good first step, it would be even better if we could access them like local services. Most of the services appear to expose a single TCP/IP port, so we can probably set up some local port forwarding.

I totally agree and this is one of my current attention, that's why i did not release a new version yet.

One possibly option would be to run socat in the main container, in order to avoid messing with kernel/firewall settings.

That's how i want to implement it, but first i need to add some api calls to docker-php library to add the exec call on container, which will allow me to run one socat per service needed, before launching test.

Another thing that i need to handle is to remove before_scripts and other actions out of the Dockerfile generated and executed them directly with exec action (or run) as some people create database in these lines, and services are not available during the build of environment, but i will certainly fix this in another version as these can have some downside.

Local services need a huge rework on how things are launched during build and exec part, a small implementation has been created for the moment to allow some users to use this, work for local services is actually done in this branch :

https://github.com/jolicode/JoliCi/tree/feature/local-services

Closing this issue as jolici support services, will reopen other for the downsides