Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Commit 7f27c6b

Browse files
committed
Update Ansible configuration for deploying dashboard using runtime
environment variables
1 parent 1f51ae4 commit 7f27c6b

File tree

21 files changed

+66
-76
lines changed

21 files changed

+66
-76
lines changed

.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Example Configuration
2+
elasticsearch='http://test_domain.com'
3+
results='http://test_domain.com'
4+
graphql='http://test_domain.com'
5+
prefix='test_prefix.'
6+
result_index='test_index.'
7+
run_index='test_index.'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ package-lock.json
3131
__snapshots__
3232

3333
# config
34-
/config/endpoints.js
34+
.env

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ This will automatically open the application on [http://localhost:8000](http://l
7070

7171
Both the production and development builds of the dashboard require API endpoint configurations in order to query data from specific datastores.
7272

73-
`endpoints.js` in the `config/` directory contains references to datastores required to visualize data in the dashboard. Please reference the following example for required configuration fields.
73+
`public/endpoints.js` contains references to datastores required to visualize data in the dashboard. Please reference the following example for required configuration fields:
7474

7575
```JavaScript
76-
export default {
77-
"elasticsearch": "http://elasticsearch.example.com",
78-
"results": "http://results.example.com",
79-
"graphql": "http://graphql.example.com",
80-
"prefix": "example.prefix",
81-
"run_index": "example.index",
82-
"result_index": "example.index"
83-
}
76+
window.endpoints = {
77+
elasticsearch: 'http://test_domain.com',
78+
results: 'http://test_domain.com',
79+
graphql: 'http://test_domain.com',
80+
prefix: 'test_prefix.',
81+
result_index: 'test_index.',
82+
run_index: 'test_index.'
83+
};
8484
```
8585

8686
## Storage Config

ansible/README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,32 @@ This will ease installation, and deployment of the pbench dashboard.
33

44
## Required
55
- Ansible needs to be installed on the host where you want to run this playbook
6-
- An inventory file containing the following key values defined:
7-
- "`elasticsearch_url`", "`results_url`", "`graphql_url`", "`run_index`", "`prefix`"
8-
See the `/README.md` for more details.
6+
- An inventory file containing the server values defined
7+
8+
## Endpoint Configuration
9+
API endpoints are defined in `public/endpoints.js` as runtime configuration variables for reference in the dashboard binary. Before deployment of the binary to a remote host, consider the configuration at `public/endpoints.js` as the file is copied to the target server during deployment. Please reference the following example for required configuration fields:
10+
11+
```JavaScript
12+
window.endpoints = {
13+
elasticsearch: 'http://test_domain.com',
14+
results: 'http://test_domain.com',
15+
graphql: 'http://test_domain.com',
16+
prefix: 'test_prefix.',
17+
result_index: 'test_index.',
18+
run_index: 'test_index.'
19+
};
20+
```
921

1022
## Run
1123
Running the below commands from this checked-out directory to install the
1224
pbench dashboard components locally, and then deploy hosts mentioned under
13-
the "`[servers:children]`" section of the given `inventory` file.
14-
15-
There's also an option to define the dashboard configuration in the provided
16-
inventory file.
25+
the "`[servers]`" section of the given `inventory` file.
1726

1827
See the `inventory` file in this directory for an example.
1928
```
29+
$ # First bundle the dashboard for production
30+
$ yarn build
31+
$
2032
$ # First add a link to the "dist" folder where the dashboard will be built.
2133
$ ln -sf ../dist dist
2234
$ ansible-playbook -i inventory dashboard-install.yml

ansible/config.json.j2

Lines changed: 0 additions & 1 deletion
This file was deleted.

ansible/inventory

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
[servers:children]
2-
ui-server
3-
user-server
4-
5-
[servers:vars]
6-
results_url="http://{{ inventory_hostname }}"
7-
run_index="run.example"
8-
graphql_url="http://{{ inventory_hostname }}"
9-
10-
[ui-server]
11-
ui-server.example.com
12-
13-
[ui-server:vars]
14-
elasticsearch_url="http://elasticsearch.example.com"
15-
prefix="ui-server.example."
16-
17-
[user-server]
18-
user-server.example.com
19-
20-
[user-server:vars]
21-
elasticsearch_url="http://elasticsearch.example.com"
22-
prefix="user-server.example."
1+
[servers]
2+
staging-server.example.com
3+
production-server.example.com

ansible/roles/dashboard-deploy/tasks/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,3 @@
1313
dest: /var/www/html/dashboard
1414
owner: pbench
1515
group: pbench
16-
17-
- name: initialize dashboard config file
18-
template: src=config.json.j2 dest=/var/www/html/dashboard/config.json mode=0644 owner=pbench group=pbench

config.json.j2

Lines changed: 0 additions & 8 deletions
This file was deleted.

config/config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import pageRoutes from './router.config';
2-
import endpoints from './endpoints';
32

43
export default {
5-
define: {
6-
'process.env.endpoints': endpoints,
7-
},
84
dynamicImport: undefined,
95
base: '/dashboard/',
106
publicPath: process.env.NODE_ENV === 'development' ? '/' : '/dashboard/',

config/endpoints.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)