Minor tweaks and get started on docs
This commit is contained in:
32
README.md
Normal file
32
README.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Sentry Toolkit
|
||||||
|
This project was born out of a simple marketing request. Basically along the lines of "how can we track user engagement in our CRM?", to which I answered "We already use Sentry for Session recording, we can pull that data from the API, aggregate it and push it to the CRM." Hence this project. It is currently pretty simple and includes an API as well as basic web ui.
|
||||||
|
|
||||||
|
|
||||||
|
## Tech Stack
|
||||||
|
- [AdonisJS](https://adonisjs.com): I decided to use the wonderful AdonisJS framework for this project. Overkill? probably but it has a lot of nicecities built in and I didn't want to reinvent the wheel for this simple project. I also wanted to play around with InertiaJS which comes included.
|
||||||
|
- [Docker](https://docker.com) - All services have been containerized for convience of developing, testing and deploying. A `compose.yml` and `compose.override.yml` are included for testing and developing locally.
|
||||||
|
- Redis - Some basic caching because why not?
|
||||||
|
- Postgresql - Useful for storing historical session data.
|
||||||
|
- Traefik - Reverse Proxy/Ingress controller Provided for convienent development and local testing.
|
||||||
|
- Grafana - (Optional) For building pretty dashboards.
|
||||||
|
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
```shell
|
||||||
|
$ cp .env.example .env.develop
|
||||||
|
# Add/edit values in .env.develop as needed
|
||||||
|
# The WEBHOOK_URL is not strictly necessary for basic functionality.
|
||||||
|
|
||||||
|
# Tested on Linux, I have not had the pleasure of setting up Traefik on Windows/Mac
|
||||||
|
# recently so suggestions welcome. Also you may need `sudo` depending on how your
|
||||||
|
# Docker environment is set up.
|
||||||
|
$ docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
Once all of the containers come up, you should be able to access the UI/API on [http://sentry.docker.localhost]() (Docker compose magic.) The database migrations should automatically run when you start with `docker compose` but if you are running the backend with node instead you will need to run `node ace migration:run` after starting the app for the first time.
|
||||||
|
|
||||||
|
The main page will list any Replay sessions stored in the database.
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
[http://sentry.docker.localhost/replays]() will fetch session data from Sentry and store it in the database. It will also return the results as JSON.
|
@ -34,7 +34,7 @@ export default class ReplaysController {
|
|||||||
return response.json(responseData)
|
return response.json(responseData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async list({ request, inertia }: HttpContext) {
|
public async home({ request, inertia }: HttpContext) {
|
||||||
const page = request.input('page', 1)
|
const page = request.input('page', 1)
|
||||||
const perPage = 20
|
const perPage = 20
|
||||||
const cacheKey = `replays:page:${page}`
|
const cacheKey = `replays:page:${page}`
|
||||||
@ -46,7 +46,7 @@ export default class ReplaysController {
|
|||||||
;({ paginated, meta, replays } = JSON.parse(data))
|
;({ paginated, meta, replays } = JSON.parse(data))
|
||||||
} else {
|
} else {
|
||||||
paginated = await Replay.query().paginate(page, perPage)
|
paginated = await Replay.query().paginate(page, perPage)
|
||||||
paginated.baseUrl('/list')
|
paginated.baseUrl('/')
|
||||||
|
|
||||||
const json = paginated.toJSON()
|
const json = paginated.toJSON()
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ function buildPaginationLinks(meta: {
|
|||||||
|
|
||||||
for (let page = 1; page <= meta.lastPage; page++) {
|
for (let page = 1; page <= meta.lastPage; page++) {
|
||||||
links.push({
|
links.push({
|
||||||
url: `/list?page=${page}`,
|
url: `/?page=${page}`,
|
||||||
label: page.toString(),
|
label: page.toString(),
|
||||||
active: page === meta.currentPage,
|
active: page === meta.currentPage,
|
||||||
})
|
})
|
||||||
|
BIN
docs/assets/homepage.jpg
Normal file
BIN
docs/assets/homepage.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -6,7 +6,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
||||||
<title inertia>
|
<title inertia>
|
||||||
AdonisJS x Inertia x VueJS
|
Sentry Toolkit
|
||||||
</title>
|
</title>
|
||||||
|
|
||||||
<link rel="preconnect" href="https://fonts.bunny.net" />
|
<link rel="preconnect" href="https://fonts.bunny.net" />
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import ReplaysController from '#controllers/replays_controller'
|
import ReplaysController from '#controllers/replays_controller'
|
||||||
import router from '@adonisjs/core/services/router'
|
import router from '@adonisjs/core/services/router'
|
||||||
router.on('/').renderInertia('home')
|
router.get('/', [ReplaysController, 'home'])
|
||||||
router.get('/replays', [ReplaysController, 'index'])
|
router.get('/replays', [ReplaysController, 'index'])
|
||||||
router.get('/list', [ReplaysController, 'list'])
|
router.get('/list', [ReplaysController, 'list'])
|
||||||
router.get('/stats', [ReplaysController, 'stats'])
|
router.get('/stats', [ReplaysController, 'stats'])
|
||||||
|
Reference in New Issue
Block a user