Skip to content

Commit

Permalink
add curl commands to set up and copy the files
Browse files Browse the repository at this point in the history
Signed-off-by: abbyhu2000 <abigailhu2000@gmail.com>
  • Loading branch information
abbyhu2000 committed Feb 18, 2023
1 parent 846e04a commit 182d342
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
28 changes: 28 additions & 0 deletions dev-tools/install-docker-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

{ # this ensures the entire script is downloaded #

osd_docker_dev_install_dir(){
printf "opensearch-dashboards-docker-dev"
}

osd_download(){
curl --fail --compressed -q "$@"
}

osd_do_copy_dev_docker_files(){
local INSTALL_DIR
INSTALL_DIR="$(osd_docker_dev_install_dir)"
local ENTRYPOINT_SRC
ENTRYPOINT_SRC="https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/docs/docker-dev/entrypoint.sh"
local DOCKER_COMPOSE_SRC
DOCKER_COMPOSE_SRC="https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/docs/docker-dev/docker-compose.yml"

mkdir -p "$INSTALL_DIR"
osd_download -s "$ENTRYPOINT_SRC" -o "./$INSTALL_DIR/entrypoint.sh"
osd_download -s "$DOCKER_COMPOSE_SRC" -o "./$INSTALL_DIR/docker-compose.yml"
}

osd_do_copy_dev_docker_files

} # this ensures the entire script is downloaded #
18 changes: 18 additions & 0 deletions docs/docker-dev/docker-dev-setup-manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Docker Development Environment Setup

1. Install [Docker](https://docs.docker.com/get-docker/) if not already.
2. On the terminal, run command `curl -o- https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev-tools/install-docker-dev.sh | bash`. This should create a folder named `opensearch-dashboards-docker-dev` and it should contain two files: `docker-compose.yml` and `entrypoint.sh`.
3. Open [VsCode](https://code.visualstudio.com/download). Install here if not already. Make sure VsCode has the extension `Dev Containers` and `Docker` installed. If not, go to Extensions tab, search and install them.
4. Under the Discover tab, click `Open Folder`, and open the `opensearch-dashboards-docker-dev` folder that we just created.
5. In the workspace folder, set environment variable for the fork repository URL: run `export REPO_URL=[insert your fork repo url here]`. If fork repo has not been created: Go to [OpenSearch Dashboards github page](https://github.com/opensearch-project/OpenSearch-Dashboards) and under fork, select create a new fork, and then copy the https link of the fork url and use it in the above command.
6. To run the `docker-compose.yml` file in the background, and type `docker compose up -d --build` in the terminal.
7. Under `Docker` tab in VsCode, verify that there are two containers running: `opensearchproject/opensearch:latest` and `docker.io/library/osd-development`. We can also verify using the command line: `docker ps`.
8. Right click `docker.io/library/osd-development`, and select `Attach Visual Studio Code`. This should ssh into the container in another VsCode window.
9. For the new VsCode window, if it is not showing the repository code, then select `Open Folder`. Then open `/workspace-docker/OpenSearch-Dashboards`.
10. In the terminal, type `yarn start:docker` to start the OpenSearch Dashboards application. (To open a terminal, right click on a file and click `Open in Integrated Terminal`. Then change the terminal type to bash by clicking the + sign on the right top of the terminal window.)
11. Now dashboard is running, you should be able to see a similar line `[info][server][OpenSearchDashboards][http] http server running at http://0.0.0.0:5603/dog` . The last three letters are randomly generated every time we start dashboards.
12. Wait for the optimizer to run, and it takes about 100s - 200s. Once the optimizer is finished running, it will show a line such as `[success][@osd/optimizer] 48 bundles compiled successfully after 204.9 sec, watching for changes`.
13. Then paste the link into a chrome browser and view dashboard running in browser, but change ‘0.0.0.0’ to ‘localhost’. So here the link should be `http://localhost:5603/dog`.
14. Changes are constantly being watched, so when there is changes made, dashboard will rebuild and restart automatically. Refresh the link in the browser and the new changes should be applied.
15. `Git` is already configured in the `entrypoint.sh` file, and the remote is already tracking the fork repository. You can start contributing by creating your branch off the main, and commit your first PR!

0 comments on commit 182d342

Please sign in to comment.