diff --git a/build/docker/build.sh b/build/docker/build.sh index 78f7bf4f57e..a61148f313b 100644 --- a/build/docker/build.sh +++ b/build/docker/build.sh @@ -2,6 +2,11 @@ echo "Building docker release" +if [ -z "$OPENBBTERMINAL_DOCKER_RELEASE_VERSION" ] +then + read -p "Version number (X.Y.Z format): " OPENBBTERMINAL_DOCKER_RELEASE_VERSION +fi + # SET DEFAULT PARAMETERS IF EMPTY OPENBBTERMINAL_DOCKER_REGISTRY="${OPENBBTERMINAL_DOCKER_REGISTRY:-ghcr.io}" OPENBBTERMINAL_DOCKER_GITHUB_REPOSITORY="${OPENBBTERMINAL_DOCKER_GITHUB_REPOSITORY:-openbb-finance/openbbterminal}" diff --git a/build/docker/docker-compose.yaml b/build/docker/docker-compose.yaml index 823c4b694de..c4193a96b7c 100644 --- a/build/docker/docker-compose.yaml +++ b/build/docker/docker-compose.yaml @@ -2,11 +2,11 @@ version: '3.8' services: openbb: environment: - DISPLAY: host.docker.internal:0.0 + DISPLAY: host.docker.internal:0.0 volumes: - ~/OpenBBUserData:/home/python/OpenBBUserData - ~/.openbb_terminal:/home/python/.openbb_terminal platform: linux/amd64 - image: ghcr.io/openbb-finance/openbbterminal/openbb:2.0.0 + image: ghcr.io/openbb-finance/openbbterminal/openbb:latest stdin_open: true # docker run -i - tty: true # docker run -t \ No newline at end of file + tty: true # docker run -t diff --git a/build/docker/openbb.dockerfile b/build/docker/openbb.dockerfile index ed683074cda..771be63cb84 100644 --- a/build/docker/openbb.dockerfile +++ b/build/docker/openbb.dockerfile @@ -53,6 +53,12 @@ COPY --chown=python:python openbb_terminal openbb_terminal RUN mkdir -p website/content/sdk/quickstart COPY --chown=python:python ./website/content/sdk/quickstart/installation.md ./website/content/sdk/quickstart +RUN mkdir OpenBBUserData +RUN chown python:python OpenBBUserData + +RUN mkdir .openbb_terminal +RUN chown python:python .openbb_terminal + # SETUP OPENBB IMAGE FROM repository as dependencies diff --git a/website/content/terminal/quickstart/installation.md b/website/content/terminal/quickstart/installation.md index 5bbc511cef6..ae95979c30f 100644 --- a/website/content/terminal/quickstart/installation.md +++ b/website/content/terminal/quickstart/installation.md @@ -84,35 +84,38 @@ Right-Click the app and select Open. You will see a message saying

Install with Docker

