diff --git a/Dockerfile b/Dockerfile index 38dcdcd..e455a2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,8 @@ RUN bee generate routers # Generating the swagger RUN timeout 20 bee run -gendoc=true -downdoc=true -runmode=dev || : -RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html &&\ - sed -i 's/https:\/\/petstore.swagger.io\/v2\/swagger.json/swagger.json/g' swagger/index.html +RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html +RUN sed -i 's/https:\/\/petstore.swagger.io\/v2\/swagger.json/swagger.json/g' swagger/index.html RUN ls -l routers diff --git a/README.md b/README.md index 64bad15..8ec5c3c 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,30 @@ const ui = SwaggerUIBundle({ This issue is fixed in the Dockerfile build with two `sed` to change the value of the swagger file URL. +## Deployment with Docker compose +## Running the app locally +In order to run the application we need to correct some errors that beego generates. + +**Router generation** + +Beego generates the routers from the comment of the controllers methods. However, there seems to be some errors when we let beego generate th routers from `bee run`. + +We need to use `bee generate routers` to have a working router file. + +**Swagger generation** + +Using `bee run -downdoc=true -gendoc=true` beego download a swagger template and generate the JSON file (swagger.json) in `swagger/`. However the swagger template in `swagger/index.html` does not change the exemple's url for our current JSON file. When running locally we have to edit the call to construct the object holding the swagger information, with the parameter url set with the relative path to our JSON swagger file : + +``` +const ui = SwaggerUIBundle({ + url: "swagger.json", + ... + ... + }); +``` + +This issue is fixed in the Dockerfile build with two `sed` to change the value of the swagger file URL. + ## Deployment with Docker compose Deploy with docker: @@ -49,6 +73,9 @@ or out of docker `./scripts/populate_models.sh ./scripts/demo.json` ### Multinode +Deploy : +### Multinode + Deploy : `docker-compose -f docker-compose.yml -f docker-compose.backend.yml -f docker-compose.multi.yml up --build` diff --git a/services/init.go b/services/init.go index 2c483a8..6f71a0c 100644 --- a/services/init.go +++ b/services/init.go @@ -5,7 +5,7 @@ import ( ) func Init() { - Discoveryinit() //First init DC name + // Discoveryinit() //First init DC name // var DBpoint string // var err error