Commit Graph

782 Commits

Author SHA1 Message Date
Uku Taht
34d7d12229 Use SSH in Elixir for custom domains 2020-06-04 14:47:30 +03:00
Uku Taht
761072d285 Fix bug with has_pageviews? 2020-06-02 16:13:12 +03:00
Uku Taht
25d8f2f3f9
Schedule regular jobs with Oban (#69)
* Use oban for work

* Remove mix task for email reports

* Convert remaining tasks to Oban workers

* Add crontab for scheduled jobs

* Only enable cron if configured to do so
2020-06-02 13:37:38 +03:00
Chandra Tungathurthi
5eb8929929
Support for docker based self-hosting (#64)
* first commit with test and compile job

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* adding 'prepare' stage

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* updated ci script to include "test" compile phase

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* adding environment variables for connecting to postgresql

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* updated ci config for postgres

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* using non-alpine version of elixir

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* re-using the 'compile' artifacts and added explict env variables for testing

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* removing redundant deps fetching from common code

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* formatting using mix.format -- beware no-code changes!

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* added release config

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* adding consistent env variable for Database

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* more cleaning up of environment variables

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Adding releases config for enabling releases

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* cleaning up env configs

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Cleaned up config and prepared config for releases

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* updated CI script with new config for test

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Added Dockerfile for creating production docker image

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Adding "docker" build job yay!

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* using non-slim version of debian and installing webpack

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Adding overlays for migrations on releases

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* restricting the docker built to master branch only

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* typo fix

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* adding "Hosting.md" to explain hosting instructions

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* removed the default comments

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Added documentation related to env variables

* updated documentation and fixed typo

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* updated documentation

* Bumping up elixir version as `overlays` are only supported in latest version

read release notes: https://github.com/elixir-lang/elixir/releases/tag/v1.10.0

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Adding tarball assembly during release

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* updated HOSTING.md

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Added support for db migration

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* minor corrections

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* initializing admin user

Admin user has been added in the "migration" phase. A default user is automatically created in the process. One can provide the related env variables, else a new one will be automatically created for you.

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Initial base domain update - phase#1

These changes are only meant for correct operating it under self-hosting. There are many other cosmetic changes, that require updates to email, site and other places where the original website and author is used.

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Using dedicated config variable `base_domain` instead

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* adding base_domain to releases config

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* removing the dedicated config "base_domain", relying on endpoint host

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Removed the usage of "Mix" in code!

It is bad practice to use "mix" module inside the code as in actual release this module is unavailable. Replacing this with a config environment variable

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Added support for SMTP via Bamboo Smtp Adapter

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Capturing SMTP errors via Sentry

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Minor updates

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* Adding junit formatter -- useful for generating test reports

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* adding documentation for default user

* Resolve "Gitlab Adoption: Add supported services in "Security & Compliance""

* bumping up the debian version to fix issues

fixing some vulnerabilities identified by the scanning tools

* More updates for self-hosting

Changes in most of the places to suit self-hosting. Although, there are some which have been left-off.

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* quick-dirty-fix!

* bumping up the db connect timeout

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* bumping up the db connect timeout

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* bumping up the db connect timeout

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* bumping up timeout - skipping MRs :-/

* removing restrictions on watching for changes

this stuff isn't working

* Update HOSTING.md

* renamed the module name

* reverting formatting-whitespace changes

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* reverting the name to release

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* adding docker-compose.yml and related instructions

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* using `plausible_url` instead of assuming `https`

this is because, it is much to test in local dev machines and in most cases there's already a layer above which is capable for `https` termination and http -> https upgrade

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* WIP: merging changes from upstream

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* wip: more changes

* Pushing in changes from upstream

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* changes to ci for testing

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* cleaning up and finishing clickhouse integration

Signed-off-by: Chandra Tungathurthi <tckb@tgrthi.me>

* updating readme with hosting details
2020-05-26 16:09:34 +03:00
Uku Taht
43b46e7607 Show last touch referrer for drilldown 2020-05-25 14:52:20 +03:00
Uku Taht
a228c6162f Default to empty pathname 2020-05-25 12:25:41 +03:00
Uku Taht
b31c0114c5 Use Clickhouse everywhere 2020-05-22 12:33:17 +03:00
Uku Taht
d94a8dbc7e
Clickhouse (#66)
* Get stats from clickhosue

* Pull stats from clickhouse

* Use correct Query namespace

* Use Clickhouse in unit tests

* Use Clickhouse in stats controller tests

* Use fixtures for unit tests

* Add Clickhouse to travis

* Use Clickhouse session store for sessions

* Add garbage collection to session store

* Reload session state from Clickhouse on server restart

* Query from sessions table

* Trap exits in event write buffer

* Run hydration without starting the whole app

* Make session length 30 minutes

* Revert changes to fingerprint schema

* Remove clickhouse from fingerprint sessions

* Flush buffers before shutdown

* Use old stats when merging

* Remove old session schema

* Fix tests with CH sessions

* Add has_pageviews? to Stats

* Use CH in staging

* Update schema

* Fix test setup
2020-05-21 13:03:39 +03:00
Uku Taht
d1b703f007
Clickhouse (#63)
* Get stats from clickhosue

* Pull stats from clickhouse

* Use correct Query namespace

* Use Clickhouse in unit tests

* Use Clickhouse in stats controller tests

* Use fixtures for unit tests

* Add Clickhouse to travis

* Use Clickhouse session store for sessions

* Add garbage collection to session store

* Reload session state from Clickhouse on server restart

* Query from sessions table

* Trap exits in event write buffer

* Run hydration without starting the whole app

* Make session length 30 minutes

* Revert changes to fingerprint schema

* Remove clickhouse from fingerprint sessions

* Flush buffers before shutdown

* Use old stats when merging

* Remove old session schema

* Fix tests with CH sessions

* Add has_pageviews? to Stats
2020-05-18 12:44:52 +03:00
Uku Taht
5d1dc0d27c
Clickhouse DB (#62)
* WIP

* Get all stats from Clickhouse

* Use https dependency

* Do not namespace db tables in hydrate task

* Update hydration task

* Ingest data to clickhouse

* Double-write to both Clickhouse and Postgres

* Add test setup

* Keep old stats module

* Prepare for live ingestion test
2020-05-07 14:28:41 +03:00
Uku Taht
9476ccf95c
Yearly billing (#58)
* Add yearly billing options

* Add new subscription names

* Add note about yearly billing in the email

* Add a test for change_plan function

* Add allowance function back in

* Test billing controller endpoint
2020-04-21 14:11:38 +03:00
Uku Taht
4163d2a9ba
Authentication updates (#54)
* Use separate cookie for shared link auth

* Remove CSRF protection from login and register pages

* Add AuthorizeStats Plug

* Fix tests
2020-04-14 14:04:35 +03:00
Uku Taht
ddf08b97e8 Cascade custom domain deletion 2020-04-06 14:53:31 +03:00
Uku Taht
2b50c6cf2a Use correct headers 2020-04-02 13:43:06 +03:00
Uku Taht
074e895204 redirect users to /sites after login 2020-04-01 10:37:30 +03:00
Uku Taht
2cf57a795f Drop session 2020-03-31 15:38:42 +03:00
Uku Taht
e14001664c Fix tests 2020-03-31 15:01:27 +03:00
Uku Taht
594b085467
Analytics without using cookies (#44)
* Use fingerprints instead of user_id

* Fix tests
2020-03-24 10:50:16 +02:00
Uku Taht
6d1f7afde5 Do not send check stats email to someone who has weekly report enabled 2020-03-23 11:45:04 +02:00
Uku Taht
ee92ed5213
Email flows (#46)
* Update activation email

* Update trial upgrade emails

* Remove feedback emails

* Remove feedback email test

* Update welcome email (and send it earlier)

* Site setup emails

* Add create site emails for trialers

* Add check stats email

* Remove dead code

* Adjust site setup emails for users who are not on trial

* BCC myself on all new emails

* Use old phrasing in the welcome email
2020-03-23 11:34:25 +02:00
Uku Taht
3fc17a51d5
Add field to track trial expiry date (#45) 2020-03-18 16:27:46 +02:00
Uku Taht
a2ed7514d7
Improve datepicker (#41)
* Update datepicker dropdown style

* Add custom range for datepicker
2020-03-04 17:24:18 +02:00
Uku Taht
cc5722050a
Show favicons for referrers (#39) 2020-03-03 14:32:32 +02:00
Uku Taht
c0f686b3d0 Fix trailing slash in referrer 2020-03-02 10:47:25 +02:00
Uku Taht
08eba461df Fix issue with snippet code 2020-02-26 11:46:28 +02:00
Uku Taht
79b9f72b52
Custom domains (#34)
* UI to create custom domains

* Only call ssh once per domain

* Update copy for custom domain setup

* Use correct user for ssh
2020-02-26 10:54:21 +02:00
Uku Taht
5495e53454
Backfill fingerprints for returning users (#33) 2020-02-12 14:42:34 +02:00
Uku Taht
ed3110a6ea
Introduce initial referrer and initial referrer source (#32)
* Introduce initial referrer and initial referrer source

* Add test
2020-02-12 11:11:02 +02:00
Uku Taht
8a4d0a91d1
WIP: New UI updates (#19)
* WIP: New UI idea

* Remove hover styling if things are not clickable

* Improve mobile view

* Remove dead code

* Fade in tabs

* Update landing page with new style

* Fix countries test

* Fix alignment in conversions report
2020-02-10 15:17:00 +02:00
Uku Taht
3679a7351f Remove www from domain 2020-02-05 13:53:57 +02:00
Uku Taht
7dbbc8ba22
Configurable site id (#30)
* Use site id instead of hostname for events

* Use site id in domain status check

* Revert change to tracking module

* Catch more places where link generation needed updating

* Rename site_id to domain

* Drop hostname index from events
2020-02-04 15:44:13 +02:00
Uku Taht
ad2e5b6b28 Remove unused code 2020-01-30 11:03:55 +02:00
Uku Taht
f9724bf9f1 Delete user subscription when deleting the user 2020-01-29 16:00:18 +02:00
Uku Taht
9b0bd2162c Remove unused socket code 2020-01-29 11:34:47 +02:00
Uku Taht
614e2eeb34 Remove unused helper function 2020-01-29 11:33:10 +02:00
Uku Taht
5f62025176
Shared links (#29)
* Create shared links UI

* Show shared links in a list on settings page

* Show dropdown for each shared link

* Show icon actions for shared links

* Log user in when they click non-password-protected shared link

* Actually authenticate using a password

* Delete shared links
2020-01-29 11:29:11 +02:00
Uku Taht
c96f364ad8
Add and remove recipients for email reports (#28)
* Add and remove recipients for email reports

* Remove unused google_settings controller action

* Background job sends email reports to multiple recipients

* Add a way to unsubscribe for recipients who cannot log in

* Fix view on plausible link

* Include bounce rate in email report
2020-01-22 11:16:53 +02:00
Uku Taht
423db302f7 Only count new visitors in referrer report 2020-01-16 15:40:06 +02:00
Uku Taht
9df398b663 Use group by for grouping tweets 2020-01-16 15:13:03 +02:00
Uku Taht
b02cb74181
Fetch and display tweets (#27) 2020-01-16 13:39:47 +02:00
Uku Taht
94a20fb0a2
Add exit page to sessions (#25) 2020-01-15 11:00:42 +02:00
Uku Taht
9f30e9eb1c
Export main graph as csv (#24)
* Export main graph as csv

* Remove unused deps from mix-lock

* Update bamboo dependency
2020-01-13 15:16:35 +02:00
Uku Taht
0f6d742ae1 Show 6 months instead of 3 2020-01-08 11:25:46 +02:00
Uku Taht
5631367aef Add 'last year' instead of '6 months' 2020-01-08 11:23:03 +02:00
Uku Taht
254d34d0a4 Trim trailing slash from referrer 2020-01-08 10:53:08 +02:00
Uku Taht
29ae3a2c21 Show bounce rate for referrers and pages 2020-01-07 14:53:04 +02:00
Uku Taht
df1ba2cd82 Remove session length from the UI 2020-01-06 15:31:43 +02:00
Uku Taht
980275092d Show bounce rate and session length 2020-01-06 14:36:55 +02:00
Uku Taht
438a1c3d19 Cascade google auth deletion 2020-01-06 11:08:36 +02:00
Uku Taht
b7815bfe25 Revert "Cascade site google auth deletion"
This reverts commit fd8917d4f3.
2020-01-06 11:04:28 +02:00
Uku Taht
fd8917d4f3 Cascade site google auth deletion 2020-01-06 11:01:20 +02:00
Uku Taht
3548c57710 Capture session start 2019-12-20 12:30:29 +08:00
Uku Taht
f7d752988a Add sessions 2019-12-18 15:23:53 +08:00
Uku Taht
8888c86820 Launch goals & conversions 2019-11-28 12:01:07 +08:00
Uku Taht
e0737849ba Add test for conversion in month 2019-11-26 11:55:54 +08:00
Uku Taht
5ee2d908f2 Show conversion rate in the top stats when filtered for goal 2019-11-25 17:17:18 +08:00
Uku Taht
c540c70e87 Show conversion rate when filtering for goal 2019-11-22 16:37:44 +08:00
Uku Taht
b5797c8b10 Test getting conversions with a goal filter 2019-11-20 16:54:21 +08:00
Uku Taht
f71f98a521 Test Google referrer drilldown 2019-11-20 16:42:45 +08:00
Uku Taht
9feecf6741 Test pageview goal filter for referrers 2019-11-20 16:33:47 +08:00
Uku Taht
0ada544fd6 Test query for 6 months 2019-11-20 16:32:31 +08:00
Uku Taht
5d820dea39 Add test for goal filter 2019-11-20 16:31:49 +08:00
Uku Taht
96abfc4ea1 Click on goal to see conversions for it 2019-11-20 13:48:27 +08:00
Uku Taht
e8f20e67cc
React (#17)
* Load dashboard with react

* Rename stast2 to dashboard

* Save timeframe on the frontend

* Implement current visitors

* Implement comparisons

* React to route changes

* Add modals

* Show number of visitors on hover

* Show 'Today' for today

* Add 30 days

* Show referrer drilldown

* Arrow keys to go back and forward

* Improve comparisons UI

* Fix dropdown when clicking on it

* Verify API access in a memoized fashion

* Test API access

* Test stats through controller

* Move map formatting from stats controller to stats

* Remove unused code

* Remove dead code from query

* Remove dead code from stats templates

* Add stats view test back in

* Render modal inside the modal component

* Implement google search terms

* Add explanation for screen sizes

* Separate dashboard JS from the app js
2019-11-19 12:30:42 +08:00
Uku Taht
0ae5448a2b Show percentages for most stats 2019-11-06 12:41:06 +08:00
Uku Taht
9f2cdea503 Fix timezone display 2019-11-01 20:38:16 +08:00
Uku Taht
0b96ed3b6c Remove goal name 2019-10-31 14:36:16 +08:00
Uku Taht
71f6ccc73c Add tests for site controller 2019-10-31 14:25:16 +08:00
Uku Taht
bf8443d028 Test goal_conversions function 2019-10-31 14:14:06 +08:00
Uku Taht
c7ed0d54ce Add goals and conversions 2019-10-31 13:39:51 +08:00
Uku Taht
d687663b80 Use new /event endpoint for pageviews 2019-10-31 11:49:46 +08:00
Uku Taht
4adfa6bdfa Add tests for untested parts of stats.ex 2019-10-30 14:23:23 +08:00
Uku Taht
9dd08ddfa6 Add test for change plan page 2019-10-25 14:51:54 +08:00
Uku Taht
3ea64de42b Add name to events 2019-10-25 14:06:11 +08:00
Uku Taht
0c453be08c Rename pageviews to events 2019-10-24 14:58:17 +08:00
Uku Taht
7c7bdc6ef6 Proper timestamp 2019-10-15 15:37:55 +08:00
Uku Taht
71edf2c86d Remove unused fields from pageviews 2019-10-15 15:34:41 +08:00
Uku Taht
b458b5a392 Fix webhook 2019-10-15 11:30:02 +08:00
Uku Taht
1bb756362d Use email if user id is not known 2019-10-15 10:51:43 +08:00
Uku Taht
00d02faad0 Show current visitors 2019-09-04 16:08:01 +01:00
Uku Taht
d2855210de Fix bug with screen size 2019-09-04 10:50:56 +01:00
Uku Taht
779d64e19a Initial commit 2019-09-02 12:29:19 +01:00