Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
electerious committed Aug 15, 2020
2 parents 5e4159d + 5560137 commit f790f85
Show file tree
Hide file tree
Showing 256 changed files with 7,798 additions and 7,283 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.0.0] - 2020-08-15

The first major back-end and front-end rewrite of Ackee with new API, dashboard, active visitors counter and more. Updating is as easy as ever. Simple grab the newest version, ensure that you're using Node.js v14 or higher and start Ackee. That's it!

### Added

- GraphQL API
- Overview with facts and data from all domains
- Facts card with live visitor counter, average visits and durations and the total number of visits today, this month and year
- New navigation that allows you to view stats by domain
- Keyboard shortcuts
- Switch between daily, monthly and yearly durations
- Click on a card headline to view more of this domain or insight
- Support `+srv` connection string modifier for MongoDB urls (#132, thanks @ericsandine)

### Changed

- Improved performance for all aggregations
- Show stale data while loading new data
- Removed detailed durations
- Delete records of a domain when deleting a domain
- Updated the required Node.js version and Docker Node.js version to v14
- Removed "All time" and replaced it with "Last 6 months" for performance reasons

### Fixed

- Sorting of yearly views

## [1.7.1] - 2020-05-15

### Added
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:10
FROM mhart/alpine-node:14

EXPOSE 3000

Expand Down
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Ackee is a web app you install on your server to analyse the traffic of your sit

### Why Ackee?

Ackee is lightweight, easy to install and has a good balance between analytics and privacy. It features an API and web interface and tracks only what's necessary.
Ackee is lightweight, easy to install and has a good balance between analytics and privacy. It features a GraphQL API and web interface and tracks only what's necessary.

It's is the right tool for you if you care about privacy and don't need a full-features marketing analytics platform like Google Analytics or Matomo.

Expand All @@ -52,7 +52,7 @@ It's is the right tool for you if you care about privacy and don't need a full-f
- Modern and fast architecture
- Beautiful and focused interface
- No unique user tracking and no cookies
- Fully documented API
- Fully documented GraphQL API

### How does it work?

Expand All @@ -68,27 +68,15 @@ The interface of Ackee lets you view and analyse your tracked information.

Ackee depends on...

- [Node.js](https://nodejs.org/en/) (v10.16 or newer)
- [Node.js](https://nodejs.org/en/) (v14 or newer)
- [yarn](https://yarnpkg.com/en/)
- [MongoDB](https://www.mongodb.com) (v4.0.6 or newer)

Make sure to install and update all dependencies before you setup Ackee.

### API

- [/](docs/UI.md)
- [/tokens](docs/tokens.md)
- [/domains](docs/domains.md)
- [/domains/:domainId/records](docs/records.md)
- [/domains/:domainId/views](docs/views.md)
- [/domains/:domainId/pages](docs/pages.md)
- [/domains/:domainId/referrers](docs/referrers.md)
- [/domains/:domainId/durations](docs/durations.md)
- [/domains/:domainId/systems](docs/systems.md)
- [/domains/:domainId/devices](docs/devices.md)
- [/domains/:domainId/browsers](docs/browsers.md)
- [/domains/:domainId/sizes](docs/sizes.md)
- [/domains/:domainId/languages](docs/languages.md)
Ackee features a [GraphQL API](docs/API.md) that allows you to build custom tools upon Ackee. Everything you see in the UI is made from data delivered by the API.

### Options

Expand Down
220 changes: 220 additions & 0 deletions docs/API.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# API

Ackee features a GraphQL API that allows you to build custom tools upon Ackee. Everything you see in the UI is made from data delivered by the API.

Here are a few resources to help you get started with GraphQL:

- https://graphql.org/learn/
- https://www.howtographql.com

## Playground

GraphQL Playground is a graphical, interactive, in-browser GraphQL IDE. It allows you to play and experiment with the API of Ackee.

Simply run Ackee with `NODE_ENV` set to `development` and visit the `/api` playground in your browser. You can do so by adding `NODE_ENV=development` to the environment of your `docker-compose.yml` or by using `yarn start:dev`. Only use this mode on your local machine as Ackee runs slower when in development mode.

Try the [🔮 live playground](https://demo.ackee.electerious.com/api) of the Ackee demo.

## Authentication

Modifying domains or receiving aggregated data is only possible once you're authenticated. Only the creation of new data is possible without a token.

### Creating a token

The following mutation returns a new token `id` that should be used for authentication. This is what happens in the UI when you submit your username and password.

```graphql
mutation createToken($input: CreateTokenInput!) {
createToken(input: $input) {
payload {
id
}
}
}
```

```json
{
"input": {
"username": "admin",
"password": "123456"
}
}
```

The token is valid for one day and will be renewed on every request made with it. You can modify the TTL (time to live) in [the options](Options.md#ttl).

### Use token

Protected queries and mutations need to include the `Authorization` HTTP header. Replace `tokenId` with the token `id` from the previous step.

```json
{
"Authorization": "Bearer tokenId"
}
```

## Queries

Queries are used to receive data. Here are a few examples:

### Get all domains

```graphql
query getDomains {
domains {
id
title
}
}
```

### Get a specific domain

```graphql
query getDomain($id: ID!) {
domain(id: $id) {
id
title
}
}
```

```json
{
"id": "3b8bc3ed-cdcb-492a-bc6d-8d5b2746da0e"
}
```

### Get facts of domains

```graphql
query getDomainsFacts {
domains {
facts {
activeVisitors
averageViews
averageDuration
viewsToday
viewsMonth
viewsYear
}
}
}
```

### Get statistics of domains

```graphql
query getDomainsStatistics {
domains {
statistics {
durations(interval: DAILY) {
id
count
}
views(interval: YEARLY, type: UNIQUE) {
id
count
}
languages(sorting: TOP) {
id
count
created
}
browsers(sorting: TOP, type: WITH_VERSION) {
id
count
created
}
devices(sorting: TOP, type: WITH_MODEL) {
id
count
created
}
pages(sorting: TOP) {
id
count
created
}
referrers(sorting: TOP) {
id
count
created
}
sizes(sorting: TOP, type: SCREEN_RESOLUTION) {
id
count
created
}
systems(sorting: TOP, type: NO_VERSION) {
id
count
created
}
}
}
}
```

## Mutations

Mutations are used to add, update or delete data. Here are a few examples:

### Create a domain

```graphql
mutation createDomain($input: CreateDomainInput!) {
createDomain(input: $input) {
payload {
id
title
}
}
}
```

```json
{
"input": {
"title": "Domain Title"
}
}
```

### Delete a domain

```graphql
mutation deleteDomain($id: ID!) {
deleteDomain(id: $id) {
success
}
}
```

```json
{
"id": "3b8bc3ed-cdcb-492a-bc6d-8d5b2746da0e"
}
```

### Create a record

```graphql
mutation createRecord($domainId: ID!, $input: CreateRecordInput!) {
createRecord(domainId: $domainId, input: $input) {
payload {
id
}
}
}
```

```json
{
"domainId": "3b8bc3ed-cdcb-492a-bc6d-8d5b2746da0e",
"input": {
"siteLocation": "https://example.com"
}
}
```
21 changes: 17 additions & 4 deletions docs/Get started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [With Helm](#with-helm)
- [Without Docker](#without-docker)
- [With Heroku](#with-heroku)
- [With Render](#with-render)

## With Docker Compose

Expand Down Expand Up @@ -114,7 +115,7 @@ If you're using the `ingress-nginx`, enabling the ingress will set the necessary

Ackee dependents on …

- [Node.js](https://nodejs.org/en/) (v10.16 or newer)
- [Node.js](https://nodejs.org/en/) (v14 or newer)
- [yarn](https://yarnpkg.com/en/)
- [MongoDB](https://www.mongodb.com) (v4.0.6 or newer)

Expand Down Expand Up @@ -169,7 +170,9 @@ Simply deploy to Heroku by clicking this button:

### 2. Configure Ackee

Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#heroku-or-platforms-as-a-service-configuration).
- You need to have a MongoDB instance running, either hosting it yourself or using a (paid) add-on like [ObjectRocket MongoDB](https://elements.heroku.com/addons/ormongo). This is as simple as typing `heroku addons:create ormongo:2-wt --app <YOUR_APP_NAME>` using the CLI, or using the web dashboard; more details at the [official documentation](https://devcenter.heroku.com/articles/managing-add-ons). You'll need to provide connection details to Ackee dyno, either from the web dashboard or via command line, e.g. `heroku config:add "ACKEE_MONGODB=mongodb://<host>:<port>/<db>"`

- Ensure that you're using the correct CORS headers by setting [`ACKEE_ALLOW_ORIGIN`](CORS%20headers.md#heroku-or-platforms-as-a-service-configuration).

### 3. Updating Ackee

Expand All @@ -187,7 +190,17 @@ You'll then want to add the Ackee repo as origin, pull the latest changes, and p
```sh
git remote add origin https://github.com/electerious/Ackee.git
git pull origin master
git push origin heroku master
git push heroku master
```

After your application re-deploys you'll have the latest version of Ackee!
After your application re-deploys you'll have the latest version of Ackee!

## With Render

You can use [Render's](https://render.com/) one-click deploy button to get up and running with Ackee in minutes.

Click **Deploy to Render** below and follow the prompts to set up Ackee on Render.

[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/render-examples/ackee)

Once your deploy has finished, you are ready to start using Ackee! Visit the URL for your service to login. You can get your login credentials from the `ACKEE_USERNAME` and `ACKEE_PASSWORD` environment variables in the **Environment** tab of your service. By default, your username will be `render` and your password will be a randomly generated string.
2 changes: 1 addition & 1 deletion docs/SSL and HTTPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Ackee runs a simple server that doesn't support TSL/SSL. This means it's not pos

> A reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client, appearing as if they originated from the proxy server itself.
A reverse proxy makes it easy for you to run Ackee on your server along with other services. It also allows you to secure connections using TSL/SSL.
A reverse proxy makes it easy for you to run Ackee on your server along with other services. It also allows you to secure connections using TLS/SSL.

I highly recommend [this article](https://medium.com/intrinsic/why-should-i-use-a-reverse-proxy-if-node-js-is-production-ready-5a079408b2ca) if you want to lean more about reverse proxies.

Expand Down
Loading

0 comments on commit f790f85

Please sign in to comment.