Update Docker #1

Open
opened 2023-10-25 09:22:23 +02:00 by yc · 4 comments
Owner

Update dockerfile and compose to build a minimal container with Swagger like in oc-discovery component.
The docker-compose.yml shall be used for the current project and a docker-compose-prereq.yml shall be used for running dependencies, both on the opencloud network.

Update dockerfile and compose to build a minimal container with Swagger like in oc-discovery component. The docker-compose.yml shall be used for the current project and a docker-compose-prereq.yml shall be used for running dependencies, both on the opencloud network.
yc added the
Kind/Feature
Priority/High
labels 2023-10-25 09:22:23 +02:00
pb was assigned by yc 2023-10-25 09:22:24 +02:00
root added this to the OpenCloud project 2023-10-25 21:17:02 +02:00
Owner

Need to update the configuration process, currently doesn't support the way oc-discovery runs in docker :

  • Several variables are defined in the conf.app file
  • Causes the binary to crash
root@68ccd23e8112:/app# oc-catalog 
2023/10/30 14:41:48.425 [D]  init global config instance failed. If you do not use this, just ignore it.  open conf/app.conf: no such file or directory

=> implementing onion to handle environment variables

Need to update the configuration process, currently doesn't support the way oc-discovery runs in docker : - Several variables are defined in the conf.app file - Causes the binary to crash ``` root@68ccd23e8112:/app# oc-catalog 2023/10/30 14:41:48.425 [D] init global config instance failed. If you do not use this, just ignore it. open conf/app.conf: no such file or directory ``` => implementing onion to handle environment variables
Owner

Changed the architecture of the conf, moved it from models/conf.go to conf/conf.go to avoid import cycle between the models and services packages. Now the package to import in conf, which is available to every other package without risking an import cycle.

Changed the architecture of the conf, moved it from models/conf.go to conf/conf.go to avoid import cycle between the models and services packages. Now the package to import in conf, which is available to every other package without risking an import cycle.
Owner

Identified some code that prevents the module to be compiled and then run outside of its directory.
It seems like the swagger is regenerated each time the server is launched. Actually there is a line in oc-catalog/routers/router.go that reads :

	//Force regenerate swagger before consuming the data
	 bee.GenerateDocs(".")

When running the binary in a scratch container or a folder different from the one where it was built, it generates a "parsing error".

I am still trying to understand why this part of the code was written and if we can get ride of it now that we generate the swagger in the Dockerfile with

RUN timeout 15 bee run -gendoc=true -downdoc=true -runmode=dev || : 
Identified some code that prevents the module to be compiled and then run outside of its directory. It seems like the swagger is regenerated each time the server is launched. Actually there is a line in oc-catalog/routers/router.go that reads : ``` //Force regenerate swagger before consuming the data bee.GenerateDocs(".") ``` When running the binary in a scratch container or a folder different from the one where it was built, it generates a "parsing error". I am still trying to understand why this part of the code was written and if we can get ride of it now that we generate the swagger in the Dockerfile with ``` RUN timeout 15 bee run -gendoc=true -downdoc=true -runmode=dev || : ```
Owner

Dockerfile has been reduced to a minimal size (30 Mb) by using a scratch image and generating the swagger during the build. Several modifications happened :

  • Added the configuration process with onion and json files
  • Modified the router initiation method : bee.GenerateDocs removed to prevent I/O errors in the container
  • Modified the services initiation : use of the conf file to retrieve mongo address
  • Modified the compose file :
    • Mapped localhost 49618 to container 8080, so that we don't have to change the listening port inside the beego app
    • Removed the build instruction that caused image to be rebuild when doing a compose up
Dockerfile has been reduced to a minimal size (30 Mb) by using a scratch image and generating the swagger during the build. Several modifications happened : - Added the configuration process with onion and json files - Modified the router initiation method : bee.GenerateDocs removed to prevent I/O errors in the container - Modified the services initiation : use of the conf file to retrieve mongo address - Modified the compose file : - Mapped localhost 49618 to container 8080, so that we don't have to change the listening port inside the beego app - Removed the build instruction that caused image to be rebuild when doing a compose up
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: core/deprecated-oc-catalog#1
No description provided.