Deepnote – Free Plan with 5G RAM and 2vCPU VPS – Expose Ports to Internet

Deepnote is a collaborative data notebook for Python, SQL, and no-code analysis. It runs in the cloud and connects securely to any data source.

In this post, I am gonna show you some interesting usage for Deepnote's free plan VPS.

Free Plan

For individual data scientists who want to experience the power of Deepnote.

  • Up to 3 editors
  • Up to 5 projects
  • Unlimited Basic machines with 5GB RAM, 2vCPU
  • 7 day revision history

Register an account

No credit card, no work email required. You can use any email address to register an account as long as you can verify it. 

By default it already has some demo project installed in your account. You can click Run notebook button to start it. Here is a example project "Plato's Pizza Sales"

Performance Test

Once you have your project running, you can create a terminal session to have root access to the machine.

From the terminal, we can run a script to test the performance and see the system specs as well. 



Github: https://github.com/masonr/yet-another-bench-script/blob/master/yabs.sh

The script might take 20-30 minutes to get all testing done, depending on VM's performance. you wll get a score for single core and multi core:
  • apt update -y && apt install -y curl wget sudo
  • curl -sL yabs.sh | bash 

Here is what we got:

(venv) root@deepnote:~/work # curl -sL yabs.sh | bash # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # # Yet-Another-Bench-Script # # v2023-04-23 # # https://github.com/masonr/yet-another-bench-script # # ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## # Sat 01 Jul 2023 01:19:41 AM UTC Basic System Information: --------------------------------- Uptime : 0 days, 10 hours, 21 minutes Processor : Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz CPU cores : 4 @ 3099.993 MHz AES-NI : ✔ Enabled VM-x/AMD-V : ❌ Disabled RAM : 30.9 GiB Swap : 0.0 KiB Disk : 100.0 GiB Distro : Debian GNU/Linux 10 (buster) Kernel : 5.4.231-137.341.amzn2.x86_64 VM Type : IPv4/IPv6 : ✔ Online / ❌ Offline IPv4 Network Information: --------------------------------- ISP : Amazon Technologies Inc. ASN : AS14618 Amazon.com, Inc. Host : AWS EC2 (us-east-1) Location : Ashburn, Virginia (VA) Country : United States fio Disk Speed Tests (Mixed R/W 50/50): --------------------------------- Block Size | 4k (IOPS) | 64k (IOPS) ------ | --- ---- | ---- ---- Read | () | () Write | () | () Total | 0.00 KB/s (0) | 0.00 KB/s (0) | | Block Size | 512k (IOPS) | 1m (IOPS) ------ | --- ---- | ---- ---- Read | () | () Write | () | () Total | 0.00 KB/s (0) | 0.00 KB/s (0) iperf3 Network Speed Tests (IPv4): --------------------------------- Provider | Location (Link) | Send Speed | Recv Speed | Ping ----- | ----- | ---- | ---- | ---- Clouvider | London, UK (10G) | 101 Mbits/sec | 2.10 Gbits/sec | -- Scaleway | Paris, FR (10G) | busy | busy | -- NovoServe | North Holland, NL (40G) | 101 Mbits/sec | 1.88 Gbits/sec | -- Uztelecom | Tashkent, UZ (10G) | 98.4 Mbits/sec | 891 Mbits/sec | -- Clouvider | NYC, NY, US (10G) | 104 Mbits/sec | 5.85 Gbits/sec | -- Clouvider | Dallas, TX, US (10G) | 103 Mbits/sec | 4.04 Gbits/sec | -- Clouvider | Los Angeles, CA, US (10G) | 103 Mbits/sec | 2.74 Gbits/sec | -- Running GB6 benchmark test... *cue elevator music* Geekbench 6 Benchmark Test: --------------------------------- Test | Value | Single Core | 707 Multi Core | 615 Full Test | https://browser.geekbench.com/v6/cpu/1776637 YABS completed in 19 min 20 sec 

Environment Settings

In case your machine will be stopped by Deepnote automatically in 15 minutes, you can change it to maximum 24 hours. That is maximum hours you can have for free plan. 
Basically here, we got a 5G RAM , 2vCPU VPS to use for 24 hours. 

