The following instructions demonstrate how to set up a development environment for OpenSearch Dashboards using Docker. It utilizes tools such as Docker
and VS Code
, and users should be familiar with the basic usages of them. Users will be able to develop and run the application inside VS Code without additional configurations.
Install Docker if not already installed.
In the terminal, run the command below.
opensearch-dashboards-docker-dev
and it should contain two files: docker-compose.yml
and entrypoint.sh
.curl -o- https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev-tools/install-docker-dev.sh | bash
Open VS Code or install it, if it's not already installed.
Dev Containers
and Docker
installed. If not, go to Extensions
tab, search and install them.Under the Discover tab, click Open Folder
, and open the opensearch-dashboards-docker-dev
folder that we just created.
Open the opensearch-dashboards-docker-dev
folder in VS Code integrated terminal, set environment variable for the fork repository URL by running the command below.
export REPO_URL=[insert your fork repo url here]
docker-compose.yml
file in the background by typing:docker compose up -d --build
Under the Docker
tab in VS Code, verify that there are two containers running: opensearchproject/opensearch:latest
and abbyhu/opensearch-dashboards-dev:latest
.
docker ps
Right-click abbyhu/opensearch-dashboards-dev:latest
, and select Attach Visual Studio Code
.
docker exec -it dev-env /bin/bash
For the new VS Code window, if it is not showing the repository code, then select Open Folder
. Then open /docker-workspace/OpenSearch-Dashboards
.
In the terminal, start the OpenSearch Dashboards application by typing:
yarn start:docker
Now that OpenSearch Dashboards is running, you should be able to see a log line similar to [info][server][OpenSearchDashboards][http] http server running at http://0.0.0.0:5603/dog
.
dog
are randomly generated every time we start dashboards.Wait for the optimizer to run, which 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
.
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
.
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!
This section explains how to run Selenium functional tests using Docker and debug the tests through browser interaction.
Install a VNC viewer, such as RealVNC, if you haven't already. You'll need to set up a free account to use RealVNC. This VNC viewer will enable you to view and interact with the browser running the Selenium tests. The subsequent steps will illustrate the setup process using RealVNC as an example.
Make sure you have completed steps 1-5 in the Docker Development Environment Setup. Now, ensure you have 5 files, docker-compose.yml
, docker-compose.selenium.yml
, Dockerfile.selenium
, entrypoint.sh
and start-vnc.sh
. You can also download them by running the installer script. This time you need to pass a parameter --ftr
.
curl -o- https://raw.githubusercontent.com/opensearch-project/OpenSearch-Dashboards/main/dev-tools/install-docker-dev.sh | bash -s -- --ftr
docker-compose -f docker-compose.yml -f docker-compose.selenium.yml down
docker-compose -f docker-compose.yml -f docker-compose.selenium.yml up -d --build
Under the Docker tab in VS Code, you should see three containers running: opensearchproject/opensearch:latest
, abbyhu/opensearch-dashboards-dev:latest
, and selenium-test
.
First, right-click on opensearch-dashboards-docker-dev-selenium-test
(which we'll refer to as selenium-test
for simplicity) and choose Attach Visual Studio Code
. This action mirrors Step 8 from the Docker Development Environment Setup. By doing this, you'll be able to edit the functional test directly within the selenium-test
container using VS Code which is located at test/functional
.
Connect to the VNC server running in the Docker container. First, launch the VNC viewer, then enter localhost:5900
at the top and press return. You will see a popup window labeled Unencrypted connection
; click continue. Enter the password (the default password is 123), which is configured in start-vnc.sh
.
After entering the VNC viewer, click the menu at the bottom left. Then click Internet
to ensure Google works. Also, click System Tools
and select LXTerminal
to verify you can type in the terminal. The default terminal path should be /docker-workspace/OpenSearch-Dashboards
.
Run OpenSearch and OpenSearch Dashboards separately before running functional tests. This can help isolate the functional test process and confirm that any issues are caused only by the functional test. Follow these steps:
yarn opensearch snapshot
in one terminal.yarn start --no-base-path
to start OpenSearch Dashboards on port 5601.Please note that the initial startup process may take 2 to 10 minutes, as it requires all the bundles to be assembled. This only occurs the first time you run it; afterward, everything is cached, significantly reducing the startup time for OpenSearch Dashboards. The initial bundling speed is dependent on your hardware limitations and VNC settings. Feel free to make adjustments to improve the process as needed.
Open a separate terminal and update Chromedriver by executing node scripts/upgrade_chromedriver.js
, followed by yarn osd bootstrap
. This will update the Chromedriver version within the node_modules directory, allowing you to use a compatible version with your installed Google Chrome.
To run functional tests, please refer to the Functional tests section in the TESTING.md
file.
The Selenium tests will be executed in the browser, viewable through the VNC viewer. You can monitor the test progress in real-time.
This Alternative Docker Development Environment Setup allows the creation of a Data Source in Cypress with no authentication.
Follow the Docker Development Environment Setup, but with the following deviations:
/docker-workspace/OpenSearch-Dashboards
fetch the latest version of main.OpenSearch-Dashboards/config/opensearch_dashboards.yml
.workspace.enabled: true
uiSettings:
overrides:
'home:useNewHomePage': true
'query:enhancements:enabled': true
opensearch.ignoreVersionMismatch: true
data_source.enabled: true
data.savedQueriesNewUI.enabled: true
yarn start:docker --no-base-path
You can now add Sample Data to the Data Source and create a Data Source in Dashboards by including the following code in your beforeEach(()=>{})
block:
// Load test data
cy.osd.setupTestData(
PATHS.SECONDARY_ENGINE,
[`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_1}.mapping.json`],
[`cypress/fixtures/query_enhancements/data_logs_1/${INDEX_WITH_TIME_1}.data.ndjson`]
);
// Add data source
cy.osd.addDataSource({
name: DATASOURCE_NAME,
url: 'http://opensearch-node:9200/',
authType: 'no_auth',
});
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )