-
Notifications
You must be signed in to change notification settings - Fork 0
Installation and working environment
Providing a generalized way of deploying a service is far from being an easy task, and there is a whole field of work in software engineering dedicated to DevOps. In order to facilitate the process as much as possible, together with the FINALES code we provide a Dockerfile to set up a containerized environment to run the server.
The first step in any case will be to download the code from the github repository, for example:
user@computer$ git clone git@github.com:BIG-MAP/FINALES2.git
Open a terminal and navigate to the folder containing the repository.
Run pip install -e ./
to install the package as an editable package, which applies changes to your local clone of the repository. You can also use pip install ./
or pip install .
to install it in non-editable mode, which is more advisable for deployment, but not for development.
Alternatively, you can use the Dockerfile
to create an image that docker can later use for starting more isolated containers:
user@computer$ docker build -t finales_image .
Note that here we are assigning it a tag/name finales_image
, but you can change that as long as you are consistent with that in the other commands.
You should be able to see the new image by running:
user@computer$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
finales_image latest 85fb8f04d4d0 22 hours ago 1.52GB
<none> <none> 3e400e580953 23 hours ago 1.18GB
<none> <none> 62f0f7822bad 4 days ago 2.57GB
Now you need to start the container. The first time you do this, you will need to provide all the necessary configurations that you want it to have. For the following example we will want to...
- Give a recognizable name for the container (
finales_container
) - Expose the ports 8888 and 13371 inside the container (the first for the jupyterlab interface, the second for the fast-api server).
- Set up the environment variable for using the bash shell
Here is the command to do all that:
user@computer$ docker run --name finales_container -p 8888:8888 -p 13371:13371 --env SHELL="/bin/bash" finales_image
[I 2023-07-13 07:34:37.004 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-07-13 07:34:37.007 ServerApp] nbclassic | extension was successfully linked.
[I 2023-07-13 07:34:37.008 ServerApp] Writing Jupyter server cookie secret to /root/.local/share/jupyter/runtime/jupyter_cookie_secret
[I 2023-07-13 07:34:37.313 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-07-13 07:34:37.353 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-07-13 07:34:37.353 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.9/site-packages/jupyterlab
[I 2023-07-13 07:34:37.353 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 2023-07-13 07:34:37.355 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-07-13 07:34:37.360 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-07-13 07:34:37.360 ServerApp] Serving notebooks from local directory: /root
[I 2023-07-13 07:34:37.360 ServerApp] Jupyter Server 1.13.5 is running at:
[I 2023-07-13 07:34:37.360 ServerApp] http://c7f4415cd603:8888/lab?token=cb21e5218bd24a71b1d5ea2a1a608c5d927adb339a8d651f
[I 2023-07-13 07:34:37.360 ServerApp] or http://127.0.0.1:8888/lab?token=cb21e5218bd24a71b1d5ea2a1a608c5d927adb339a8d651f
[I 2023-07-13 07:34:37.360 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-07-13 07:34:37.363 ServerApp]
To access the server, open this file in a browser:
file:///root/.local/share/jupyter/runtime/jpserver-1-open.html
Or copy and paste one of these URLs:
http://c7f4415cd603:8888/lab?token=cb21e5218bd24a71b1d5ea2a1a608c5d927adb339a8d651f
or http://127.0.0.1:8888/lab?token=cb21e5218bd24a71b1d5ea2a1a608c5d927adb339a8d651f
You can see the container was launched correctly and it started the jupyterlab interface.
You can access it by copy-pasting the web link in your browser (http://127.0.0.1:8888/lab?token=...
).
Note that this terminal will now be blocked by the container until you press CTRL+C
(which will stop the container).
But if you open a different terminal you should be able to see the container running as well:
user@computer$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c7f4415cd603 finales_image "jupyter-lab --ip=0.…" 12 minutes ago Up 7 seconds 0.0.0.0:8888->8888/tcp, 0.0.0.0:13371->13371/tcp finales_container
If you need to stop the container, you can later start it again with the docker start
command.
We will do it with the "attach" option, that will block the terminal again, but will also show all the log of events inside of the container.
user@computer$ docker start -a finales_container
[I 2023-07-13 07:47:04.387 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-07-13 07:47:04.389 ServerApp] nbclassic | extension was successfully linked.
[I 2023-07-13 07:47:04.515 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-07-13 07:47:04.530 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-07-13 07:47:04.530 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.9/site-packages/jupyterlab
[I 2023-07-13 07:47:04.530 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 2023-07-13 07:47:04.532 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-07-13 07:47:04.534 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-07-13 07:47:04.534 ServerApp] Serving notebooks from local directory: /root
[I 2023-07-13 07:47:04.534 ServerApp] Jupyter Server 1.13.5 is running at:
[I 2023-07-13 07:47:04.534 ServerApp] http://c7f4415cd603:8888/lab?token=827bb821a7ac63cc27577b5767e5f97e057f0af91823103f
[I 2023-07-13 07:47:04.534 ServerApp] or http://127.0.0.1:8888/lab?token=827bb821a7ac63cc27577b5767e5f97e057f0af91823103f
[I 2023-07-13 07:47:04.534 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-07-13 07:47:04.536 ServerApp]
To access the server, open this file in a browser:
file:///root/.local/share/jupyter/runtime/jpserver-1-open.html
Or copy and paste one of these URLs:
http://c7f4415cd603:8888/lab?token=827bb821a7ac63cc27577b5767e5f97e057f0af91823103f
or http://127.0.0.1:8888/lab?token=827bb821a7ac63cc27577b5767e5f97e057f0af91823103f
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 957189.