Expose Port to Internet

vi hello.py
from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "<p>Hello, World!</p>" app.run(host='0.0.0.0', port=8080) 

Install flask

(venv) root@deepnote:~/work # pip install flask Collecting flask Downloading Flask-2.3.2-py3-none-any.whl (96 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.9/96.9 KB 5.0 MB/s eta 0:00:00 Collecting blinker>=1.6.2 Downloading blinker-1.6.2-py3-none-any.whl (13 kB) Collecting itsdangerous>=2.1.2 Downloading itsdangerous-2.1.2-py3-none-any.whl (15 kB) Requirement already satisfied: importlib-metadata>=3.6.0 in /shared-libs/python3.9/py/lib/python3.9/site-packages (from flask) (5.0.0) Requirement already satisfied: click>=8.1.3 in /shared-libs/python3.9/py/lib/python3.9/site-packages (from flask) (8.1.3) Collecting Jinja2>=3.1.2 Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 KB 21.1 MB/s eta 0:00:00 Collecting Werkzeug>=2.3.3 Downloading Werkzeug-2.3.6-py3-none-any.whl (242 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 242.5/242.5 KB 40.2 MB/s eta 0:00:00 Requirement already satisfied: zipp>=0.5 in /shared-libs/python3.9/py/lib/python3.9/site-packages (from importlib-metadata>=3.6.0->flask) (3.9.0) Requirement already satisfied: MarkupSafe>=2.0 in /shared-libs/python3.9/py-core/lib/python3.9/site-packages (from Jinja2>=3.1.2->flask) (2.0.0) Collecting MarkupSafe>=2.0 Downloading MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB) Installing collected packages: MarkupSafe, itsdangerous, blinker, Werkzeug, Jinja2, flask Attempting uninstall: MarkupSafe Found existing installation: MarkupSafe 2.0.0 Not uninstalling markupsafe at /shared-libs/python3.9/py-core/lib/python3.9/site-packages, outside environment /root/venv Can't uninstall 'MarkupSafe'. No files were found to uninstall. Attempting uninstall: Werkzeug Found existing installation: Werkzeug 2.2.2 Not uninstalling werkzeug at /shared-libs/python3.9/py/lib/python3.9/site-packages, outside environment /root/venv Can't uninstall 'Werkzeug'. No files were found to uninstall. Attempting uninstall: Jinja2 Found existing installation: Jinja2 2.11.3 Not uninstalling jinja2 at /shared-libs/python3.9/py-core/lib/python3.9/site-packages, outside environment /root/venv Can't uninstall 'Jinja2'. No files were found to uninstall. Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.3 Werkzeug-2.3.6 blinker-1.6.2 flask-2.3.2 itsdangerous-2.1.2 WARNING: You are using pip version 22.0.4; however, version 23.1.2 is available. You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command. 
Run code:
(venv) root@deepnote:~/work # python hello.py * Serving Flask app 'hello' * Debug mode: off WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Running on all addresses (0.0.0.0) * Running on http://127.0.0.1:8080 * Running on http://172.3.82.202:8080 Press CTRL+C to quit 
Change port:

Right now we only support exposing port 8080. To expose other ports, you can either reconfigure your tool, or use utilities like socat which can forward traffic from port 8080 to the port of your choosing. You can use the example below to set up port forwarding with socat in the terminal:

apt update && apt install socat socat tcp-l:8080,fork,reuseaddr tcp:127.0.0.1:YOUR_PORT

Install nginx

(venv) root@deepnote:~/work # apt update (venv) root@deepnote:~/work # apt install nginx (venv) root@deepnote:~/work # service nginx start 

Install ngrok

1. Install Ngrok
(venv) root@deepnote:~/work # wget https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz --2023-06-30 15:43:34-- https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.tgz Resolving bin.equinox.io (bin.equinox.io)... 52.202.168.65, 54.161.241.46, 18.205.222.128, ... Connecting to bin.equinox.io (bin.equinox.io)|52.202.168.65|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 8850130 (8.4M) [application/octet-stream] Saving to: ‘ngrok-v3-stable-linux-amd64.tgz’ ngrok-v3-stable-linux-am 100%[===============================>] 8.44M --.-KB/s in 0.09s 2023-06-30 15:43:34 (98.9 MB/s) - ‘ngrok-v3-stable-linux-amd64.tgz’ saved [8850130/8850130] (venv) root@deepnote:~/work # tar -xvzf ngrok-v3-stable-linux-amd64.tgz ngrok 

