You will create a computer, run a small web server on it and open that server in your browser over HTTPS. You use the same CLI as the quickstart.
Prerequisites
You need:
- The
neviaCLI, installed and signed in as in the Quickstart. - A selected workspace where you have the admin or editor role.
Check the workspace:
nevia workspace currentCreate a computer
Create a computer named hello. It publishes port 8080 on HTTPS port 443 and
the command waits until the computer is ready:
nevia new hello -p 443:8080 --waitCheck its state and URL:
nevia status helloThe computer should be ready and show a url that looks like https://<host>.
Copy it. The URL is set when the computer first becomes ready and never changes.
Default image
Omit --image. The computer starts from the platform default image.
Run a web server
Write a page to the home directory of the nevia user:
nevia exec hello -- sh -c 'echo "<h1>Hello from Nevia</h1>" > ~/index.html'Start a Python web server on port 8080 in the background. nohup and the
redirects keep it running after the exec session ends:
nevia exec hello -- sh -c 'nohup python3 -m http.server 8080 --directory ~ >/dev/null 2>&1 &'The command returns right away and the server keeps running inside the computer.
Open the URL
Request the url you copied in step 1. Replace <host> with your URL:
curl https://<host>You should see:
<h1>Hello from Nevia</h1>Your browser shows the same page. The URL stays the same for as long as the
computer exists. Until something listens on port 8080, it returns 503.
Computer ports and URLs covers how mappings and URLs work.
Clean up
Delete the computer and wait until it is gone:
nevia rm hello --yes --waitCheck that hello no longer appears:
nevia lsNext steps
- Create a computer covers images, ports and options.
- Publish a computer on an HTTPS URL covers changing ports and the limits that apply.
- Run a command covers running commands and environment variables.
- Computer ports and URLs lists mapping rules and URL formats.
- Create and restore checkpoints saves and restores a computer's state.