当前位置:网站首页>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 --provision
Now 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.service
fleetctl 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.15
Now 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.com
The 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 .
边栏推荐
- 一些常用术语
- Extrapolated scatter data
- Nestjs配置服务,配置Cookie和Session
- Programmers' entrepreneurial trap: taking private jobs
- This article explains the complex relationship between MCU, arm, MCU, DSP, FPGA and embedded system
- How to get started embedded future development direction of embedded
- typeScript
- R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g
- 机器学习 3.2 决策树模型 学习笔记(待补)
- Phpcms prompt message page Jump to showmessage
猜你喜欢
ASP.NET-酒店管理系統
Ripper of vulnhub
XML (DTD, XML parsing, XML modeling)
同事写了一个责任链模式,bug无数...
ftp登录时,报错“530 Login incorrect.Login failed”
C language AES encryption and decryption
Numpy np.max和np.maximum实现relu函数
Gut | Yu Jun group of the Chinese University of Hong Kong revealed that smoking changes intestinal flora and promotes colorectal cancer (do not smoke)
vulnhub之presidential
PHP基础
随机推荐
《剑指offer 04》二维数组查找
uniapp实现点击加载更多
ftp登录时,报错“530 Login incorrect.Login failed”
Gut | Yu Jun group of the Chinese University of Hong Kong revealed that smoking changes intestinal flora and promotes colorectal cancer (do not smoke)
How to mix embedded MCU, arm and DSP?
R language uses grid of gridextra package The array function combines multiple visual images of the lattice package horizontally, and the ncol parameter defines the number of columns of the combined g
Capturing and sorting out external Fiddler -- Conversation bar and filter [2]
vulnhub之momentum
Internet socket (non) blocking write/read n bytes
Arctangent entropy: the latest SCI paper in July 2022
Ripper of vulnhub
Numpy np. Max and np Maximum implements the relu function
STL教程10-容器共性和使用场景
Excel quick cross table copy and paste
After using the thread pool for so long, do you really know how to reasonably configure the number of threads?
POI excel cell wrap
DS90UB949
Cacti监控Redis实现过程
Web security summary
Dynamic programming (interval DP)