2. Connect Ngrok service to your own account

  • ngrok config add-authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3. Expose your internal service port
(venv) root@deepnote:~/work # ./ngrok http 80 
ou will get a url similar as https://5e70-162-213-39-162.ngrok-free.app/




4. You might want to put it into screen session to run 
(venv) root@deepnote:~/work # apt install screen Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libutempter0 Suggested packages: byobu | screenie | iselect ncurses-term The following NEW packages will be installed: libutempter0 screen 0 upgraded, 2 newly installed, 0 to remove and 21 not upgraded. Need to get 606 kB of archives. After this operation, 1,066 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://deb.debian.org/debian buster/main amd64 libutempter0 amd64 1.1.6-3 [7,812 B] Get:2 http://deb.debian.org/debian buster/main amd64 screen amd64 4.6.2-3+deb10u1 [598 kB] Fetched 606 kB in 0s (28.3 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package libutempter0:amd64. (Reading database ... 31318 files and directories currently installed.) Preparing to unpack .../libutempter0_1.1.6-3_amd64.deb ... Unpacking libutempter0:amd64 (1.1.6-3) ... Selecting previously unselected package screen. Preparing to unpack .../screen_4.6.2-3+deb10u1_amd64.deb ... Unpacking screen (4.6.2-3+deb10u1) ... Setting up libutempter0:amd64 (1.1.6-3) ... Setting up screen (4.6.2-3+deb10u1) ... Processing triggers for libc-bin (2.28-10+deb10u2) ... (venv) root@deepnote:~/work # 
  • screen -S nginx
  • ./ngrok http 80
Each time you run ngrok command for your internal service, you will get a different first four diget number for URL 

This time I got https://5157-162-213-39-162.ngrok-free.app/


Click Visit Site button you will be able to open this Nginx default web page:



Ngrok - One Session, Multiple Tunnel

ngrok config check
(venv) root@deepnote:~/work # ./ngrok config check Valid configuration file at /root/.config/ngrok/ngrok.yml 
  • Linux: "~/.config/ngrok/ngrok.yml"
vi /root/.config/ngrok/ngrok.yml
version: "2" authtoken: 2R4VMDo0BU4ETqRZkeiufuuKFnQ_7BbZiCAknkZt7W8mHpNr7 tunnels: http1: proto: http addr: 80 http2: proto: http addr: 81 
(venv) root@deepnote:~/work # ./ngrok start http1 http2
ngrok (Ctrl+C to quit) 🤯e Announcing ngrok's Kubernetes Ingress Controller: https://ngrok.com/s/k8s-ingress Session Status online Account [email protected] (Plan: Free) Version 3.3.1 Region United States (us) Latency 12ms Web Interface http://127.0.0.1:4040 Forwarding https://c6cd-3-220-159-34.ngrok-free.app -> http://localhost:80 Forwarding https://c9df-3-220-159-34.ngrok-free.app -> http://localhost:81 Connections ttl opn rt1 rt5 p50 p90 3 0 0.00 0.00 0.01 65.37 HTTP Requests ------------- GET /favicon.ico 404 NOT FOUND GET / 200 OK GET /favicon.ico 404 Not Found GET / 200 OK 

Screen Usage

 

  • Install screen (Depends on the Linux Distribution if it came pre installed or not) : yum install screen
  • Initiate a Screen : screen or  screen -S <screen name> <command to execute>
  • Detach from the screen : "CTRL+A,D" not "CTRL+A+D"
  • List all the screen currently working : screen -ls
  • Reattach to a screen : screen  -r  <session number> or screen -r <screen name>
  • Kill specific screen: screen -X -S <screen name> quit
  • Kill all screens : pkill screen

Videos

 

References

版权声明:
作者:admin
链接:https://www.techfm.club/p/58344.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>