caprover / caprover

Scalable PaaS (automated Docker+nginx) - aka Heroku on Steroids
https://CapRover.com
Other
13.29k stars 852 forks source link

[Deployment Issue] - modify overlay network #1318

Closed xdespujols closed 2 years ago

xdespujols commented 2 years ago

What is the problem? The default install of CapRover, use network 10.0.1.0/24 for container. I have already this network in my config.

I try to use swarm init for define another network overlay but i have error on install caprover 'This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.'

I don't find an option for define overlay network in caprover install.

Steps to reproduce the problem:

Output of the following command on your server:

Linux 33-dm-a01 4.15.0-166-generic #174-Ubuntu SMP Wed Dec 8 19:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic
              total        used        free      shared  buff/cache   available
Mem:           7,8G        239M        3,8G        856K        3,7G        7,3G
Swap:          4,0G         12K        4,0G
githubsaturn commented 2 years ago

CapRover doesn't impose any IP by default. This is all the default config by Docker. https://github.com/caprover/caprover/blob/d87cf7d5e0018a877804225ff254d202cc956b04/src/docker/DockerApi.ts#L1171-L1176

Two solutions that might work.

1- Try removing captain-overlay-network post installation, and recreate it with the desired config.

2- First create swarm, then install CapRover. As you noticed, you can't use the default installer command since the node is already part of swarm. Instead you can try something like this

docker service create \
  --mount src=/captain,dst=/captain \
  --mount src=/var/run/docker.sock,dst=/var/run/docker.sock \
  --name captain-captain \
  --env IS_CAPTAIN_INSTANCE=1 \
   --publish mode=host,published=3000,target=3000 \
  caprover/caprover