[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",
"version": "0.5.8",
"version": "0.5.9",
"description": "",
"main": "test-server.js",
"bugs": {

View file

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