Skip to content

Commit a4a818d

Browse files
PaaS updates
- README updated - Added steps that demonstrate separate provision of service and app deployment
1 parent b22c96d commit a4a818d

3 files changed

Lines changed: 432 additions & 2 deletions

File tree

Lines changed: 279 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,279 @@
1+
FirstMile example usage:
2+
========================
3+
4+
ubuntu@ip-172-31-37-238:~$ git clone https://github.com/cloud-ark/firstmile.git
5+
Cloning into 'firstmile'...
6+
remote: Counting objects: 2265, done.
7+
remote: Compressing objects: 100% (614/614), done.
8+
remote: Total 2265 (delta 1661), reused 2230 (delta 1638), pack-reused 0
9+
Receiving objects: 100% (2265/2265), 325.71 KiB | 0 bytes/s, done.
10+
Resolving deltas: 100% (1661/1661), done.
11+
Checking connectivity... done.
12+
ubuntu@ip-172-31-37-238:~$ cd firstmile/
13+
ubuntu@ip-172-31-37-238:~/firstmile$ ./install.sh
14+
Host OS: Ubuntu
15+
Installing FirstMile. Installation logs stored in install.log
16+
Installing Docker
17+
Installing FirstMile client
18+
~/firstmile/firstmile/bin ~/firstmile
19+
~/firstmile
20+
Starting FirstMile
21+
FirstMile successfully installed.
22+
Next steps:
23+
- Quick test: Run 'cld app list'
24+
- Try sample programs from examples directory
25+
ubuntu@ip-172-31-37-238:~/firstmile$ cld app list
26+
+-----------+----------+-------------+-------+--------+
27+
| Deploy ID | App Name | App Version | Cloud | Status |
28+
+-----------+----------+-------------+-------+--------+
29+
+-----------+----------+-------------+-------+--------+
30+
ubuntu@ip-172-31-37-238:~/firstmile$ cd examples/
31+
ubuntu@ip-172-31-37-238:~/firstmile/examples$ ls
32+
express-checkout greetings-python hello-world README.txt sample-yaml-files
33+
ubuntu@ip-172-31-37-238:~/firstmile/examples$ cd greetings-python/
34+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ ls
35+
application.py README.txt requirements.txt templates
36+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld --help
37+
usage: cld [--version] [-v | -q] [--log-file LOG_FILE] [-h] [--debug]
38+
39+
Multi-cloud application orchestration and service provisioning CLI.
40+
41+
optional arguments:
42+
--version show program's version number and exit
43+
-v, --verbose Increase verbosity of output. Can be repeated.
44+
-q, --quiet Suppress output except warnings and errors.
45+
--log-file LOG_FILE Specify a file to log output. Disabled by default.
46+
-h, --help Show help message and exit.
47+
--debug Show tracebacks on errors.
48+
49+
Commands:
50+
app delete Delete application
51+
app deploy Build and deploy application
52+
app list List applications
53+
app logs Retrieve application deployment and runtime logs
54+
app show Display application information
55+
cloud reset Reset cloud setup in FirstMile sandbox
56+
cloud setup Setup FirstMile sandbox for a particular cloud
57+
complete print bash completion command (cliff)
58+
fm cleanup Display steps to cleanup FirstMile workspace
59+
fm logs Retrieve FirstMile sandbox logs
60+
fm restart Display steps to restart FirstMile sandbox
61+
help print detailed help for another command (cliff)
62+
service delete Delete service instance
63+
service list List service instances
64+
service provision Provision service instance
65+
service restrict-access Restrict access to a service instance
66+
service show Display service instance information
67+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld service provision --help
68+
usage: cld service provision [-h] [--service SERVICE_NAME] [--cloud CLOUD]
69+
70+
Provision service instance
71+
72+
optional arguments:
73+
-h, --help show this help message and exit
74+
--service SERVICE_NAME
75+
Name of the required service (E.g.: mysql)
76+
--cloud CLOUD Destination to deploy application (local-docker, aws,
77+
google)
78+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld service provision --service mysql --cloud local-docker
79+
Deploying instance of mysql on local-docker
80+
+--------------+-----------+--------------+
81+
| Service Name | Deploy ID | Cloud |
82+
+--------------+-----------+--------------+
83+
| mysql | 1 | local-docker |
84+
+--------------+-----------+--------------+
85+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld service list
86+
+-----------+--------------+---------------------+--------------+----------------------------+
87+
| Deploy ID | Service Name | Service Version | Cloud | Status |
88+
+-----------+--------------+---------------------+--------------+----------------------------+
89+
| 1 | mysql | 2018-03-26-15-36-09 | local-docker | DEPLOYING_SERVICE_INSTANCE |
90+
+-----------+--------------+---------------------+--------------+----------------------------+
91+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld service list
92+
+-----------+--------------+---------------------+--------------+----------------------------+
93+
| Deploy ID | Service Name | Service Version | Cloud | Status |
94+
+-----------+--------------+---------------------+--------------+----------------------------+
95+
| 1 | mysql | 2018-03-26-15-36-09 | local-docker | DEPLOYING_SERVICE_INSTANCE |
96+
+-----------+--------------+---------------------+--------------+----------------------------+
97+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld service list
98+
+-----------+--------------+---------------------+--------------+-----------------------------+
99+
| Deploy ID | Service Name | Service Version | Cloud | Status |
100+
+-----------+--------------+---------------------+--------------+-----------------------------+
101+
| 1 | mysql | 2018-03-26-15-36-09 | local-docker | SERVICE_DEPLOYMENT_COMPLETE |
102+
+-----------+--------------+---------------------+--------------+-----------------------------+
103+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld service show
104+
Please enter service deploy id>1
105+
+-----------+---------------------+--------------+-----------------------------+-------------------------------+
106+
| Deploy ID | Service Version | Cloud | Status | Service Info |
107+
+-----------+---------------------+--------------+-----------------------------+-------------------------------+
108+
| 1 | 2018-03-26-15-36-09 | local-docker | SERVICE_DEPLOYMENT_COMPLETE | MYSQL_VERSION: mysql:5.5 |
109+
| | | | | DB_NAME: testdb |
110+
| | | | | USER: testuser |
111+
| | | | | HOST IP: 172.17.0.3 |
112+
| | | | | PASSWORD: testpass123!#$ |
113+
| | | | | ROOT_PASSWORD: testpass123!#$ |
114+
| | | | | |
115+
+-----------+---------------------+--------------+-----------------------------+-------------------------------+
116+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cp ../sample-yaml-files/cld.yaml.local-docker .
117+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ mv cld.yaml.local-docker cld.yaml
118+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ more cld.yaml
119+
application:
120+
type: python
121+
entry_point: application.py
122+
env_variables:
123+
DB: testdb
124+
HOST: 172.17.0.4
125+
USER: testuser
126+
PASSWORD: testpass123!#$
127+
cloud:
128+
type: local-docker
129+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ vi cld.yaml
130+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ more cld.yaml
131+
application:
132+
type: python
133+
entry_point: application.py
134+
env_variables:
135+
DB: testdb
136+
HOST: 172.17.0.3
137+
USER: testuser
138+
PASSWORD: testpass123!#$
139+
cloud:
140+
type: local-docker
141+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld app deploy
142+
+------------------+-----------+--------------+
143+
| App Name | Deploy ID | Cloud |
144+
+------------------+-----------+--------------+
145+
| greetings-python | 1 | local-docker |
146+
+------------------+-----------+--------------+
147+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld app list
148+
+-----------+------------------+---------------------+--------------+--------+
149+
| Deploy ID | App Name | App Version | Cloud | Status |
150+
+-----------+------------------+---------------------+--------------+--------+
151+
| 1 | greetings-python | 2018-03-26-15-38-35 | local-docker | |
152+
+-----------+------------------+---------------------+--------------+--------+
153+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld app list
154+
+-----------+------------------+---------------------+--------------+--------------+
155+
| Deploy ID | App Name | App Version | Cloud | Status |
156+
+-----------+------------------+---------------------+--------------+--------------+
157+
| 1 | greetings-python | 2018-03-26-15-38-35 | local-docker | BUILDING_APP |
158+
+-----------+------------------+---------------------+--------------+--------------+
159+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld app list
160+
+-----------+------------------+---------------------+--------------+--------------+
161+
| Deploy ID | App Name | App Version | Cloud | Status |
162+
+-----------+------------------+---------------------+--------------+--------------+
163+
| 1 | greetings-python | 2018-03-26-15-38-35 | local-docker | BUILDING_APP |
164+
+-----------+------------------+---------------------+--------------+--------------+
165+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld app list
166+
+-----------+------------------+---------------------+--------------+-------------------------+
167+
| Deploy ID | App Name | App Version | Cloud | Status |
168+
+-----------+------------------+---------------------+--------------+-------------------------+
169+
| 1 | greetings-python | 2018-03-26-15-38-35 | local-docker | APP_DEPLOYMENT_COMPLETE |
170+
+-----------+------------------+---------------------+--------------+-------------------------+
171+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld app show
172+
Please enter deploy id>1
173+
+------------------+---------------------+--------------+-------------------------+----------------------------------+
174+
| App Name | App Version | Cloud | Status | App Info |
175+
+------------------+---------------------+--------------+-------------------------+----------------------------------+
176+
| greetings-python | 2018-03-26-15-38-35 | local-docker | APP_DEPLOYMENT_COMPLETE | APP URL: http://localhost:32768 |
177+
| | | | | |
178+
+------------------+---------------------+--------------+-------------------------+----------------------------------+
179+
180+
-------------------------------------------------------------------------------------------------------------------------------
181+
182+
Verify Deployment:
183+
==================
184+
185+
186+
If using your own Laptop:
187+
-------------------------
188+
- Open browser to point to the APP URL
189+
190+
191+
If using Ubuntu VM on AWS:
192+
--------------------------
193+
- Find Public IP address of the VM
194+
- Open browser to point to the APP URL with 'localhost' replaced with the Public IP address of the VM
195+
196+
197+
Verify DB interactions:
198+
-----------------------
199+
200+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ sudo apt-get install mysql-client
201+
Reading package lists... Done
202+
Building dependency tree
203+
Reading state information... Done
204+
The following additional packages will be installed:
205+
libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-common
206+
The following NEW packages will be installed:
207+
libaio1 mysql-client mysql-client-5.7 mysql-client-core-5.7 mysql-common
208+
0 upgraded, 5 newly installed, 0 to remove and 60 not upgraded.
209+
Need to get 8,072 kB of archives.
210+
After this operation, 65.9 MB of additional disk space will be used.
211+
Do you want to continue? [Y/n] Y
212+
Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu xenial/main amd64 libaio1 amd64 0.3.110-2 [6,356 B]
213+
Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-client-core-5.7 amd64 5.7.21-0ubuntu0.16.04.1 [6,363 kB]
214+
:
215+
:
216+
Setting up mysql-client-5.7 (5.7.21-0ubuntu0.16.04.1) ...
217+
Setting up mysql-client (5.7.21-0ubuntu0.16.04.1) ...
218+
Processing triggers for libc-bin (2.23-0ubuntu10) ...
219+
220+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ cld service show
221+
Please enter service deploy id>1
222+
+-----------+---------------------+--------------+-----------------------------+-------------------------------+
223+
| Deploy ID | Service Version | Cloud | Status | Service Info |
224+
+-----------+---------------------+--------------+-----------------------------+-------------------------------+
225+
| 1 | 2018-03-26-15-36-09 | local-docker | SERVICE_DEPLOYMENT_COMPLETE | MYSQL_VERSION: mysql:5.5 |
226+
| | | | | DB_NAME: testdb |
227+
| | | | | USER: testuser |
228+
| | | | | HOST IP: 172.17.0.3 |
229+
| | | | | PASSWORD: testpass123!#$ |
230+
| | | | | ROOT_PASSWORD: testpass123!#$ |
231+
| | | | | |
232+
+-----------+---------------------+--------------+-----------------------------+-------------------------------+
233+
234+
ubuntu@ip-172-31-37-238:~/firstmile/examples/greetings-python$ mysql -h 172.17.0.3 --user=testuser --password='testpass123!#$'
235+
mysql: [Warning] Using a password on the command line interface can be insecure.
236+
Welcome to the MySQL monitor. Commands end with ; or \g.
237+
Your MySQL connection id is 7
238+
Server version: 5.5.59 MySQL Community Server (GPL)
239+
240+
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
241+
242+
Oracle is a registered trademark of Oracle Corporation and/or its
243+
affiliates. Other names may be trademarks of their respective
244+
owners.
245+
246+
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
247+
248+
mysql> show databases;
249+
+--------------------+
250+
| Database |
251+
+--------------------+
252+
| information_schema |
253+
| testdb |
254+
+--------------------+
255+
2 rows in set (0.00 sec)
256+
257+
mysql> use testdb;
258+
Reading table information for completion of table and column names
259+
You can turn off this feature to get a quicker startup with -A
260+
261+
Database changed
262+
mysql> show tables;
263+
+------------------+
264+
| Tables_in_testdb |
265+
+------------------+
266+
| message |
267+
+------------------+
268+
1 row in set (0.00 sec)
269+
270+
mysql> select * from message;
271+
+----+-----------------------+
272+
| id | greeting |
273+
+----+-----------------------+
274+
| 1 | Hello, World! |
275+
| 2 | Hello Cloud Computing |
276+
+----+-----------------------+
277+
2 rows in set (0.00 sec)
278+
279+
mysql>exit;

0 commit comments

Comments
 (0)