Skip to content

Commit 3fe3722

Browse files
committed
examples: web-analytics update README
1 parent 63b0c06 commit 3fe3722

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

examples/web-analytics/README.md

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,52 @@ LOCATION 's3://bucket-name/path/to/enriched/good';
179179

180180
### 3. Install MySQL for Cube.js External Pre-Aggregations
181181

182-
This template uses MySQL as an external pre-aggregations database for performance optimization. Cube.js builds pre-aggregations from data stored in the main data warehouse, Athena in this example, and then uploads them into MySQL. Cube.js handles the refresh and partitioning of the pre-aggregations as well.
183-
184-
You need to provide the following environment variables for Cube.js to connect to MySQL: `CUBEJS_EXT_DB_HOST`, `CUBEJS_EXT_DB_NAME`, `CUBEJS_EXT_DB_PORT`, `CUBEJS_EXT_DB_USER`, `CUBEJS_EXT_DB_PASS`. You can learn more about [external pre-aggregations in the documentation here.](https://cube.dev/docs/pre-aggregations#external-pre-aggregations)
182+
This template uses MySQL as an external pre-aggregations database for performance optimization. Cube.js builds pre-aggregations from data stored in the main data warehouse, Athena in this example, and then uploads them into MySQL. Cube.js handles the refresh and partitioning of the pre-aggregations as well. You need to install MySQL and let Cube.js to connect to it. You can learn more about [external pre-aggregations in the documentation here.](https://cube.dev/docs/pre-aggregations#external-pre-aggregations)
185183

186184
### 4. Install Cube.js backend and React frontend applications
187185

188-
Docker container Configure via env variables
186+
First, you need to download or clone the code inside `examples/web-analytics`
187+
folder and install all the dependencies by running the following command:
188+
189+
```bash
190+
$ npm install
191+
```
192+
193+
The next step is to set environment variables required to run Cube.js backend.
194+
You can use `.env` file to store your credentials or provide them in any other way
195+
you'd prefer. Here the list of env variables you need to provide -
196+
197+
```
198+
CUBEJS_AWS_REGION=Your Athena region (e.g. us-east-1)
199+
CUBEJS_AWS_S3_OUTPUT_LOCATION=Your S3 Output location
200+
# You can find the Athena S3 Output location here: https://docs.aws.amazon.com/athena/latest/ug/querying.html
201+
CUBEJS_JDBC_DRIVER=athena
202+
CUBEJS_DB_TYPE=athena
203+
CUBEJS_API_SECRET=SECRET-SECURE-STRING
204+
CUBEJS_EXT_DB_HOST=Your MySQL host
205+
CUBEJS_EXT_DB_NAME=Table name for pre-aggregations (e.g. cubejs_pre_aggregations)
206+
CUBEJS_EXT_DB_USER=MySQL username
207+
CUBEJS_EXT_DB_PASS=Password for MySQl user
208+
```
209+
210+
Now, you can run the Cube.js server with the following command:
211+
212+
```bash
213+
$ npm start
214+
```
215+
216+
By default, it starts in the development environment and serves Cube.js
217+
Playground on the root route. You can run it in the production mode by setting
218+
`NODE_ENV=production` env variable, in that case it will serve the frontend app from the root
219+
route.
220+
221+
In development you can run the frontend app as a seprate process by navigating
222+
into `dashboard-app` folder, installing dependencies and running `yarn start`.
223+
224+
You can easily build a docker image from the provided Dockerfile. Before doing
225+
this you need to build a frontend application. To do that navigate into
226+
`dashboard-app` folder, install all the dependencies via NPM or Yarn, and run
227+
`yarn build`.
189228

190229
### 5. Enable Authentication via Google OAuth 2 (Optional)
191230

0 commit comments

Comments
 (0)