Merge remote-tracking branch 'refs/remotes/origin/pierre_configuration'

This commit is contained in:
pb 2024-07-04 16:08:05 +02:00
commit 4b03211502
3 changed files with 30 additions and 3 deletions

View File

@ -13,8 +13,8 @@ RUN bee generate routers
# Generating the swagger # Generating the swagger
RUN timeout 20 bee run -gendoc=true -downdoc=true -runmode=dev || : 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 &&\ 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/https:\/\/petstore.swagger.io\/v2\/swagger.json/swagger.json/g' swagger/index.html
RUN ls -l routers RUN ls -l routers

View File

@ -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. 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 ## Deployment with Docker compose
Deploy with docker: Deploy with docker:
@ -49,6 +73,9 @@ or out of docker `./scripts/populate_models.sh ./scripts/demo.json`
### Multinode ### Multinode
Deploy :
### Multinode
Deploy : Deploy :
`docker-compose -f docker-compose.yml -f docker-compose.backend.yml -f docker-compose.multi.yml up --build` `docker-compose -f docker-compose.yml -f docker-compose.backend.yml -f docker-compose.multi.yml up --build`

View File

@ -5,7 +5,7 @@ import (
) )
func Init() { func Init() {
Discoveryinit() //First init DC name // Discoveryinit() //First init DC name
// var DBpoint string // var DBpoint string
// var err error // var err error