From 399e8983eaf6f75371eff78cd75a4f285ba31335 Mon Sep 17 00:00:00 2001 From: Chavithra PARANA Date: Wed, 23 Nov 2022 16:29:35 +0100 Subject: [PATCH 01/11] Moving Docker folder into Build --- .gitignore | 1 + {docker => build/docker}/README.md | 0 {docker => build/docker}/build.sh | 0 {docker => build/docker}/compose.env | 0 {docker => build/docker}/docker-compose.yaml | 0 {docker => build/docker}/poetry.dockerfile | 0 6 files changed, 1 insertion(+) rename {docker => build/docker}/README.md (100%) rename {docker => build/docker}/build.sh (100%) rename {docker => build/docker}/compose.env (100%) rename {docker => build/docker}/docker-compose.yaml (100%) rename {docker => build/docker}/poetry.dockerfile (100%) diff --git a/.gitignore b/.gitignore index 48fce6544b37..6deb07cb8234 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ openbb_terminal/reports/templates/*.html website/functions *_sdk_audit.csv website/terminaltest +!build/docker/compose.env # pyinstaller artifacts *.pyo diff --git a/docker/README.md b/build/docker/README.md similarity index 100% rename from docker/README.md rename to build/docker/README.md diff --git a/docker/build.sh b/build/docker/build.sh similarity index 100% rename from docker/build.sh rename to build/docker/build.sh diff --git a/docker/compose.env b/build/docker/compose.env similarity index 100% rename from docker/compose.env rename to build/docker/compose.env diff --git a/docker/docker-compose.yaml b/build/docker/docker-compose.yaml similarity index 100% rename from docker/docker-compose.yaml rename to build/docker/docker-compose.yaml diff --git a/docker/poetry.dockerfile b/build/docker/poetry.dockerfile similarity index 100% rename from docker/poetry.dockerfile rename to build/docker/poetry.dockerfile From e3e3712aa0491f22ee89e1aa407e9c1f21bd7deb Mon Sep 17 00:00:00 2001 From: Chavithra PARANA Date: Wed, 23 Nov 2022 16:30:30 +0100 Subject: [PATCH 02/11] Workflows : update Docker --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 248a337bb834..4861ab140c54 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,8 +33,8 @@ jobs: - name: Building the Docker image run: | - source docker/compose.env - source docker/build.sh + source build/docker/compose.env + source build/docker/build.sh echo "OPENBBTERMINAL_DOCKER_POETRY_IMAGE=$OPENBBTERMINAL_DOCKER_POETRY_IMAGE" >> $GITHUB_ENV - name: Publishing the Docker image From 7655afa02216fdec88dc0c3a3f3e4203a0a7f237 Mon Sep 17 00:00:00 2001 From: Chavithra PARANA Date: Wed, 23 Nov 2022 16:31:12 +0100 Subject: [PATCH 03/11] Docker : update compose image version --- build/docker/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/docker/docker-compose.yaml b/build/docker/docker-compose.yaml index 7e5b25adc08f..28d8f1344b93 100644 --- a/build/docker/docker-compose.yaml +++ b/build/docker/docker-compose.yaml @@ -7,6 +7,6 @@ services: - ~/OpenBBUserData:/home/python/OpenBBUserData - ~/.openbb_terminal:/home/python/.openbb_terminal platform: linux/amd64 - image: ghcr.io/openbb-finance/openbbterminal/poetry:1.9.1 + image: ghcr.io/openbb-finance/openbbterminal/poetry:2.0.0rc1 stdin_open: true # docker run -i tty: true # docker run -t \ No newline at end of file From 7c4acc198e91ef841416b6fdda09a60f41163947 Mon Sep 17 00:00:00 2001 From: Chavithra PARANA Date: Wed, 23 Nov 2022 16:31:32 +0100 Subject: [PATCH 04/11] Docker : fix volumes path --- build/docker/docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/docker/docker-compose.yaml b/build/docker/docker-compose.yaml index 28d8f1344b93..b731afc03efb 100644 --- a/build/docker/docker-compose.yaml +++ b/build/docker/docker-compose.yaml @@ -4,8 +4,8 @@ services: environment: DISPLAY: host.docker.internal:0.0 volumes: - - ~/OpenBBUserData:/home/python/OpenBBUserData - - ~/.openbb_terminal:/home/python/.openbb_terminal + - ~/OpenBBUserData:/root/OpenBBUserData + - ~/.openbb_terminal:/root/.openbb_terminal platform: linux/amd64 image: ghcr.io/openbb-finance/openbbterminal/poetry:2.0.0rc1 stdin_open: true # docker run -i From 1e4b482e9d5a1e37786fd19f1a5e610b858461fe Mon Sep 17 00:00:00 2001 From: Chavithra PARANA Date: Sat, 3 Dec 2022 23:47:29 +0100 Subject: [PATCH 05/11] Docker: update documentation --- .../terminal/quickstart/installation.md | 164 +++++++----------- 1 file changed, 65 insertions(+), 99 deletions(-) diff --git a/website/content/terminal/quickstart/installation.md b/website/content/terminal/quickstart/installation.md index 5bbc511cef66..a1f6c54c88d3 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) +Execute the following command: -**START DOCKER** +```bash +docker info +``` -Once you have `Docker` installed and running, you can use the following command to check the state: +If you have something like this, it means you haven't started Docker: ```bash docker info +Server: +ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. +Is the docker daemon running? ``` -It should output a text like this one: +Start Docker, this is how the right output looks like: -```text +```bash +docker info Client: Context: default Debug Mode: false @@ -124,142 +127,105 @@ 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`: +Execute this commands: ```bash curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml -docker compose run openbb +docker compose run poetry ``` -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`: +This will download and run the file: `docker-compose.yaml` -- where to find `OpenBBTerminal Docker Container` -- how to run this container. +This file contents the settings to pull and run OpenBB Terminal Docker image. -The second command runs `Docker Compose` on the service `poetry` defined in this `docker-compose.yaml` file. +## 2. macOS -This second command must be run in the same folder in which `docker-compose.yaml` file is. +### 2.1. Install and run Docker Desktop -**DOCKER** +Install and run Docker Desktop as describe above in this document. -If you don't have `Docker Compose` you can also use `Docker` directly to run the `OpenBBTerminal Docker Container`. +### 2.2. Install XQuartz -Here is the commands to run: +You can downlaod XQuartz here: [Download XQuartz](https://www.xquartz.org) -```bash -docker pull ghcr.io/openbb-finance/openbbterminal/openbb:latest +Open X Quartz. -docker run -v ~/.openbb_terminal/:/home/python/.openbb_terminal -v ~/OpenBBUserData:/home/python/OpenBBUserData -it --rm ghcr.io/openbb-finance/openbbterminal/openbb:latest -``` +Then on `Preferences > Security`. -You can replace `latest` with the version you want to pull and run. +Make sure both of these options are enabled: -Note for windows: +- `Authenticate connections` +- `Allow connections from network clients` -```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. -``` +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) -## 3. Configuring your X-server to show plots +### 2.3. Get Docker IP -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. +To get Docker IP you can use this command: -### On Windows - -Download and install : [VcXsrv](https://sourceforge.net/projects/vcxsrv/) +```bash +IP=$(ifconfig | grep inet | grep -v "127.0.0.1" | awk '$1=="inet" {print $2}') +``` -When running the program is important to check "Disable access control" +### 2.4. Pull and run the container -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 -docker compose run poetry -``` - -Or run `Docker` directly: - -```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 +xhost +$IP +docker compose run -e DISPLAY=$IP:0 openbb ``` -### X-Server on macOS +This will download and run the file: `docker-compose.yaml` -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`. +This file contents the settings to pull and run OpenBB Terminal Docker image. -For help setting up the X-Server continue reading: +The `xhost +$IP` and `DISPLAY=$IP:0` parts are there to allow charts display. -#### Setting up X Quartz/X11 +## 3. Linux -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. +### 3.1. Install and run Docker Desktop -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) +Install and run Docker Desktop as describe above in this document. -#### Adding the display for Docker +### 3.2. Pull and run the container -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 -``` - -Now we can run the docker container, adding the display to the environment: +curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml -```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 +xhost +local +docker compose run openbb ``` -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. +Note: if you're using remote docker host, you can connect with `ssh -X `. -Add this setting to your `.env` file. +## 4. Advanced: without Docker Compose -```bash -OPENBB_BACKEND=Qt5Agg -``` - -And run the following commands. +To run directly the docker image you can use the following command: ```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 run --rm -it \ + -v ~/.openbb_terminal/:/home/python/.openbb_terminal \ + -v ~/OpenBBUserData:/home/python/OpenBBUserData \ + ghcr.io/openbb-finance/openbbterminal/openbb:latest ``` -If you're using remote docker host, you can connect with "ssh -X ". - -Then run the previous docker command. -
This installation type supports both Windows and Unix systems (Linux + MacOS). From 13e982bf9b4ed4a62a698253e3876ec52a5885c4 Mon Sep 17 00:00:00 2001 From: Chavithra PARANA Date: Sun, 4 Dec 2022 10:55:08 +0100 Subject: [PATCH 06/11] Docker : build.sh add prompt for version number --- build/docker/build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/docker/build.sh b/build/docker/build.sh index 78f7bf4f57e0..a61148f313bf 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}" From 9ea9698382ef0c9ac48e7d5c0009bef08aed4684 Mon Sep 17 00:00:00 2001 From: Chavithra PARANA Date: Mon, 5 Dec 2022 00:52:35 +0100 Subject: [PATCH 07/11] Fix spelling --- website/content/terminal/quickstart/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/content/terminal/quickstart/installation.md b/website/content/terminal/quickstart/installation.md index a1f6c54c88d3..9e83a4e3da21 100644 --- a/website/content/terminal/quickstart/installation.md +++ b/website/content/terminal/quickstart/installation.md @@ -157,7 +157,7 @@ Install and run Docker Desktop as describe above in this document. ### 2.2. Install XQuartz -You can downlaod XQuartz here: [Download XQuartz](https://www.xquartz.org) +You can download XQuartz here: [Download XQuartz](https://www.xquartz.org) Open X Quartz. From 6fc838b9bb4f713281b640058a4ac34519e0c6c1 Mon Sep 17 00:00:00 2001 From: hjoaquim Date: Mon, 5 Dec 2022 09:36:29 +0000 Subject: [PATCH 08/11] fix hostname --- openbb_terminal/reports/templates/equity.ipynb | 16 ---------------- .../content/terminal/quickstart/installation.md | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/openbb_terminal/reports/templates/equity.ipynb b/openbb_terminal/reports/templates/equity.ipynb index f3a21c511440..8d1ecac10ccd 100644 --- a/openbb_terminal/reports/templates/equity.ipynb +++ b/openbb_terminal/reports/templates/equity.ipynb @@ -233,22 +233,6 @@ "df_institutional_shareholders" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "3022130e", - "metadata": {}, - "outputs": [], - "source": [ - "df_sec_filings = openbb.stocks.dd.sec(symbol=symbol)[[\"Type\", \"Category\", \"Link\"]].head(\n", - " 5\n", - ")\n", - "df_sec_filings[\"Link\"] = df_sec_filings[\"Link\"].apply(\n", - " lambda x: f'{x}'\n", - ")\n", - "df_sec_filings" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/website/content/terminal/quickstart/installation.md b/website/content/terminal/quickstart/installation.md index 9e83a4e3da21..ae95979c30fa 100644 --- a/website/content/terminal/quickstart/installation.md +++ b/website/content/terminal/quickstart/installation.md @@ -209,7 +209,7 @@ Execute this commands: ```bash curl -o docker-compose.yaml https://raw.githubusercontent.com/OpenBB-finance/OpenBBTerminal/main/build/docker/docker-compose.yaml -xhost +local +xhost +local: docker compose run openbb ``` From 6800eb6ce9577f11ad100f2da03e3bd331d829ff Mon Sep 17 00:00:00 2001 From: hjoaquim Date: Mon, 5 Dec 2022 12:30:03 +0000 Subject: [PATCH 09/11] adding permissions to folders --- build/docker/openbb.dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/docker/openbb.dockerfile b/build/docker/openbb.dockerfile index ed683074cda8..771be63cb84b 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 From 46ab60990f18700650ecf71233fd183dc5f1238a Mon Sep 17 00:00:00 2001 From: hjoaquim Date: Mon, 5 Dec 2022 12:34:52 +0000 Subject: [PATCH 10/11] changing version to latest --- build/docker/docker-compose.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/docker/docker-compose.yaml b/build/docker/docker-compose.yaml index 823c4b694dec..c4193a96b7ca 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 From 5fb9086c911ce090f6240dcb72a30e54d6770126 Mon Sep 17 00:00:00 2001 From: hjoaquim Date: Mon, 5 Dec 2022 12:42:13 +0000 Subject: [PATCH 11/11] reverting wrong change --- openbb_terminal/reports/templates/equity.ipynb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/openbb_terminal/reports/templates/equity.ipynb b/openbb_terminal/reports/templates/equity.ipynb index 8d1ecac10ccd..f3a21c511440 100644 --- a/openbb_terminal/reports/templates/equity.ipynb +++ b/openbb_terminal/reports/templates/equity.ipynb @@ -233,6 +233,22 @@ "df_institutional_shareholders" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "3022130e", + "metadata": {}, + "outputs": [], + "source": [ + "df_sec_filings = openbb.stocks.dd.sec(symbol=symbol)[[\"Type\", \"Category\", \"Link\"]].head(\n", + " 5\n", + ")\n", + "df_sec_filings[\"Link\"] = df_sec_filings[\"Link\"].apply(\n", + " lambda x: f'{x}'\n", + ")\n", + "df_sec_filings" + ] + }, { "cell_type": "code", "execution_count": null,