docker

Deploying and running a Devprime microservice on docker

Microservices developed with Devprime can be configured by creating a local or private docker image in docker Hub, Azure ACR, Amazon ECR, Google Container Registry, and other private options.

To use docker, use the quick guide with several configuration options that we use in the documentation.

Building a docker image
Projects created with Devprime already have a ‘dockerfile’ file configured to build a container using a standard Linux image provided by Microsoft. Run the command in the project folder. You can change the name ‘order’ and the ‘v1’ tag.

docker build . -t  order:v1

Publishing a Devprime container to dockerhub
docker uses TAG to organize container images. In our scenario, we will enter the address of our repository ‘Devprime’ and later do a Push.

docker tag order:v1 Devprime/order:v1
docker push Devprime/order:v1

Exporting the parameters to run in docker
The Devprime CLI provides a command to export the required parameters with Devprime’s environment variables for configuration settings. You’ll have a powershell file and a bash file.
dp export docker

docker microservices Devprime

To make it easier to see, the parameters have been placed on separate lines. When copying the code, update the credentials and remove line breaks.

docker run --network Devprime --name order
-e Devprime_app="license=Put your license code|||debug=false|||debugstate=false|||debugstream=false|||debugweb=false|||showenviromentvariables=false|||tenancy=[enable=false,type=Shared,cache=State2,gateway=https://localhost:5003]"
-e Devprime_observability="enable=true|||saveinfile=false|||hidedetails=false|||hidedatetime=false|||showhttperrors=400"
-e Devprime_web="url=http://*:8080|||enable=true|||enableswagger=true|||postsuccess=201|||postfailure=500|||getsuccess=200|||getfailure=500|||patchsuccess=200|||patchfailure=500|||putsuccess=200|||putfailure=500|||deletesuccess=200|||deletefailure=500"
-e Devprime_security=""
-e Devprime_services="enable=true|||retry=3|||circuitbreak=45|||timeout=10|||connections=[clientid=your client id,clientsecret=your client secret,granttype=client_credentials,name=Services1,tokenuri=your token uri]"
-e Devprime_state1="alias=State1|||dbtype=mysql|||connection=Persist Security Info=False;database=order-mysql;server=mysql;Connect Timeout=30;user id=root; pwd=LltF8Nx*yo|||timeout=5|||dbversion=8.0.26-mysql|||retry=2|||durationofbreak=45"
-e Devprime_stream1="alias=Stream1|||enable=true|||default=true|||streamtype=RabbitMQ|||hostname=rabbitmq|||user=guest|||password=guest|||port=5672|||exchange=Devprime|||exchangetype=direct|||retry=3|||fallback=State1"
-e Devprime_custom="stream.orderevents=orderevents" -e ASPNETCORE_URLS='http://*:8080' -p 8080:8080 order:v1
Last modified January 10, 2024 (967dcac3)