当前位置:网站首页>Deploying WordPress instance tutorial under coreos
Deploying WordPress instance tutorial under coreos
2022-07-03 11:49:00 【Brother Xing plays with the clouds】
CoreOS Is a special for large-scale The server Deploy custom Linux Streamline systems , It completely separates the operating system from the application , Thus reducing the coupling between the operating system and the application , At the same time, it solves the existing Linux The server In container resources 、 Problems in permission management . For now ,CoreOS It will be the development trend of the future operating system .
Have you been there in person CoreOS Deploy an application ? I believe most people have never had such experience , stay CoreOS It can be said to be very hard and frustrating to build an application on . Because before you start to build a program, you must first understand all the different technologies .
below , We will teach you hand in hand to create a simple WordPress Applications , use MySQL As The server , stay CoreOS Up operation .
The server operating system CoreOS First experience http://www.linuxidc.com/Linux/2014-07/104807.htm
1. install CLI To control CoreOS
If your computer is Mac, It can be installed locally fleetctl and etcdctl To control CoreOS colony :
$ brew install go etcdctl
$ git clone https://github.com/coreos/fleet.git
$ cd fleet
$ ./build
$ mv bin/fleetctl /usr/local/bin/2. Install local colony
Use deployment virtualization development environment Vagrant To install local colony be prone to :
$ git clone https://github.com/CenturyLinkLabs/coreos-vagrant
$ cd coreos-vagrant/cluster
$ vagrant up --provisionNow the cluster is installed , Easy ! Now let's check the local fleetctl:
$ fleetctl list-machines
MACHINE IP METADATA
09fd0a88... 10.0.2.15 -
77763947... 10.0.2.15 -
f31c383c... 10.0.2.15 -That's great , It works !
3. Use fleet Deploy an application
fleetctl The command can deploy the application to CoreOS In the nodes of the cluster , But for fleet Writing service files is really terrible . Fortunately, , You don't have to write it yourself , You can use yaml format To generate service files :
$ sudo gem install bundler fig2coreos
$ cat fig.yml
web:
image: ctlc/wordpress
ports:
- 80:80
environment:
DB_USER: root
DB_PASSWORD: qa1N76pWAri9
links:
- db
db:
image: ctlc/mysql
ports:
- 3306:3306
environment:
MYSQL_DATABASE: wordpress
MYSQL_ROOT_PASSWORD: qa1N76pWAri9
$ fig2coreos myapp fig.yml coreos-files
$ cd coreos-files
$ ls
db-discovery.1.service
db.1.service
web-discovery.1.service
web.1.servicefleetctl The client tool uses etcd Systematic Key/Value Storage form , To share configuration and service discovery . Here is how to deploy the program to the cluster :
$ fleetctl start db.1.service
$ fleetctl list-units
UNIT LOAD ACTIVE SUB DESC MACHINE
db.1.service loaded active running Run db_1 9c008961.../10.0.2.15
$ fleetctl start web.1.service
$ fleetctl list-units
UNIT LOAD ACTIVE SUB DESC MACHINE
db.1.service loaded active running Run db_1 9c008961.../10.0.2.15
web.1.service loaded active running Run web_1 9c008961.../10.0.2.15Now the program is running , But I haven't registered yet etcd Service for , Fortunately, fig2coreos The generated service discovery file can help us :
$ fleetctl start db-discovery.1.service
$ fleetctl start web-discovery.1.service
$ fleetctl list-units
UNIT LOAD ACTIVE SUB DESC MACHINE
db-discovery.1.service loaded active running Announce db_1 9c008961.../10.0.2.15
db.1.service loaded active running Run db_1 9c008961.../10.0.2.15
web-discovery.1.service loaded active running Announce web_1 9c008961.../10.0.2.15
web.1.service loaded active running Run web_1 9c008961.../10.0.2.15
$ etcdctl ls --recursive
/services
/services/web
/services/web/web_1
/services/db
/services/db/db_1
$ etcdctl get /services/web/web_1
{ "host": "core-03", "port": 80, "version": "52c7248a14" }
$ etcdctl get /services/db/db_1
{ "host": "core-03", "port": 3306, "version": "52c7248a14" }That's it ! If you're using Vagrant 1.5 And Vagrant Cloud, Then you can achieve WordPress Program and see that it can be implemented :
$ cd ~/coreos-vagrant/cluster/
# find out which box is hosting your port 80
$ etcdctl get /services/web/web_1
{ "host": "core-03", "port": 80, "version": "52c7248a14" }
$ vagrant share core-03 --http 80
==> core-03: Detecting network information for machine...
core-03: Local machine address: 192.168.65.2
core-03: Local HTTP port: 80
core-03: Local HTTPS port: disabled
==> core-03: Checking authentication and authorization...
==> core-03: Creating Vagrant Share session...
core-03: Share will be at: quick-iguana-4689
==> core-03: Your Vagrant Share is running! Name: quick-iguana-4689
==> core-03: URL: http://quick-iguana-4689.vagrantshare.comThe following is the finished rendering :
In fact, we can be in CoreOS I can do many things , Today, this is just the foundation , You can have a try if you are interested .
边栏推荐
猜你喜欢

导师对帮助研究生顺利完成学业提出了20条劝告:第一,不要有度假休息的打算.....

MCDF实验1

vulnhub之GeminiInc v2

Ripper of vulnhub

Groovy测试类 和 Junit测试

Understand go language context in one article

The world's most popular font editor FontCreator tool

Ripper of vulnhub

Excel表格转到Word中,表格不超边缘纸张范围

Based on MCU, how to realize OTA differential upgrade with zero code and no development?
随机推荐
Stm32hal library upgrades firmware based on flash analog U disk (detailed explanation)
P3250 [hnoi2016] Network + [necpc2022] f.tree path tree section + segment tree maintenance heap
STL tutorial 10 container commonalities and usage scenarios
(database authorization - redis) summary of unauthorized access vulnerabilities in redis
ASP.NET-酒店管理系統
P3250 [HNOI2016] 网络 + [NECPC2022] F.Tree Path 树剖+线段树维护堆
DNS多点部署IP Anycast+BGP实战分析
Go语言实现静态服务器
STL Tutorial 9 deep copy and shallow copy of container elements
鸿蒙第四次培训
聊聊Flink框架中的状态管理机制
鸿蒙第三次培训(项目实训)
动态规划(区间dp)
vulnhub之narak
简单工厂和工厂方法模式
机器学习 3.2 决策树模型 学习笔记(待补)
This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system
Linear table sequence table comprehensive application problem p18
Dynamic programming (interval DP)
导师对帮助研究生顺利完成学业提出了20条劝告:第一,不要有度假休息的打算.....