Compare commits
No commits in common. "48b3d32ac64ddd034ac9c013101d1bf3da118f5e" and "44a23ac5429bbc0beed58c953f1f138c0729c0f2" have entirely different histories.
48b3d32ac6
...
44a23ac542
|
@ -1,61 +0,0 @@
|
||||||
机器节点准备:
|
|
||||||
需要一台manager机器,内存和硬盘大一点,多台worker机器。
|
|
||||||
1、安装alma Linux 9.3,设置主机名、静态IP。
|
|
||||||
2、设置主机名。sudo hostnamectl status
|
|
||||||
sudo hostnamectl set-hostname [swarm-manager01、swarm-worker01等等]
|
|
||||||
3、设置静态IP,swarm mode需要使用静态IP,不能使用动态IP。
|
|
||||||
sudo vim /etc/NetworkManager/system-connections/ens160.nmconnection
|
|
||||||
...
|
|
||||||
[ipv4]
|
|
||||||
address1=92.168.31.251/24,192.168.31.1 (ip自己替换)
|
|
||||||
dns=114.114.114.114;
|
|
||||||
method=manual
|
|
||||||
...
|
|
||||||
|
|
||||||
nmcli c reload # 重新加载配置文件
|
|
||||||
nmcli c up ens160
|
|
||||||
4、关闭防火墙,sudo systemctl stop firewalld
|
|
||||||
sudo systemctl disable firewalld
|
|
||||||
sudo systemctl disable --now firewalld
|
|
||||||
sudo firewall-cmd --state
|
|
||||||
5、关闭SELinux,sudo setenforce 0
|
|
||||||
sudo sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
|
|
||||||
sudo sestatus
|
|
||||||
6、主机系统时间同步配置,
|
|
||||||
sudo yum install -y chrony
|
|
||||||
sudo vim /etc/chrony.conf
|
|
||||||
注释掉第三行原有的时间服务器地址,设置为阿里云的时间服务地址:
|
|
||||||
# pool 2.almalinux.pool.ntp.org iburst
|
|
||||||
pool ntp1.aliyun.com iburst
|
|
||||||
....
|
|
||||||
sudo systemctl enable --now chronyd
|
|
||||||
sudo chronyc -a makestep
|
|
||||||
|
|
||||||
|
|
||||||
Docker install
|
|
||||||
|
|
||||||
1、 sudo yum install -y yum-utils
|
|
||||||
2、 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
|
||||||
3、 sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
|
||||||
4、 sudo usermod -aG docker $USER
|
|
||||||
5、 newgrp docker
|
|
||||||
6、 sudo systemctl enable docker.service
|
|
||||||
7、 sudo systemctl enable containerd.service
|
|
||||||
8、 sudo systemctl start docker
|
|
||||||
9、 docker run hello-world
|
|
||||||
|
|
||||||
delete swarm
|
|
||||||
On manager机器上,执行:docker swarm leave --force
|
|
||||||
|
|
||||||
Create a swarm
|
|
||||||
On manager机器上
|
|
||||||
1、 docker swarm init --advertise-addr 192.168.3.188
|
|
||||||
记住输出的命令
|
|
||||||
2、 docker info
|
|
||||||
3、 docker node ls
|
|
||||||
|
|
||||||
On worker机器上
|
|
||||||
在manager机器上执行docker swarm join-token worker可以再次获取token
|
|
||||||
|
|
||||||
1、docker swarm join --token xxx【刚才输出的命令】
|
|
||||||
2、在manager机器上执行:docker node ls
|
|
28
pom.xml
28
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.2.2</version>
|
<version>3.2.0</version>
|
||||||
<relativePath /> <!-- lookup parent from repository -->
|
<relativePath /> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -41,17 +41,6 @@
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>gitea</id>
|
|
||||||
<url>https://svn.youshengyun.com:3000/api/packages/risesoft/maven</url>
|
|
||||||
</repository>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>gitea</id>
|
|
||||||
<url>https://svn.youshengyun.com:3000/api/packages/risesoft/maven</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
<spring-cloud.version>2023.0.0</spring-cloud.version>
|
<spring-cloud.version>2023.0.0</spring-cloud.version>
|
||||||
|
@ -156,8 +145,7 @@
|
||||||
<BP_NATIVE_IMAGE>false</BP_NATIVE_IMAGE>
|
<BP_NATIVE_IMAGE>false</BP_NATIVE_IMAGE>
|
||||||
<BP_JVM_VERSION>21</BP_JVM_VERSION>
|
<BP_JVM_VERSION>21</BP_JVM_VERSION>
|
||||||
</env>
|
</env>
|
||||||
<name>
|
<name>svn.youshengyun.com:9923/${project.artifactId}-jvm:${project.version}</name>
|
||||||
svn.youshengyun.com:9923/${project.artifactId}-jvm:${project.version}</name>
|
|
||||||
<publish>true</publish>
|
<publish>true</publish>
|
||||||
</image>
|
</image>
|
||||||
<docker>
|
<docker>
|
||||||
|
@ -186,8 +174,7 @@
|
||||||
<image>eclipse-temurin:21-jre</image>
|
<image>eclipse-temurin:21-jre</image>
|
||||||
</from>
|
</from>
|
||||||
<to>
|
<to>
|
||||||
<image>
|
<image>svn.youshengyun.com:9923/${project.artifactId}-jib</image>
|
||||||
svn.youshengyun.com:9923/${project.artifactId}-jib</image>
|
|
||||||
<tags>
|
<tags>
|
||||||
<tag>${project.version}</tag>
|
<tag>${project.version}</tag>
|
||||||
</tags>
|
</tags>
|
||||||
|
@ -232,17 +219,14 @@
|
||||||
<builder>paketobuildpacks/builder-jammy-tiny</builder>
|
<builder>paketobuildpacks/builder-jammy-tiny</builder>
|
||||||
<buildpacks>
|
<buildpacks>
|
||||||
<buildpack>gcr.io/paketo-buildpacks/graalvm</buildpack>
|
<buildpack>gcr.io/paketo-buildpacks/graalvm</buildpack>
|
||||||
<buildpack>
|
<buildpack>gcr.io/paketo-buildpacks/java-native-image</buildpack>
|
||||||
gcr.io/paketo-buildpacks/java-native-image</buildpack>
|
|
||||||
</buildpacks>
|
</buildpacks>
|
||||||
<env>
|
<env>
|
||||||
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
|
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
|
||||||
<BP_JVM_VERSION>21</BP_JVM_VERSION>
|
<BP_JVM_VERSION>21</BP_JVM_VERSION>
|
||||||
<BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
|
<BP_NATIVE_IMAGE_BUILD_ARGUMENTS>--enable-preview</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
|
||||||
--enable-preview</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
|
|
||||||
</env>
|
</env>
|
||||||
<name>
|
<name>svn.youshengyun.com:9923/${project.artifactId}-native:${project.version}</name>
|
||||||
svn.youshengyun.com:9923/${project.artifactId}-native:${project.version}</name>
|
|
||||||
<publish>true</publish>
|
<publish>true</publish>
|
||||||
</image>
|
</image>
|
||||||
<docker>
|
<docker>
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
version: '3.2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
agent:
|
|
||||||
image: portainer/agent:2.19.4
|
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
- /var/lib/docker/volumes:/var/lib/docker/volumes
|
|
||||||
networks:
|
|
||||||
- agent_network
|
|
||||||
deploy:
|
|
||||||
mode: global
|
|
||||||
placement:
|
|
||||||
constraints: [node.platform.os == linux]
|
|
||||||
|
|
||||||
portainer:
|
|
||||||
image: portainer/portainer-ce:2.19.4
|
|
||||||
command: -H tcp://tasks.agent:9001 --tlsskipverify
|
|
||||||
ports:
|
|
||||||
- "9443:9443"
|
|
||||||
- "9000:9000"
|
|
||||||
- "8000:8000"
|
|
||||||
volumes:
|
|
||||||
- portainer_data:/data
|
|
||||||
networks:
|
|
||||||
- agent_network
|
|
||||||
deploy:
|
|
||||||
mode: replicated
|
|
||||||
replicas: 1
|
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
node.role: manager
|
|
||||||
node.hostname: swarm-manager01
|
|
||||||
|
|
||||||
networks:
|
|
||||||
agent_network:
|
|
||||||
driver: overlay
|
|
||||||
attachable: true
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
portainer_data:
|
|
|
@ -4,7 +4,7 @@
|
||||||
./mvnw.cmd clean spring-boot:build-image -Pnative -Dmaven.test.skip=true
|
./mvnw.cmd clean spring-boot:build-image -Pnative -Dmaven.test.skip=true
|
||||||
|
|
||||||
#运行docker image
|
#运行docker image
|
||||||
docker compose -f compose-dev.yml up -d
|
docker compose -f compose.yml up -d
|
||||||
|
|
||||||
docker compose -f compose-demo01-jib.yml up -d
|
docker compose -f compose-demo01-jib.yml up -d
|
||||||
docker compose -f compose-demo01-jvm.yml up -d
|
docker compose -f compose-demo01-jvm.yml up -d
|
||||||
|
|
Loading…
Reference in New Issue