v0.1.1 Bug Fixes
This commit is contained in:
parent
cc2c749250
commit
a780f05761
|
@ -139,6 +139,7 @@ const UserManagement = () => {
|
|||
}).then(() => {
|
||||
setOpenCreateForm(false);
|
||||
refresh();
|
||||
sendlink(document.getElementById('c-nickname').value, 'create');
|
||||
});
|
||||
}}>Create</Button>
|
||||
</DialogActions>
|
||||
|
|
|
@ -59,12 +59,12 @@ const ServeApps = () => {
|
|||
}
|
||||
|
||||
const getContainersRoutes = (containerName) => {
|
||||
return config && config.HTTPConfig && config.HTTPConfig.ProxyConfig.Routes.filter((route) => {
|
||||
return (config && config.HTTPConfig && config.HTTPConfig.ProxyConfig.Routes.filter((route) => {
|
||||
return route.Mode == "SERVAPP" && (
|
||||
route.Target.startsWith(containerName) ||
|
||||
route.Target.split('://')[1].startsWith(containerName)
|
||||
)
|
||||
})
|
||||
})) || [];
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
@ -55,7 +55,7 @@
|
|||
"build": " sh build.sh",
|
||||
"dev": "npm run build && npm run start",
|
||||
"dockerdevbuild": "sh build.sh && npm run client-build && docker build --tag cosmos-dev .",
|
||||
"dockerdevrun": "docker stop cosmos-dev; docker rm cosmos-dev; docker run -d -p 80:80 -p 443:443 -e DOCKER_HOST=tcp://host.docker.internal:2375 -e COSMOS_HOSTNAME=localhost -e COSMOS_MONGODB=$MONGODB -e COSMOS_LOG_LEVEL=DEBUG --name cosmos-dev cosmos-dev",
|
||||
"dockerdevrun": "docker stop cosmos-dev; docker rm cosmos-dev; docker run -d -p 80:80 -p 443:443 -e DOCKER_HOST=tcp://host.docker.internal:2375 -e COSMOS_HOSTNAME=localhost -e COSMOS_MONGODB=$MONGODB -e COSMOS_LOG_LEVEL=DEBUG --restart=unless-stopped --name cosmos-dev cosmos-dev",
|
||||
"dockerdev": "npm run dockerdevbuild && npm run dockerdevrun"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
|
11
readme.md
11
readme.md
|
@ -1,9 +1,14 @@
|
|||
![banner](./banner.png)
|
||||
|
||||
<p align="center">
|
||||
<img alt="Logo Banner" width="100px" src="https://github.com/azukaar/Cosmos-Server/blob/master/Logo.png?raw=true"/>
|
||||
</p>
|
||||
<h1 align="center">Cosmos-Server</h1>
|
||||
<h3 align="center" style="margin-bottom:15px">Secure and Easy Self-Hosted Platform.</h3>
|
||||
|
||||
---
|
||||
|
||||
[![DiscordLink](https://img.shields.io/discord/1083875833824944188?label=Discord&logo=Discord&style=flat-square)](https://discord.gg/PwMWwsrwHA) ![CircleCI](https://img.shields.io/circleci/build/github/azukaar/Cosmos-Server?token=6efd010d0f82f97175f04a6acf2dae2bbcc4063c&style=flat-square)
|
||||
|
||||
# Cosmos Server
|
||||
|
||||
Cosmos is a self-hosted platform for running server applications securely and with built-in privacy features. It acts as a secure gateway to your application, as well as a server manager. It aims to solve the increasingly worrying problem of vulnerable self-hosted applications and personnal servers.
|
||||
|
||||
![screenshot1](./screenshot1.png)
|
||||
|
|
BIN
screenshot1.png
BIN
screenshot1.png
Binary file not shown.
Before Width: | Height: | Size: 539 KiB After Width: | Height: | Size: 264 KiB |
|
@ -202,7 +202,5 @@ func Test() error {
|
|||
|
||||
// fmt.Println(jellyfin.NetworkSettings)
|
||||
|
||||
|
||||
|
||||
return nil
|
||||
}
|
|
@ -45,6 +45,7 @@ func CreateCosmosNetwork() (string, error) {
|
|||
}
|
||||
|
||||
//if running in Docker, connect to main network
|
||||
utils.Debug("HOSTNAME: " + os.Getenv("HOSTNAME"))
|
||||
if os.Getenv("HOSTNAME") != "" {
|
||||
err := DockerClient.NetworkConnect(DockerContext, newNeworkName, os.Getenv("HOSTNAME"), &network.EndpointSettings{})
|
||||
|
||||
|
@ -146,6 +147,14 @@ func IsConnectedToASecureCosmosNetwork(containerConfig types.ContainerJSON) (boo
|
|||
|
||||
for name, _ := range containerConfig.NetworkSettings.Networks {
|
||||
if name == GetLabel(containerConfig, "cosmos-network-name") {
|
||||
if os.Getenv("HOSTNAME") != "" {
|
||||
// TODO: Check if connected to network first
|
||||
DockerClient.NetworkConnect(DockerContext, name, os.Getenv("HOSTNAME"), &network.EndpointSettings{})
|
||||
// if err != nil {
|
||||
// utils.Error("Docker Network Connect EXISTING ", err)
|
||||
// return false, err
|
||||
// }
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,12 +7,19 @@ import (
|
|||
// "github.com/docker/docker/client"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
)
|
||||
|
||||
type VolumeMount struct {
|
||||
Destination string
|
||||
Volume *types.Volume
|
||||
}
|
||||
|
||||
func NewDB() (string, error) {
|
||||
id := utils.GenerateRandomString(3)
|
||||
mongoUser := "cosmos-" + utils.GenerateRandomString(5)
|
||||
mongoPass := utils.GenerateRandomString(24)
|
||||
monHost := "cosmos-mongo-" + utils.GenerateRandomString(3)
|
||||
monHost := "cosmos-mongo-" + id
|
||||
|
||||
err := RunContainer(
|
||||
"mongo:latest",
|
||||
|
@ -21,6 +28,20 @@ func NewDB() (string, error) {
|
|||
"MONGO_INITDB_ROOT_USERNAME=" + mongoUser,
|
||||
"MONGO_INITDB_ROOT_PASSWORD=" + mongoPass,
|
||||
},
|
||||
[]VolumeMount{
|
||||
{
|
||||
Destination: "/data/db",
|
||||
Volume: &types.Volume{
|
||||
Name: "cosmos-mongo-data-" + id,
|
||||
},
|
||||
},
|
||||
{
|
||||
Destination: "/data/configdb",
|
||||
Volume: &types.Volume{
|
||||
Name: "cosmos-mongo-config-" + id,
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
|
@ -30,7 +51,7 @@ func NewDB() (string, error) {
|
|||
return "mongodb://"+mongoUser+":"+mongoPass+"@"+monHost+":27017", nil
|
||||
}
|
||||
|
||||
func RunContainer(imagename string, containername string, inputEnv []string) error {
|
||||
func RunContainer(imagename string, containername string, inputEnv []string, volumes []VolumeMount) error {
|
||||
errD := Connect()
|
||||
if errD != nil {
|
||||
utils.Error("Docker Connect", errD)
|
||||
|
@ -44,6 +65,16 @@ func RunContainer(imagename string, containername string, inputEnv []string) err
|
|||
}
|
||||
io.Copy(os.Stdout, pull)
|
||||
|
||||
var mounts []mount.Mount
|
||||
|
||||
for _, volume := range volumes {
|
||||
mount := mount.Mount{
|
||||
Type: mount.TypeVolume,
|
||||
Source: volume.Volume.Name,
|
||||
Target: volume.Destination,
|
||||
}
|
||||
mounts = append(mounts, mount)
|
||||
}
|
||||
|
||||
// Define a PORT opening
|
||||
// newport, err := natting.NewPort("tcp", port)
|
||||
|
@ -63,6 +94,7 @@ func RunContainer(imagename string, containername string, inputEnv []string) err
|
|||
// },
|
||||
// },
|
||||
// },
|
||||
Mounts : mounts,
|
||||
RestartPolicy: container.RestartPolicy{
|
||||
Name: "always",
|
||||
},
|
||||
|
|
|
@ -28,10 +28,10 @@ type NewInstallJSON struct {
|
|||
TLSKey string `json:"tlsKey"`
|
||||
Nickname string `json:"nickname"`
|
||||
Password string `json:"password"`
|
||||
Email string `json:"email"`
|
||||
Email string `json:"omitempty,email"`
|
||||
Hostname string `json:"hostname"`
|
||||
Step string `json:"step"`
|
||||
SSLEmail string `json:"sslEmail",validate:"if=HTTPSCertificateMode==LetsEncrypt,email"`
|
||||
SSLEmail string `json:"sslEmail",validate:"omitempty,email"`
|
||||
}
|
||||
|
||||
type AdminJSON struct {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
type CreateRequestJSON struct {
|
||||
Nickname string `validate:"required,min=3,max=32,alphanum"`
|
||||
Email string `validate:"email"`
|
||||
Email string `validate:"omitempty,email"`
|
||||
}
|
||||
|
||||
func UserCreate(w http.ResponseWriter, req *http.Request) {
|
||||
|
|
|
@ -22,7 +22,7 @@ var DefaultConfig = Config{
|
|||
GenerateMissingAuthCert: true,
|
||||
HTTPPort: "80",
|
||||
HTTPSPort: "443",
|
||||
Hostname: "0.0.0.0",
|
||||
Hostname: "localhost",
|
||||
ProxyConfig: ProxyConfig{
|
||||
Routes: []ProxyRouteConfig{},
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue