In this article we will show you how to run the ORIGAM Server with your application in your local Docker.
Docker files
When you create a new project in ORIGAM Architect, a folder “Docker” is automatically generated in your project folder
In the Docker folder you find two files:
-
CMD file
This file contains a command for creation of the Docker container and it may look like this:
docker run --env-file "c:\OrigamProjects\MyApplication\Docker\myapplication.env" ^
-it --name myapplication ^
-v "c:\OrigamProjects\MyApplication\model":/home/origam/HTML5/data/origam ^
-p 443:443 ^
origam/server:master-latest.linux
This command links the configuration file, names the Docker container, maps the local project directory in your file system to the one in the Linux server that will be created and sets up the server port.
-
ENV file
This file contains configuration that is used in the CMD file. Here is an example:
OrigamSettings_SetOnStart=true
OrigamSettings_SchemaExtensionGuid=562fdaf4-fff1-4d05-aaec-90197fbdefa7
OrigamSettings_DbHost=host.docker.internal
OrigamSettings_DbPort=1433
OrigamSettings_DbUsername=sa
OrigamSettings_DbPassword=MyStrongPassword
DatabaseName=myapplication
DatabaseType=mssql
ExternalDomain_SetOnStart=https://localhost
TZ=Europe/Prague
We will not go to the details of this configuration here but if you want to know more about this topic check this article.
Under normal circumstances you don’t need to make any changes to none of these files and you can use them as generated.
Docker container creation
In order to create a Docker container with the ORIGAM server you just need to run the CMD file and do it as system administrator.
Important note:
Before running the command please make sure the DB server you set up in your ORIGAM project is up and running. If needed, check the article dedicated to this topic here.
Now open your Command Prompt (CMD) in Windows or Terminal on Mac, go to the Docker directory in your project and run the CMD file typing for example:
myapplication.cmd
If everything runs in order, at the end of all the generated code you will get a notification that your Docker container (“Application”) is started.
You will also see your container running in Docker:
Troubleshooting
In case there is any issue you need to fix that and run the script again.
Here for example is how it looks when you run the Docker script without running DB server:
The container will be created in Docker despite this error, but if you run it, it will crash after a while and you will see the same error in the log:
To fix this, run your DB server and then run the Docker container with ORIGAM Server (“myapplication”) again. You may also consider deleting the container first and then creating it again from scratch.