@@ -30,13 +30,14 @@ scheduled to run on a node that has the `ssd` label.
30302 . Select ** Nodes** in the left-hand navigation menu.
31313 . In the nodes list, select the node to which you want to apply labels.
32324 . In the details pane, select the edit node icon in the upper-right corner to edit the node.
33+
3334 ![ ] ( ../../images/add-labels-to-cluster-nodes-3.png )
3435
35365 . In the ** Edit Node** page, scroll down to the ** Labels** section.
36376 . Select ** Add Label** .
37387 . Add a label with the key ` disk ` and a value of ` ssd ` .
3839
39- ![ ] ( ../../images/add-labels-to-cluster-nodes-2.png ) {: .with-border}
40+ ![ ] ( ../../images/add-labels-to-cluster-nodes-2.png ) {: .with-border}
4041
41428 . Click ** Save** then dismiss the ** Edit Node** page.
42439 . In the node's details pane, select ** Labels** to view the labels that are applied to the node.
@@ -60,67 +61,66 @@ service to be scheduled only on nodes that have SSD storage:
60611 . Navigate to the ** Stacks** page.
61622 . Name the new stack "wordpress".
62633 . Under ** Orchestrator Mode** , select ** Swarm Services** .
63-
64644 . In the ** docker-compose.yml** editor, paste the following stack file.
6565
66- ```
67- version: "3.1"
68-
69- services:
70- db:
71- image: mysql:5.7
72- deploy:
73- placement:
74- constraints:
75- - node.labels.disk == ssd
76- restart_policy:
77- condition: on-failure
78- networks:
79- - wordpress-net
80- environment:
81- MYSQL_ROOT_PASSWORD: wordpress
82- MYSQL_DATABASE: wordpress
83- MYSQL_USER: wordpress
84- MYSQL_PASSWORD: wordpress
85- wordpress:
86- depends_on:
87- - db
88- image: wordpress:latest
89- deploy:
90- replicas: 1
91- placement:
92- constraints:
93- - node.labels.disk == ssd
94- restart_policy:
95- condition: on-failure
96- max_attempts: 3
97- networks:
98- - wordpress-net
99- ports:
100- - "8000:80"
101- environment:
102- WORDPRESS_DB_HOST: db:3306
103- WORDPRESS_DB_PASSWORD: wordpress
104-
105- networks:
106- wordpress-net:
107- ```
66+ ```
67+ version: "3.1"
68+
69+ services:
70+ db:
71+ image: mysql:5.7
72+ deploy:
73+ placement:
74+ constraints:
75+ - node.labels.disk == ssd
76+ restart_policy:
77+ condition: on-failure
78+ networks:
79+ - wordpress-net
80+ environment:
81+ MYSQL_ROOT_PASSWORD: wordpress
82+ MYSQL_DATABASE: wordpress
83+ MYSQL_USER: wordpress
84+ MYSQL_PASSWORD: wordpress
85+ wordpress:
86+ depends_on:
87+ - db
88+ image: wordpress:latest
89+ deploy:
90+ replicas: 1
91+ placement:
92+ constraints:
93+ - node.labels.disk == ssd
94+ restart_policy:
95+ condition: on-failure
96+ max_attempts: 3
97+ networks:
98+ - wordpress-net
99+ ports:
100+ - "8000:80"
101+ environment:
102+ WORDPRESS_DB_HOST: db:3306
103+ WORDPRESS_DB_PASSWORD: wordpress
104+
105+ networks:
106+ wordpress-net:
107+ ```
108108
1091095 . Click ** Create** to deploy the stack, and when the stack deploys,
110110click ** Done** .
111111
112- ![ ] ( ../../images/use-constraints-in-stack-deployment.png )
112+ ![ ] ( ../../images/use-constraints-in-stack-deployment.png )
113113
1141146 . Navigate to the ** Nodes** page, and click the node that has the
115115` disk ` label. In the details pane, click the ** Inspect Resource**
116116dropdown and select ** Containers** .
117117
118- ![ ] ( ../../images/use-constraints-in-stack-deployment-2.png )
118+ ![ ] ( ../../images/use-constraints-in-stack-deployment-2.png )
119119
120- Dismiss the filter and navigate to the ** Nodes** page. Click a node that
121- doesn't have the ` disk ` label. In the details pane, click the
122- ** Inspect Resource** dropdown and select ** Containers** . There are no
123- WordPress containers scheduled on the node. Dismiss the filter.
120+ Dismiss the filter and navigate to the ** Nodes** page. Click a node that
121+ doesn't have the ` disk ` label. In the details pane, click the
122+ ** Inspect Resource** dropdown and select ** Containers** . There are no
123+ WordPress containers scheduled on the node. Dismiss the filter.
124124
125125## Add a constraint to a service by using the UCP web UI
126126
@@ -143,4 +143,4 @@ You can add or remove deployment constraints on this page.
143143## Where to go next
144144
145145- [ Collect UCP Cluster Metrics with Prometheus] ( collect-cluster-metrics.md )
146- - [ Configure UCP Audit Logging] ( create-audit-logs.md )
146+ - [ Configure UCP Audit Logging] ( create-audit-logs.md )
0 commit comments