Configure the Ogre CLI

The CLI enables the user to customize how ogre builds and deploys the coding environment. It enables the user to:

  • Modify specific deployment parameters that are not accessible from the extension

  • Deploy local projects, i.e., source code stored in a local folder, directly in the Ogre.run cloud. This is very handy to expose their project without the need to create a repository on GitHub or GitLab.

You can modify the default Ogre parameters by creating a config file. To generate one based off a template, go inside the folder containing the Python code you want to run, and type:

ogre --config

The config file consists of several parameters that control the behavior of Ogre.run and how it builds the environment.

where you should substitute <OGRE_TOKEN> by the token created in the ogre.run website, and <PLATFORM> by either amd64 (e.g. Intel CPUs) or arm64 (e.g. Mac).

Using the config file you can:

  1. Choose a different port to deploy the environment (try jupyter_port: 8081 for example); However, if the desired port is already taken, Ogre.run will automatically choose a free port.

  2. Define which container ports you want to expose to the host (this comes in handy if your application runs on a specific port). If you need to expose more than one port, separate then by commas, e.g., expose_ports: 8081, 8090. If you don't want/need to expose container ports, set it equal to zero, i.e., expose_ports: 0;

  3. Choose a different baseimage on top of which your project image will be built. Try for example pytorch/pytorch:latest to build your environment based on the latest pytorch version. Now you are ready to deploy your environment using the CLI.

Metacompile a code base from the command line

Go inside the folder containing the python code you want to metacompile.

IMPORTANT: Ogre is currently limited to code bases that contain at least a README file with instructions to run the code. We are working to remove that limitation and enable Ogre to work without the need for a README file.

Type the command

This command will send a request to the Ogre Cloud, which will then run the metacompilation of your code base and send back a file with instructions on how to build the optimal environment to run the code in your local system.

Once the environment is done being built, you can access it by visiting the address returned by the command:

for example, for the following output

you should access the address 0.0.0.0:8001 on a web browser.

If you prefer to expose your code base to everybody, you have the option to use the Ogre cloud. Use the following sequence of commands to package, publish, and start the service online.

1. Package code. [ogre --package]

2. ogre --packagePublish code to the cloud (this step just uploads it; no service is started). [ogre --publish]

3. Start the Ogre service. Your environment will be built remotely (in the Ogre Cloud) according to the parameters in your ogre.yml file. [ogre --service_up]

4. Once finished building, you will be able to access the jupyterlab environment from the browser, the same way as when using the extension. Finally, to stop the service just do [ogre --service_down]

Congratulations! You have successfully learned how to use Ogre.run CLI. If you have any further questions or need assistance, feel free to reach out to our support team.

Last updated