Skip to content

Commit 17ef73f

Browse files
author
Mihaela Blendea
committed
Add notebook for installing cluster dependencies
1 parent 7cdc915 commit 17ef73f

File tree

1 file changed

+316
-0
lines changed

1 file changed

+316
-0
lines changed
Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"Install Dependencies to deploy SQL Server 2019 Big Data Clusters\n",
8+
"----------------------------------------------------------------\n",
9+
"\n",
10+
"The following tools are most important for managing, connecting to, and\n",
11+
"querying the cluster:\n",
12+
"\n",
13+
"- **Azure CLI**\n",
14+
"- **kubectl**\n",
15+
"- **mssqlctl**\n",
16+
"\n",
17+
"**The cell below tries to install these dependencies for you. If you\n",
18+
"still experience any issues in executing this cell then please install\n",
19+
"from the following Installation links below.**\n",
20+
"\n",
21+
"<table>\n",
22+
"<colgroup>\n",
23+
"<col style=\"width: 27%\" />\n",
24+
"<col style=\"width: 24%\" />\n",
25+
"<col style=\"width: 24%\" />\n",
26+
"<col style=\"width: 24%\" />\n",
27+
"</colgroup>\n",
28+
"<thead>\n",
29+
"<tr class=\"header\">\n",
30+
"<th>Tool</th>\n",
31+
"<th>Required</th>\n",
32+
"<th>Description</th>\n",
33+
"<th>Installation</th>\n",
34+
"</tr>\n",
35+
"</thead>\n",
36+
"<tbody>\n",
37+
"<tr class=\"odd\">\n",
38+
"<td><strong>mssqlctl</strong></td>\n",
39+
"<td>Yes</td>\n",
40+
"<td>Command-line tool for installing and managing a big data cluster.</td>\n",
41+
"<td><a href=\"deploy-install-mssqlctl.md\">Install</a></td>\n",
42+
"</tr>\n",
43+
"<tr class=\"even\">\n",
44+
"<td><strong>kubectl</strong></td>\n",
45+
"<td>Yes</td>\n",
46+
"<td>Command-line tool for monitoring the underlying Kuberentes cluster (<a href=\"https://kubernetes.io/docs/tasks/tools/install-kubectl/\">More info</a>).</td>\n",
47+
"<td><a href=\"https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-powershell-from-psgallery\">Windows</a> | <a href=\"https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-using-native-package-management\">Linux</a></td>\n",
48+
"</tr>\n",
49+
"<tr class=\"odd\">\n",
50+
"<td><strong>Azure CLI</strong></td>\n",
51+
"<td>For AKS</td>\n",
52+
"<td>Modern command-line interface for managing Azure services. Used with AKS big data cluster deployments (<a href=\"https://docs.microsoft.com/cli/azure/?view=azure-cli-latest\">More info</a>).</td>\n",
53+
"<td><a href=\"https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest\">Install</a></td>\n",
54+
"</tr>\n",
55+
"</tbody>\n",
56+
"</table>\n",
57+
"\n",
58+
"Steps\n",
59+
"-----\n",
60+
"\n",
61+
"### Provide overrides for any default installation parameters\n",
62+
"\n",
63+
"You don’t need to provide any installation parameters, we’ll provide a\n",
64+
"set of default which will provide a good experience.\n",
65+
"\n",
66+
"However, feel free to override any of the defaults provided below here:"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": null,
72+
"metadata": {},
73+
"outputs": [],
74+
"source": [
75+
"mssql_version=\"\"\n",
76+
"docker_registry=\"\"\n",
77+
"\n",
78+
"windows_azcli_url=\"\"\n",
79+
"windows_kubectl_url=\"\"\n",
80+
"\n",
81+
"azure_cli_use_force_install_option = None\n",
82+
"azure_cli_use_user_install_option = None\n",
83+
"\n",
84+
"mssqlctl_url=\"\" # url to download mssqlctl from (without ending filename)\n",
85+
"mssqlctl_use_force_install_option = None\n",
86+
"mssqlctl_use_user_install_option = None\n",
87+
"\n",
88+
"skip_mssqlctl_uninstall = None\n",
89+
"skip_mssqlctl_install = None"
90+
]
91+
},
92+
{
93+
"cell_type": "markdown",
94+
"metadata": {},
95+
"source": [
96+
"### Provide default installation parameters\n",
97+
"\n",
98+
"A default set of parameters to provide a good initial experience of SQL\n",
99+
"Server 2019 big data clusters."
100+
]
101+
},
102+
{
103+
"cell_type": "code",
104+
"execution_count": null,
105+
"metadata": {},
106+
"outputs": [],
107+
"source": [
108+
"if mssql_version==\"\":\n",
109+
" mssql_version=\"ctp-2.5\"\n",
110+
"\n",
111+
"if windows_azcli_url==\"\":\n",
112+
" windows_azcli_url=\"https://aka.ms/installazurecliwindows\"\n",
113+
"\n",
114+
"if windows_kubectl_url==\"\":\n",
115+
" windows_kubectl_url=\"https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/windows/amd64/kubectl.exe\"\n",
116+
"\n",
117+
"if docker_repository==\"\":\n",
118+
" docker_repository=\"aris-p-release-candidate-gb\"\n",
119+
"\n",
120+
"if mssqlctl_url==\"\":\n",
121+
" mssqlctl_url=\"\"http://helsinki/browse/packages/python/{0}/mssqlctl/{1}\".format(docker_repository, 'requirements.txt')\n",
122+
"\n",
123+
"if azure_cli_use_force_install_option is None:\n",
124+
" azure_cli_use_force_install_option = False\n",
125+
"\n",
126+
"if azure_cli_use_user_install_option is None:\n",
127+
" azure_cli_use_user_install_option = True\n",
128+
"\n",
129+
"if mssqlctl_use_force_install_option is None:\n",
130+
" mssqlctl_use_force_install_option = False\n",
131+
"\n",
132+
"if mssqlctl_use_user_install_option is None:\n",
133+
" mssqlctl_use_user_install_option = True\n",
134+
"\n",
135+
"if skip_mssqlctl_uninstall is None:\n",
136+
" skip_mssqlctl_uninstall = True\n",
137+
"\n",
138+
"if skip_mssqlctl_install is None:\n",
139+
" skip_mssqlctl_install = False\n",
140+
"\n",
141+
"print('mssql_version = ' + mssql_version)\n",
142+
"print('docker_registry = ' + docker_registry)\n",
143+
"print('azure_cli_use_force_install_option = ' + str(azure_cli_use_force_install_option))\n",
144+
"print('azure_cli_use_user_install_option = ' + str(azure_cli_use_user_install_option))\n",
145+
"print('mssqlctl_url = ' + mssqlctl_url)\n",
146+
"print('mssqlctl_use_force_install_option = ' + str(mssqlctl_use_force_install_option))\n",
147+
"print('mssqlctl_use_user_install_option = ' + str(mssqlctl_use_user_install_option))\n",
148+
"print('skip_mssqlctl_uninstall = ' + str(skip_mssqlctl_uninstall))\n",
149+
"print('skip_mssqlctl_install = ' + str(skip_mssqlctl_install))"
150+
]
151+
},
152+
{
153+
"cell_type": "markdown",
154+
"metadata": {},
155+
"source": [
156+
"### Install Azure CLI"
157+
]
158+
},
159+
{
160+
"cell_type": "code",
161+
"execution_count": null,
162+
"metadata": {},
163+
"outputs": [],
164+
"source": [
165+
"import sys\n",
166+
"\n",
167+
"force_install_option='--force-install' if azure_cli_use_force_install_option else ''\n",
168+
"user_install_option='--user' if azure_cli_use_user_install_option else ''\n",
169+
"\n",
170+
"print(f'START: !{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}\\n')\n",
171+
"\n",
172+
"!{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}\n",
173+
"if _exit_code != 0:\n",
174+
" raise SystemExit('Shell command:\\n\\n\\t!{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
175+
"\n",
176+
"print(f'\\nSUCCESS: !{sys.executable} -m pip install azure-cli {force_install_option} {user_install_option}')"
177+
]
178+
},
179+
{
180+
"cell_type": "markdown",
181+
"metadata": {},
182+
"source": [
183+
"### Install Kubernetes CLI"
184+
]
185+
},
186+
{
187+
"cell_type": "code",
188+
"execution_count": null,
189+
"metadata": {},
190+
"outputs": [],
191+
"source": [
192+
"import platform\n",
193+
"import requests\n",
194+
"import sys\n",
195+
"\n",
196+
"if platform.system()==\"Darwin\":\n",
197+
" print(f'START: !brew update\\n')\n",
198+
"\n",
199+
" !brew update\n",
200+
" if _exit_code != 0:\n",
201+
" raise SystemExit('Shell command:\\n\\n\\t !brew update\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
202+
"\n",
203+
" print(f'\\nSUCCESS: !brew update')\n",
204+
" print(f'START: !brew install kubernetes-cli\\n')\n",
205+
"\n",
206+
" !brew install kubernetes-cli\n",
207+
" if _exit_code != 0:\n",
208+
" raise SystemExit('Shell command:\\n\\n\\t !brew install kubernetes-cli\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
209+
"\n",
210+
" print(f'\\nSUCCESS: !brew install kubernetes-cli')\n",
211+
"elif platform.system()==\"Windows\":\n",
212+
" print(f'START: !curl -LO {windows_kubectl_url}\\n')\n",
213+
"\n",
214+
" !curl -LO {windows_kubectl_url}\n",
215+
" if _exit_code != 0:\n",
216+
" raise SystemExit('Shell command:\\n\\n\\t !curl -LO {windows_kubectl_url}\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
217+
"\n",
218+
" print(f'\\nSUCCESS: !curl -LO {windows_kubectl_url}')\n",
219+
"elif platform.system()==\"Linux\":\n",
220+
" print(f'START: !sudo apt-get update\\n')\n",
221+
"\n",
222+
" !sudo apt-get update\n",
223+
" if _exit_code != 0:\n",
224+
" raise SystemExit('Shell command:\\n\\n\\t !sudo apt-get update\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
225+
"\n",
226+
" print(f'\\nSUCCESS: !sudo apt-get update')\n",
227+
" print(f'START: !sudo apt-get install -y kubectl\\n')\n",
228+
"\n",
229+
" !sudo apt-get install -y kubectl\n",
230+
" if _exit_code != 0:\n",
231+
" raise SystemExit('Shell command:\\n\\n\\t !sudo apt-get install -y kubectl\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
232+
"\n",
233+
" print(f'\\nSUCCESS: !sudo apt-get install -y kubectl')\n",
234+
"else:\n",
235+
" raise SystemExit(\"Platform '{0}' is not recognized, must be 'Darwin', 'Windows' or 'Linux'\".format(platform.system()))"
236+
]
237+
},
238+
{
239+
"cell_type": "markdown",
240+
"metadata": {},
241+
"source": [
242+
"### Uninstall MSSQLCTL CLI"
243+
]
244+
},
245+
{
246+
"cell_type": "code",
247+
"execution_count": null,
248+
"metadata": {},
249+
"outputs": [],
250+
"source": [
251+
"import sys\n",
252+
"\n",
253+
"if not skip_mssqlctl_uninstall:\n",
254+
" print(f'START: !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki\\n')\n",
255+
"\n",
256+
" !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki\n",
257+
" if _exit_code != 0:\n",
258+
" raise SystemExit('Shell command:\\n\\n\\t !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
259+
"\n",
260+
" print(f'\\nSUCCESS: !{sys.executable} -m pip uninstall -r {mssqlctl_url} --yes --trusted-host helsinki')"
261+
]
262+
},
263+
{
264+
"cell_type": "markdown",
265+
"metadata": {},
266+
"source": [
267+
"### Install MSSQLCTL CLI"
268+
]
269+
},
270+
{
271+
"cell_type": "code",
272+
"execution_count": null,
273+
"metadata": {},
274+
"outputs": [],
275+
"source": [
276+
"import sys\n",
277+
"\n",
278+
"force_install_option='--force-install' if mssqlctl_use_force_install_option else ''\n",
279+
"user_install_option='--user' if mssqlctl_use_user_install_option else ''\n",
280+
"\n",
281+
"if not skip_mssqlctl_install:\n",
282+
" print(f'START: !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki\\n')\n",
283+
"\n",
284+
" !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki\n",
285+
" if _exit_code != 0:\n",
286+
" raise SystemExit('Shell command:\\n\\n\\t !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki\\n\\nreturned non-zero exit code: ' + str(_exit_code) + '.\\n')\n",
287+
"\n",
288+
" print(f'\\nSUCCESS: !{sys.executable} -m pip install -r {mssqlctl_url} {force_install_option} {user_install_option} --trusted-host helsinki')"
289+
]
290+
}
291+
],
292+
"nbformat": 4,
293+
"nbformat_minor": 5,
294+
"metadata": {
295+
"kernelspec": {
296+
"name": "python3",
297+
"display_name": "Python 3"
298+
},
299+
"azdata": {
300+
"test": {
301+
"strategy": "Sequential",
302+
"dri": false,
303+
"ci": false,
304+
"gci": false
305+
},
306+
"publish": {
307+
"access": {
308+
"current": "Internal",
309+
"goal": "Public"
310+
},
311+
"state": "Draft"
312+
}
313+
}
314+
}
315+
}
316+

0 commit comments

Comments
 (0)