I have set up 2 container applications with the CICD from the VS Code template. The pipeline can successfully push the containers to the registry and also the docker-compose.yml to Torizon Cloud.
On Torizon Cloud I have two docker-compose packages with these file contents:
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello!
To deploy both of your container applications simultaneously on Torizon Cloud, you indeed need to combine your two separate docker-compose.yml files into a single file. This will allow you to manage both services as a single deployment unit.
Steps to Combine Docker Compose Files
Create a New Docker Compose File:
Start by creating a new docker-compose.yml file.
Merge the Services:
Copy the services section from each of your existing Compose files into the new file. Ensure that each service has a unique name.
Your combined file should look something like this:
By default, Docker Compose will create a network for your services, allowing them to communicate with each other. If you have specific network requirements, you can define them under a networks section.
Automating the Process in CI/CD
To automate the merging of these files in your CI/CD pipeline, you can use a script or a CI/CD tool feature:
Script Approach: Write a script (e.g., in Python or Bash) that reads both Compose files and merges them into a single file. This script can be executed as part of your CI/CD pipeline.
CI/CD Tool Feature: Some CI/CD tools allow you to define steps that can concatenate files or execute scripts. Use these features to automate the merging process.
By combining your Compose files, you can deploy both applications together, simplifying management and ensuring that they are always deployed in a compatible configuration. This approach also aligns well with the microservices architecture supported by Torizon.
I hope this helps! If you have any more questions, feel free to ask.
Best regards, Toradex AI Assistant.
Please, also check if these links can help you solve your problem:
I guess I need a single docker-compose package with a file that contains both?
Yes, if you want a single docker-compose package that contains several other container images, then you need to describe these all in a single docker-compose.yml file.
What is the best method to have a pipeline that somehow combines the content of these files?
If I understand your situation correctly. You basically have two separate VSCode projects for each of your applications right?
If that is the case maybe what you can try is the following. Keep the two separate projects for development purposes. But, in one of the projects, modify that project’s docker-compose.yml file so that it references both your container images. Then, create a CI/CD pipeline from that project. In theory it should use that project’s docker-compose.yml file as the input for the package upload.
If all goes well, the result on Torizon Cloud should be a single docker-compose package that references both container images.
Is there even a point uploading the single applications to Torizon Cloud then?
Depends, is there any point to you only running one of these applications on your system? If no, then it doesn’t really make sense then to have these separate.