In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use Mac to build WordPress on CoreOS". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use Mac to build WordPress on CoreOS.
I'm sure you've heard of CoreOS, but have you actually deployed an application on it? Maybe a lot of people haven't deployed. Building an application on CoreOS is very difficult and frustrating. (translator's note: frustrating, using this word, seems really difficult). Because the documents are messy, and you have to learn all the relevant techniques, including etcd, systemd, and Docker, before you start. If you are as lazy as I am and just want to try CoreOS instead of making a mountain out of a molehill, let me help you. Next we will create a simple WordPress application and MySQL database on CoreOS.
If you are using Mac, you can control CoreOS by installing command-line tools
Fleetctl and etcdctl are native tools for controlling CoreOS clusters. The installation steps are as follows:
The code is as follows:
$brew install go etcdctl
$git clone https://github.com/coreos/fleet.git
$cd fleet
$. / build
$mv bin/fleetctl / usr/local/bin/
Install a local CoreOS cluster and run
Vagrant is very simple.
The code is as follows:
$git clone https://github.com/CenturyLinkLabs/coreos-vagrant
$cd coreos-vagrant/cluster
$vagrant up-provision
Now you have a cluster of three smallest CoreOS systems on your laptop. It's very simple. Now let's check it out using fleetctl.
The code is as follows:
$fleetctl list-machines MACHINE IP METADATA
09fd0a88... 10.0.2.15-
77763947... 10.0.2.15-
F31c383c... 10.0.2.15-
That's great. Let's run.
Deploy applications on a CoreOS cluster using fleet
Now you have a CoreOS cluster. Next, the fleetctl command allows you to deploy the application on the CoreOS cluster node, but write the service file in fleet. Of course, you don't have to write it yourself. You can generate service files in a simple YAML format.
The code is as follows:
$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
The fleetctl client tool uses etcd's key store to determine which servers it wants to access and which servers in the access cluster have etcd servers running. Here is how to deploy your application in a CoreOS cluster.
The code is as follows:
$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 your program is running, but the service is not registered with etcd yet. Fortunately, fig2coreos has automatically generated service files for us.
The code is as follows:
$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"}
Deployment complete
That's it. It's done. Using the Vagrant Cloud account in Vagrant 1.5, you can access your WordPress application. As shown below:
The code is as follows:
$cd ~ / coreos-vagrant/cluster/
Find out which machine is listening on your port 80:
The code is as follows:
$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
Thank you for your reading, the above is the content of "how to use Mac to build WordPress on CoreOS". After the study of this article, I believe you have a deeper understanding of how to use Mac to build WordPress on CoreOS, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.