-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding custom services #415
Comments
Hi @uwej711, I believe Docker/SDK provides required feature OOTB. Like an example: docker:
compose:
yamls:
- docker-compose.custom.yml docker-compose.custom.yml version: 3.7
services:
my-custom-service:
image:.... https://docs.docker.com/compose/extends/ I hope it will be helpful and have a great evening. |
@alexanderM91 I tried what you suggested but it does not work. See the linked PR for a solution that allows what I want to achieve. |
Hi @uwej711, could you please answer for several small questions? |
Of course those can be placed in the same folder. But we still have to add the folder to the Twig ChainLoader, see my PR. I can easily adjust that. |
PR updated |
Hi @uwej711, thanks a lot for your contribution. Thank you. |
No problem. I added the following content to config/deploy-templates/service/mockservices/default/mockservices.yml.twig: {{ serviceName }}:
build:
context: ./mockservices
networks:
- private
- public
labels:
'spryker.app.name': mockservices
'spryker.app.type': hidden
'spryker.project': ${SPRYKER_DOCKER_PREFIX}:${SPRYKER_DOCKER_TAG}
healthcheck:
test: [ "CMD", "nc", "-z", "localhost", "8008" ]
interval: 5s
timeout: 5s
retries: 5
volumes:
{% include "application-volumes.yml.twig" with project %} and the following to config/deploy-templates/nginx/http/gateway/mockservices.server.conf.twig: {% extends "nginx/http/gateway/server.conf.twig" %}
{% block upstream %}{{ upstream }}:8008{% endblock upstream %} Finally the following was added to deploy.yml: services:
mockservices:
engine: mockservices
endpoints:
services.spryker.local: There is a Dockerfile in the mockservices directory that builds a tiny flask app for developing locally ... Now after docker/sdk boot and docker/sdk up I have my flask app running and available at services.spryker.local. |
What is the problem you are trying to solve by the feature?
For our local development I would like to have the possibility to add custom services to simplify development. These are basically mocks for real services used in other environments. Adding them to the docker environment would allow us to easily make this available to all developers on the team.
What is the solution do you propose?
You should be able to add new services to the deploy.*.yml files and docker/sdk boot should be able to add them to the deployment. From what I've seen so far, the main change would be to add not only the deploy.yml from the project directory but also the needed templates. For our concrete case that would be a "mockservice.yml.twig" (for docker-compose.yml) and a "mockservice.server.conf.twig" for the gateway configuration.
These files could be placed in some folder at the project level, copied to the generator temp dir and this path added to the twig environment.
What changes in deploy.yml format do you propose?
No extra changes to the format necessary.
What changes in command line interface do you propose?
No changes for the cli necessary
What alternatives have you considered?
I added the files locally to the docker-sdk src and it works.
PR
If there is a change for this change to be accepted as a PR I can try to prepare one.
The text was updated successfully, but these errors were encountered: