Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Any guides on using Codesys containers in Docker?

aone
2021-04-11
2021-04-22
  • aone

    aone - 2021-04-11

    Hello,

    Are there any guides on using Codesys containers in Docker? I am new in using Docker and containers in general, but I understand the main points of it.

    I found the Codesys-4-Linux container, but I'm not sure where to start in using it. https://forge.codesys.com/tol/codesys-4-linux/docker/ci/master/tree/

    I am familiar with Codesys and I would like to utilize Codesys containers on a server to run automated tests via Cfunit.

    Any info would be greatly appreciated.

     
  • aone

    aone - 2021-04-11

    I'm currently going through this tutorial: https://docker-curriculum.com/

    Also, I just found this page: https://forge.codesys.com/tol/codesys-4-linux/home/Home/ which is helpful, thank you Ingo for making it.

    I'm expecting to use just the IDE in the following way:

    • Utilize the IDE scripting engine to create POUs, DUTs, etc. and create the Unit Tests associated with the new code
    • Utilize the IDE's simulated runtime environment to verify the newly created code passed the unit tests created for it.

    For the case described above, I would only need to use the "codesys-IDE" container correct?

    I'll go through the repo and figure out how everything works.
    Thanks for making the Docker container!

     
    πŸ‘
    2

    Last edit: aone 2021-04-11
    • Ingo

      Ingo - 2021-04-11

      Yes, exactly! In combination with cfUnit, I also experienced with this
      script
      https://forge.codesys.com/tol/codesys-4-linux/docker/ci/master/tree/codesys-ide/scripts/build-test.py

      You can start it in the container simply with the command "codesys
      build-test". While it worked locally, I didn't get it to run in my
      productive environment. But this was related to Drone, which I used as a
      test runner.

      This command builds a boot app, which I then started with this script:
      https://forge.codesys.com/tol/codesys-4-linux/docker/ci/master/tree/codesys-ide/codesyscontrol

      Yes, and you're welcome! πŸ˜‰

       
      πŸ‘
      1
      • aone

        aone - 2021-04-13

        Hello Ingo,

        Do you have a an example work flow for using the Codesys-IDE container?

        I am having a difficult time understanding what inputs or prerequisites are required in order to use commands like "build-test" or "compile-library".

        For instance, what inputs are expected after this command? A path to a .project file on the host computer?

        docker run codesys-ide codesys build-test
        
         

        Last edit: aone 2021-04-13
        • Ingo

          Ingo - 2021-04-14

          To answer your last question first:
          You need no input. The commands are designed, they are crunching through all files recursively. The reason for this "weired" design is the main use case, for which I designed them:
          "Execute easy build tasks" So a command might look like "codesys compile-library" , and it operates on the whole repo (magically).
          Checkout this documentation, to understand the idea:
          https://forge.codesys.com/forge/wiki/Continuous%20Integration/

          So, maybe you now also got an idea on how I use the containers.

          • Drone is mounting the repository as a volume to a folder
          • The working directory is already this folder
          • And I execute the commands like shown above

          If I can help you more, continue to ask.
          If it is a specific question, just ask this.
          If you have more general problems in understanding my stuff, I will need a bit more information about your current status.

          And I want to boost the idea of @hermsen . It would be terribly interesting for many of us, if you could write a nice blog post about your solution. Maybe it's still too early. But when you are ready and you need some help to publish it, feel free to ask for support.

           

          Last edit: Ingo 2021-04-14
          • aone

            aone - 2021-04-15

            Thanks Ingo!
            I started to realize your design after deciphering the "codesys" bash script in the codesys-ide folder and the "run" script in the Test folder.

            I'll review the wiki link.
            I'll be sure to post about the journey when I get proficient with the tools.

             
          • aone

            aone - 2021-04-15

            To clarify, you need to use Drone CI/CD (or another CI/CD tool) in order to utilize the Codesys containers, correct?

             
            • Ingo

              Ingo - 2021-04-22

              That's the main use case, but it might also be helpful in other scenarios.

               
    • h-hermsen

      h-hermsen - 2021-04-12

      Maybe you would be so kind and write up a blog of your progress? We would love to see such a project/story/blog in CForge! Plus, if you encounter some difficulties we can help.

       
      πŸ‘
      1

      Last edit: h-hermsen 2021-04-12
  • aone

    aone - 2021-04-12

    I'll document my journey. I'm looking through the repo in order to reduce trivial questions. I appreciate all the help.

    I'll pose questions here when I put in my due diligence.

     
    πŸ‘
    1

Log in to post a comment.