[release] v0.5.3 - Support CPU without AVX

This commit is contained in:
Yann Stepienik 2023-05-18 17:50:10 +01:00
parent 4e70cdfc60
commit 84ceae0591
2 changed files with 13 additions and 2 deletions

View file

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

View file

@ -8,6 +8,9 @@ import (
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/mount"
"runtime"
"golang.org/x/sys/cpu"
)
type VolumeMount struct {
@ -21,8 +24,16 @@ func NewDB() (string, error) {
mongoPass := utils.GenerateRandomString(24)
monHost := "cosmos-mongo-" + id
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"
}
err := RunContainer(
"mongo:latest",
imageName,
monHost,
[]string{
"MONGO_INITDB_ROOT_USERNAME=" + mongoUser,