当前位置:网站首页>Simple deployment of microservices
Simple deployment of microservices
2022-04-22 12:42:00 【Bruce Lee hibernation】
Simple deployment of microservices requires Linux,docker,docker-compose,dockerfile
Catalog
Preliminary deployment preparation
To write docker-compose.yaml file
Preliminary deployment preparation
The complete layout of the whole project

1. First, you can install (Docker integration) plug-in unit , If you have doubts about plug-ins, you can take a look IDEA Use Docker plug-in unit +(IDEA Can't find Docker integration terms of settlement )

2. Connect remotely linux, If for no other , Just for convenience


After connection :

Microservice coding
This is mainly about the deployment code of microservices, which is perfunctory

application.yaml
spring:
application:
name: bank-accounts
server:
port: 8881
pom.xml
<dependencies>
<!--web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Super pit -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
</dependencies>
effect :

that will do !
Project package package

Wrong packing :Failed to execute goal org.springframework.boot:spring-boot-maven-plugin
To write Dockerfile
FROM java:8
# hold jar Add file to image , After adding and renaming
ADD *.jar /accounts.jar
# Specify the port of the project
CMD ["--server.port=8881"]
# Exposed port
EXPOSE 8881
# perform java -jar The order of
ENTRYPOINT ["java","-jar","/accounts.jar"]
The notes are written in great detail ,Dockerfile The file is used to build the image later
To write docker-compose.yaml file
version: "3.8"
networks:
bank:
volumes:
data:
services:
bank-gateway:
build:
context: ./gateway
dockerfile: Dockerfile
container_name: gateway
restart: always
networks:
- bank
ports:
- "8888:8888"

Upload to linux in :
Build a mirror image

Make sure there is no problem uploading the file
1.jar package
2.Dockerfile
3.docker-compose


Docker Compose The orchestration tool downloads and loads the image , function :
docker-compose up -d
Wait for a while

bank_bank-records It's working
that will do !
visit

Unable to access, try restarting the firewall …
I hope you can learn from this article
Please remember to click three times ~~~~~~~~~·
版权声明
本文为[Bruce Lee hibernation]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221239168846.html
边栏推荐
- Knowledge points that need to be recorded in the work
- Concept and operation of stack
- Share the small problems you have encountered in writing projects recently
- let与var的区别,几个经典的小面试题
- 制裁压力下,俄罗斯计划通过友好国家平行进口电子产品
- JS盒子点击时跟随鼠标移动
- April 21, 2022 s s s m framework integration @ lesson 1 s s m environment configuration & focus on practical operation. Summary in practice. The results are not shown here.
- Ros2 learning notes (IX) learn the bag recording of ros2 from turnlesim
- Local deployment of distributed monitoring cat server
- [concurrent programming 050] type and description of memory barrier?
猜你喜欢

微服务的简单部署
![[concurrent programming 053] Why use volatile variables for double check lock variables](/img/d9/0a23a33c6573edaaa63ae588f13af9.png)
[concurrent programming 053] Why use volatile variables for double check lock variables

VR全景婚礼给你别样的浪漫,记录婚礼的甜蜜瞬间

挑选了适合测试边界的汉字及截图

Embedded development: three techniques for verifying sensors and communication data in embedded systems

Detailed explanation and code example of serial communication of 51 single chip microcomputer

Share a recent tag

LeetCode 83、删除排序链表中的重复元素

Novartis Nebula updated its prospectus and continued its listing process. Is the "academic school" gaining momentum step by step?

Concept and operation of stack
随机推荐
栈的概念和操作
js原生代码实现三级联动效果
Smart cultural tourism is gradually digitalized, and VR panorama promotes the integrated development of cultural tourism
JS基础11
. net treasure API: outputformatter, format output object
Tell your girlfriend easily: the internal principle of thread pool
Detailed explanation and code example of serial communication of 51 single chip microcomputer
表单是否为空验证
R语言ggplot2可视化:计算dataframe中每个数据列缺失值的个数、使用堆叠的条形图(Stacked Barplot)可视化每个数据列的缺失值的情况(设置坐标轴为百分比以显示缺失值的比例)
Thread related issues
JS基础7
[concurrent programming 050] type and description of memory barrier?
ES6 deconstruction assignment of array of deconstruction assignment
【并发编程050】内存屏障的种类以及说明?
LeetCode 1768、交替合并字符串
可执行文件的生成过程
LeetCode 389、找不同
LeetCode 34、在排序数组中查找元素的第一个和最后一个位置
【并发编程047】缓存锁定性能优于总线锁定, 为什么不淘汰总线锁定?
[concurrent programming 053] Why use volatile variables for double check lock variables