Skip to content

Instantly share code, notes, and snippets.

@dianachua
Created October 16, 2020 04:00
Show Gist options
  • Save dianachua/a7e2ab272b7ce8602f283dcf0157ae81 to your computer and use it in GitHub Desktop.
Save dianachua/a7e2ab272b7ce8602f283dcf0157ae81 to your computer and use it in GitHub Desktop.
Created on Skills Network Labs
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Cloning into 'Lab4-Adding-Discovery-to-Chatbot'...\n"
]
}
],
"source": [
"%%bash\n",
"mkdir lab4\n",
"cd lab4\n",
"git clone https://github.com/sophiajwchoi/Lab4-Adding-Discovery-to-Chatbot.git"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting package metadata (current_repodata.json): ...working... done\n",
"Solving environment: ...working... done\n",
"\n",
"## Package Plan ##\n",
"\n",
" environment location: /home/jupyterlab/conda/envs/python\n",
"\n",
" added / updated specs:\n",
" - nodejs\n",
"\n",
"\n",
"The following packages will be downloaded:\n",
"\n",
" package | build\n",
" ---------------------------|-----------------\n",
" ca-certificates-2020.7.22 | 0 125 KB\n",
" certifi-2020.6.20 | py36_0 156 KB\n",
" nodejs-10.13.0 | he6710b0_0 13.0 MB\n",
" openssl-1.1.1h | h7b6447c_0 2.5 MB\n",
" ------------------------------------------------------------\n",
" Total: 15.8 MB\n",
"\n",
"The following packages will be UPDATED:\n",
"\n",
" ca-certificates conda-forge::ca-certificates-2020.6.2~ --> pkgs/main::ca-certificates-2020.7.22-0\n",
"\n",
"The following packages will be SUPERSEDED by a higher-priority channel:\n",
"\n",
" certifi conda-forge::certifi-2020.6.20-py36h9~ --> pkgs/main::certifi-2020.6.20-py36_0\n",
" nodejs conda-forge::nodejs-10.15.3-hf484d3e_0 --> pkgs/main::nodejs-10.13.0-he6710b0_0\n",
" openssl conda-forge::openssl-1.1.1h-h516909a_0 --> pkgs/main::openssl-1.1.1h-h7b6447c_0\n",
"\n",
"\n",
"\n",
"Downloading and Extracting Packages\n",
"nodejs-10.13.0 | 13.0 MB | ########## | 100% \n",
"certifi-2020.6.20 | 156 KB | ########## | 100% \n",
"openssl-1.1.1h | 2.5 MB | ########## | 100% \n",
"ca-certificates-2020 | 125 KB | ########## | 100% \n",
"Preparing transaction: ...working... done\n",
"Verifying transaction: ...working... done\n",
"Executing transaction: ...working... done\n",
"make: Entering directory '/resources/lab4/Lab4-Adding-Discovery-to-Chatbot/node_modules/websocket/build'\n",
" CXX(target) Release/obj.target/bufferutil/src/bufferutil.o\n",
" SOLINK_MODULE(target) Release/obj.target/bufferutil.node\n",
" COPY Release/bufferutil.node\n",
" CXX(target) Release/obj.target/validation/src/validation.o\n",
" SOLINK_MODULE(target) Release/obj.target/validation.node\n",
" COPY Release/validation.node\n",
"make: Leaving directory '/resources/lab4/Lab4-Adding-Discovery-to-Chatbot/node_modules/websocket/build'\n",
"added 130 packages from 178 contributors and audited 130 packages in 86.315s\n",
"found 4 vulnerabilities (2 low, 2 high)\n",
" run `npm audit fix` to fix them, or `npm audit` for details\n"
]
}
],
"source": [
"%%bash\n",
"cd /resources/lab4/Lab4-Adding-Discovery-to-Chatbot\n",
"export npm_config_loglevel=silent\n",
"conda config --set notify_outdated_conda false\n",
"conda install nodejs -y\n",
"rm -f ~/.npmrc\n",
"npm install"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"API endpoint: https://cloud.ibm.com\n",
"\n",
"Email> [email protected]\n",
"\n",
"Password> \n",
"Authenticating...\n",
"OK\n",
"\n",
"Targeted account Diana Chua's Account (926cea9b37124f979c512c5e53a06f34)\n",
"\n",
" \n",
"API endpoint: https://cloud.ibm.com \n",
"Region: \n",
"User: [email protected] \n",
"Account: Diana Chua's Account (926cea9b37124f979c512c5e53a06f34) \n",
"Resource group: No resource group targeted, use 'ibmcloud target -g RESOURCE_GROUP' \n",
"CF API endpoint: \n",
"Org: \n",
"Space: \n",
"\n",
"We'd like to collect usage statistics to help improve the IBM Cloud CLI.\n",
"This data will never be shared outside IBM.\n",
"To learn more, see the IBM Privacy Policy: https://www.ibm.com/privacy\n",
"You can enable or disable usage data collection by running 'ibmcloud config --usage-stats-collect [true | false]'\n",
"\n",
"Do you want to send usage statistics to IBM? [y/n]> \n"
]
}
],
"source": [
"%%bash\n",
"ibmcloud config --check-version=false\n",
"ibmcloud login --no-region\n",
"[email protected]\n",
"Pass202008"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Getting orgs in all regions as [email protected]...\n",
"Retrieving current account...\n",
"OK\n",
"\n",
"Name Region Account owner Account ID Status \n",
"[email protected] us-south [email protected] 926cea9b37124f979c512c5e53a06f34 active \n",
"\n"
]
}
],
"source": [
"%%bash\n",
"ibmcloud account orgs"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Switched to region us-south\n",
"\n",
"Targeted Cloud Foundry (https://api.us-south.cf.cloud.ibm.com)\n",
"\n",
"Targeted org [email protected]\n",
"\n",
"\n",
" \n",
"API endpoint: https://cloud.ibm.com \n",
"Region: us-south \n",
"User: [email protected] \n",
"Account: Diana Chua's Account (926cea9b37124f979c512c5e53a06f34) \n",
"Resource group: No resource group targeted, use 'ibmcloud target -g RESOURCE_GROUP' \n",
"CF API endpoint: https://api.us-south.cf.cloud.ibm.com (API version: 2.153.0) \n",
"Org: [email protected] \n",
"Space: \n",
"Creating space lab4 in org [email protected] as [email protected]...\n",
"OK\n",
"Assigning role SpaceManager to user [email protected] in org [email protected] / space lab4 as [email protected]...\n",
"OK\n",
"Assigning role SpaceDeveloper to user [email protected] in org [email protected] / space lab4 as [email protected]...\n",
"OK\n"
]
}
],
"source": [
"%%bash\n",
"ibmcloud target --cf-api 'https://api.us-south.cf.cloud.ibm.com' -r us-south -o [email protected]\n",
"ibmcloud account space-create 'lab4'"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Targeted space lab4\n",
"\n",
"\n",
" \n",
"API endpoint: https://cloud.ibm.com \n",
"Region: us-south \n",
"User: [email protected] \n",
"Account: Diana Chua's Account (926cea9b37124f979c512c5e53a06f34) \n",
"Resource group: No resource group targeted, use 'ibmcloud target -g RESOURCE_GROUP' \n",
"CF API endpoint: https://api.us-south.cf.cloud.ibm.com (API version: 2.153.0) \n",
"Org: [email protected] \n",
"Space: lab4 \n",
"Looking up 'cloud-functions' from repository 'IBM Cloud'...\n",
"Plug-in 'cloud-functions/wsk/functions/fn 1.0.47' found in repository 'IBM Cloud'\n",
"Attempting to download the binary file...\n",
" 13.78 MiB / 13.78 MiB 100.00% 0s\n",
"14446737 bytes downloaded\n",
"Installing binary...\n",
"OK\n",
"Plug-in 'cloud-functions 1.0.47' was successfully installed into /home/jupyterlab/.bluemix/plugins/cloud-functions. Use 'ibmcloud plugin show cloud-functions' to show its details.\n",
"/home/jupyterlab/conda/envs/python/bin/serverless -> /home/jupyterlab/conda/envs/python/lib/node_modules/serverless/bin/serverless.js\n",
"/home/jupyterlab/conda/envs/python/bin/slss -> /home/jupyterlab/conda/envs/python/lib/node_modules/serverless/bin/serverless.js\n",
"/home/jupyterlab/conda/envs/python/bin/sls -> /home/jupyterlab/conda/envs/python/lib/node_modules/serverless/bin/serverless.js\n",
" +--------------------------------------------------+\n",
" | |\n",
" | Serverless Framework successfully installed! |\n",
" | To start your first project, run “serverless”. |\n",
" | |\n",
" +--------------------------------------------------+\n",
"\n",
"+ [email protected]\n",
"added 522 packages from 340 contributors in 75.426s\n",
"Manage Cloud Functions\n",
"Usage:\n",
" wsk [command]\n",
"\n",
"Available Commands:\n",
" action work with actions\n",
" activation work with activations\n",
" api work with APIs\n",
" deploy Deploy a collection of packages, actions, triggers and rules with a deployment manifest file\n",
" help Help about any command\n",
" list list entities in the current namespace\n",
" namespace Work with IAM-based and Cloud Foundry-based namespaces.\n",
"\n",
" package work with packages\n",
" property work with whisk properties\n",
" rule work with rules\n",
" sdk work with the sdk\n",
" service Bind and unbind service credentials to an action or package.\n",
" trigger work with triggers\n",
" undeploy Undeploy a previously deployed collection of packages, actions, triggers and rules\n",
"\n",
"Flags:\n",
" --apihost HOST whisk API HOST\n",
" --apiversion VERSION whisk API VERSION\n",
" -u, --auth KEY authorization KEY\n",
" -d, --debug debug level output\n",
" -h, --help help for wsk\n",
" -i, --insecure bypass certificate checking\n",
" -v, --verbose verbose output\n",
"\n",
"Use \"wsk [command] --help\" for more information about a command.\n",
"Entities in namespace: default\n",
"packages\n",
"actions\n",
"triggers\n",
"rules\n",
"Serverless: Packaging service...\n",
"Serverless: Excluding development dependencies...\n",
"Serverless: Compiling Functions...\n",
"Serverless: Compiling Packages...\n",
"Serverless: Compiling API Gateway definitions...\n",
"Serverless: Compiling Rules...\n",
"Serverless: Compiling Triggers & Feeds...\n",
"Serverless: Compiling Service Bindings...\n",
"Serverless: Deploying Packages...\n",
"Serverless: Deploying Functions...\n",
"Serverless: Deployment successful!\n",
"\n",
"Service Information\n",
"platform:\tus-south.functions.cloud.ibm.com\n",
"namespace:\t_\n",
"service:\tlab-4\n",
"\n",
"packages:\n",
"lab4\n",
"\n",
"actions:\n",
"lab4/connectDiscovery\n",
"\n",
"triggers:\n",
"**no triggers deployed**\n",
"\n",
"rules:\n",
"**no rules deployed**\n",
"\n",
"endpoints (api-gw):\n",
"**no routes deployed**\n",
"\n",
"endpoints (web actions):\n",
"**no web actions deployed**\n",
"\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"[tabtab] Adding source line to load /home/jupyterlab/conda/envs/python/lib/node_modules/serverless/node_modules/tabtab/.completions/serverless.bash\n",
"in /home/jupyterlab/.bashrc\n",
"\n",
"\n",
"[tabtab] Adding source line to load /home/jupyterlab/conda/envs/python/lib/node_modules/serverless/node_modules/tabtab/.completions/sls.bash\n",
"in /home/jupyterlab/.bashrc\n",
"\n",
"\n",
"[tabtab] Adding source line to load /home/jupyterlab/conda/envs/python/lib/node_modules/serverless/node_modules/tabtab/.completions/slss.bash\n",
"in /home/jupyterlab/.bashrc\n",
"\n"
]
}
],
"source": [
"%%bash\n",
"cd /resources/lab4/Lab4-Adding-Discovery-to-Chatbot\n",
"ibmcloud target -s lab4\n",
"ibmcloud plugin install cloud-functions -f\n",
"export npm_config_loglevel=silent\n",
"npm install -g [email protected]\n",
"ibmcloud fn --apihost us-south.functions.cloud.ibm.com\n",
"ibmcloud fn list --apihost us-south.functions.cloud.ibm.com\n",
"serverless deploy"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Entities in namespace: \u001b[1mdefault\u001b[0m\n",
"\u001b[1mpackages\n",
"\u001b[0m/[email protected]_lab4/lab4 private\n",
"\u001b[1mactions\n",
"\u001b[0m/[email protected]_lab4/lab4/connectDiscovery private nodejs:10\n",
"\u001b[1mtriggers\u001b[0m\n",
"\u001b[1mrules\u001b[0m\n"
]
}
],
"source": [
"!ibmcloud fn list"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python",
"language": "python",
"name": "conda-env-python-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.11"
},
"toc-autonumbering": true
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment