[release] 0.5.9

This commit is contained in:
Yann Stepienik 2023-05-19 21:15:42 +01:00
parent 9a11b80e6b
commit 3b50610a4d
2 changed files with 17 additions and 33 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "cosmos-server", "name": "cosmos-server",
"version": "0.5.8", "version": "0.5.9",
"description": "", "description": "",
"main": "test-server.js", "main": "test-server.js",
"bugs": { "bugs": {

View file

@ -27,52 +27,36 @@ func NewDB(w http.ResponseWriter, req *http.Request) (string, error) {
mongoPass := utils.GenerateRandomString(24) mongoPass := utils.GenerateRandomString(24)
monHost := "cosmos-mongo-" + id monHost := "cosmos-mongo-" + id
imageName := "mongo:5" imageName := "mongo:latest"
// if CPU is missing AVX, use 4.4 // if CPU is missing AVX, use 4.4
if runtime.GOARCH == "amd64" && !cpu.X86.HasAVX { if runtime.GOARCH == "amd64" && !cpu.X86.HasAVX {
utils.Warn("CPU does not support AVX. Using mongo 4.4") utils.Warn("CPU does not support AVX. Using mongo 4.4")
imageName = "mongo:4.4" imageName = "mongo:4.4"
} }
service := DockerServiceCreateRequest{ err := RunContainer(
Services: map[string]ContainerCreateRequestContainer {}, "mongo:latest",
Volumes: []ContainerCreateRequestVolume{ monHost,
ContainerCreateRequestVolume{ []string{
Name: "cosmos-mongo-data-" + id,
},
ContainerCreateRequestVolume{
Name: "cosmos-mongo-config-" + id,
},
},
}
service.Services[monHost] = ContainerCreateRequestContainer{
Name: monHost,
Image: imageName,
RestartPolicy: "always",
Environment: []string{
"MONGO_INITDB_ROOT_USERNAME=" + mongoUser, "MONGO_INITDB_ROOT_USERNAME=" + mongoUser,
"MONGO_INITDB_ROOT_PASSWORD=" + mongoPass, "MONGO_INITDB_ROOT_PASSWORD=" + mongoPass,
}, },
Labels: map[string]string{ []VolumeMount{
"cosmos-force-network-secured": "true",
},
Volumes: []mount.Mount{
{ {
Type: mount.TypeVolume, Destination: "/data/db",
Source: "cosmos-mongo-data-" + id, Volume: &types.Volume{
Target: "/data/db", Name: "cosmos-mongo-data-" + id,
},
}, },
{ {
Type: mount.TypeVolume, Destination: "/data/configdb",
Source: "cosmos-mongo-config-" + id, Volume: &types.Volume{
Target: "/data/configdb", Name: "cosmos-mongo-config-" + id,
},
}, },
}, },
}; )
err := CreateService(w, req, service)
if err != nil { if err != nil {
return "", err return "", err