- Here are the steps to get OpenBBTerminal using the Docker containers that we provide: -1. Installing `Docker` and `Docker Compose` -2. Pulling and running `OpenBBTerminal Docker Container` -3. Configuring your X-server to show plots +Here we will detail how to run OpenBB Terminal Docker image. -Each of this steps need to be followed to have a working version of OpenBBTerminal. +Please check the section matching to your OS. -We will detail these steps in the rest of this document. +## 1. Windows -## 1. Installing `Docker` and `Docker Compose` +### 1.1. Install Docker Desktop -**INSTALL DOCKER** +You can find `Docker Desktop` for Windows here: [Download Docker Desktop](https://www.docker.com/products/docker-desktop) -Installing Docker Desktop is an alternative way and has a `Graphical User Interface` built in with `Docker Compose`. +### 1.2. Start Docker -You can find `Docker Desktop` installation file for your `OS` here: [Download Docker Desktop](https://www.docker.com/products/docker-desktop) - -**START DOCKER** - -Once you have `Docker` installed and running, you can use the following command to check the state: +Execute the following command: ```bash docker info ``` -It should output a text like this one: +If you have something like this, it means you haven't started Docker: -```text +```bash +docker info +Server: +ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. +Is the docker daemon running? +``` + +Start Docker, this is how the right output looks like: + +```bash +docker info Client: Context: default Debug Mode: false @@ -124,72 +127,17 @@ Server: Stopped: 10 ``` -If you see a message like the following, it most likely means you need to start `Docker`. +### 1.3. Install VcXsrv -Open the docker desktop app in this case. +To display charts with your container, you need : VcXsrv. -```text -Server: -ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. -Is the docker daemon running? -``` +You can download VcXsrv here : [Download VcXsrv](https://sourceforge.net/projects/vcxsrv) -## 2. Pulling and running `OpenBBTerminal Docker Container` +When running VcXsrv program check the option: `Disable access control` -**DOCKER COMPOSE** +### 1.4. Pull and run the container -Here are the commands to use `Docker Compose` to pull and run the `OpenBBTerminal Docker Container`: - -```bash -curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml - -docker compose run openbb -``` - -The command line with `curl` is downloading this file : [`docker-compose.yaml`](https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml). - -The `docker-compose.yaml` file is a configuration file telling `Docker Compose`: - -- where to find `OpenBBTerminal Docker Container` -- how to run this container. - -The second command runs `Docker Compose` on the service `poetry` defined in this `docker-compose.yaml` file. - -This second command must be run in the same folder in which `docker-compose.yaml` file is. - -**DOCKER** - -If you don't have `Docker Compose` you can also use `Docker` directly to run the `OpenBBTerminal Docker Container`. - -Here is the commands to run: - -```bash -docker pull ghcr.io/openbb-finance/openbbterminal/openbb:latest - -docker run -v ~/.openbb_terminal/:/home/python/.openbb_terminal -v ~/OpenBBUserData:/home/python/OpenBBUserData -it --rm ghcr.io/openbb-finance/openbbterminal/openbb:latest -``` - -You can replace `latest` with the version you want to pull and run. - -Note for windows: - -```text - Ignore this message if you are using Powershell or a more evolved interpreters. - If you are using the builtin Windows interpreter. - Replace `~` by `%USERPROFILE%` in the command above. -``` - -## 3. Configuring your X-server to show plots - -In order to display plots in the docker container, we need to configure the XServer on the host machine. Without this configuration the interactive charts will not be displayed. - -### On Windows - -Download and install : [VcXsrv](https://sourceforge.net/projects/vcxsrv/) - -When running the program is important to check "Disable access control" - -Run `Docker Compose` like this: +Execute this commands: ```bash curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml @@ -197,68 +145,86 @@ curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/Ope docker compose run poetry ``` -Or run `Docker` directly: +This will download and run the file: `docker-compose.yaml` + +This file contents the settings to pull and run OpenBB Terminal Docker image. + +## 2. macOS + +### 2.1. Install and run Docker Desktop + +Install and run Docker Desktop as describe above in this document. + +### 2.2. Install XQuartz + +You can download XQuartz here: [Download XQuartz](https://www.xquartz.org) + +Open X Quartz. + +Then on `Preferences > Security`. + +Make sure both of these options are enabled: + +- `Authenticate connections` +- `Allow connections from network clients` + +It should look like this: + ![Screen Shot 2021-09-08 at 12 21 48 PM](https://user-images.githubusercontent.com/18151143/132548605-235d774b-9aa6-4a45-afcf-58fb775d376a.png) + +### 2.3. Get Docker IP + +To get Docker IP you can use this command: ```bash -docker run -v ~/.openbb_terminal:/home/python/.openbb_terminal -v ~/OpenBBUserData:/home/python/OpenBBUserData -it --rm --env DISPLAY=host.docker.internal:0.0 ghcr.io/openbb-finance/openbbterminal/openbb:latest +IP=$(ifconfig | grep inet | grep -v "127.0.0.1" | awk '$1=="inet" {print $2}') ``` -### X-Server on macOS +### 2.4. Pull and run the container -Users familiar with Docker and X-Server can set the `DISPLAY` variable in the file [setenv](/docker/setenv) described above. If you use this approach remember to add `:0` at the end of your inet address. E.g. `DISPLAY=192.168.1.155:0`. - -For help setting up the X-Server continue reading: - -#### Setting up X Quartz/X11 - -On macOS the X11 client of choice is [XQuartz](https://www.xquartz.org/). On Windows it's [Xming](http://www.straightrunning.com/XmingNotes/). XQuartz will be used as an example further on. - -0. Install X Quartz from -1. With X Quartz open: go to Preferences -> Security and make sure both options are enabled. - ![Screen Shot 2021-09-08 at 12 21 48 PM](https://user-images.githubusercontent.com/18151143/132548605-235d774b-9aa6-4a45-afcf-58fb775d376a.png) - -#### Adding the display for Docker - -From the command prompt or terminal, run the following to add your local configuration to the list of allowed access control: +Execute this commands: ```bash -IP=$(ifconfig | grep inet | grep -v -e "127.0.0.1" | awk '$1=="inet" {print $2}') -xhost + $IP +curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml + +xhost +$IP +docker compose run -e DISPLAY=$IP:0 openbb ``` -Now we can run the docker container, adding the display to the environment: +This will download and run the file: `docker-compose.yaml` + +This file contents the settings to pull and run OpenBB Terminal Docker image. + +The `xhost +$IP` and `DISPLAY=$IP:0` parts are there to allow charts display. + +## 3. Linux + +### 3.1. Install and run Docker Desktop + +Install and run Docker Desktop as describe above in this document. + +### 3.2. Pull and run the container + +Execute this commands: ```bash -docker run -v ~/.openbb_terminal/:/home/python/.openbb_terminal -v ~/OpenBBUserData:/home/python/OpenBBUserData -it --rm --env-file=path/to/setenv --env DISPLAY=$IP:0 ghcr.io/openbb-finance/openbbterminal/openbb:latest -``` +curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml -This container will be able to display all the same plots as the terminal interface. - -### X-Server on Linux Desktop - -X-Server is default in Linux distribution. There is no need to install any clients. - -#### Local docker container - -We can use IPC socket to connect Desktop. - -Add this setting to your `.env` file. - -```bash -OPENBB_BACKEND=Qt5Agg -``` - -And run the following commands. - -```bash xhost +local: -docker run -it --rm --name openbb --env-file=./.env -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix ghcr.io/openbb-finance/openbbterminal/openbb:latest -xhost -local: +docker compose run openbb ``` -If you're using remote docker host, you can connect with "ssh -X ". +Note: if you're using remote docker host, you can connect with `ssh -X `. -Then run the previous docker command. +## 4. Advanced: without Docker Compose + +To run directly the docker image you can use the following command: + +```bash +docker run --rm -it \ + -v ~/.openbb_terminal/:/home/python/.openbb_terminal \ + -v ~/OpenBBUserData:/home/python/OpenBBUserData \ + ghcr.io/openbb-finance/openbbterminal/openbb:latest +```