Commit Graph

123 Commits

Author SHA1 Message Date
TymanWasTaken
0faf414cd9
feat: Add change-password command & support on server (#1615)
* Add change-password command & support on server

* Add a test for password change

* review: run format

---------

Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
2024-01-29 11:17:10 +00:00
Conrad Ludgate
bdcb143996
chore(deps): update axum (#1637) 2024-01-28 13:33:45 +00:00
Ellie Huxtable
4b20544474
chore: use resolver 2, update editions + cargo (#1635) 2024-01-26 17:59:06 +00:00
Ellie Huxtable
bdc533d2bc
feat: add registered and deleted metrics (#1622) 2024-01-23 20:01:20 +00:00
dependabot[bot]
2e3dde64e4
chore(deps): bump argon2 from 0.5.2 to 0.5.3 (#1603)
Bumps [argon2](https://github.com/RustCrypto/password-hashes) from 0.5.2 to 0.5.3.
- [Commits](https://github.com/RustCrypto/password-hashes/compare/argon2-v0.5.2...argon2-v0.5.3)

---
updated-dependencies:
- dependency-name: argon2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-22 10:00:25 +00:00
Ellie Huxtable
b3b4b8cdd4
feat: add metrics counter for records downloaded (#1584) 2024-01-17 10:56:16 +00:00
dependabot[bot]
d426397ca0
chore(deps): bump hyper from 0.14.28 to 1.1.0 (#1520)
Bumps [hyper](https://github.com/hyperium/hyper) from 0.14.28 to 1.1.0.
- [Release notes](https://github.com/hyperium/hyper/releases)
- [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/hyper/compare/v0.14.28...v1.1.0)

---
updated-dependencies:
- dependency-name: hyper
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 09:42:27 +00:00
Ellie Huxtable
7bc6ccdd70
feat: rework record sync for improved reliability (#1478)
* feat: rework record sync for improved reliability

So, to tell a story

1. We introduced the record sync, intended to be the new algorithm to
   sync history.
2. On top of this, I added the KV store. This was intended as a simple
   test of the record sync, and to see if people wanted that sort of
   functionality
3. History remained syncing via the old means, as while it had issues it
   worked more-or-less OK. And we are aware of its flaws
4. If KV syncing worked ok, history would be moved across

KV syncing ran ok for 6mo or so, so I started to move across history.
For several weeks, I ran a local fork of Atuin + the server that synced
via records instead.

The record store maintained ordering via a linked list, which was a
mistake. It performed well in testing, but was really difficult to debug
and reason about. So when a few small sync issues occured, they took an
extremely long time to debug.

This PR is huge, which I regret. It involves replacing the "parent"
relationship that records once had (pointing to the previous record)
with a simple index (generally referred to as idx). This also means we
had to change the recordindex, which referenced "tails". Tails were the
last item in the chain.

Now that we use an "array" vs linked list, that logic was also replaced.
And is much simpler :D

Same for the queries that act on this data.

----

This isn't final - we still need to add

1. Proper server/client error handling, which has been lacking for a
   while
2. The actual history implementation on top
    This exists in a branch, just without deletions. Won't be much to
    add that, I just don't want to make this any larger than it already
    is

The _only_ caveat here is that we basically lose data synced via the old
record store. This is the KV data from before.

It hasn't been deleted or anything, just no longer hooked up. So it's
totally possible to write a migration script. I just need to do that.

* update .gitignore

* use correct endpoint

* fix for stores with length of 1

* use create/delete enum for history store

* lint, remove unneeded host_id

* remove prints

* add command to import old history

* add enable/disable switch for record sync

* add record sync to auto sync

* satisfy the almighty clippy

* remove file that I did not mean to commit

* feedback
2024-01-05 17:57:49 +00:00
Ellie Huxtable
37c4b7adff
chore: remove the teapot response (#1496)
It was fun, but it wasn't as informative as it needs to be

I'm leaving the function name though :)
2024-01-03 16:37:27 +00:00
Ellie Huxtable
9f79a34a9d
chore(release): prepare for release v17.2.1 (#1495) 2024-01-03 15:51:47 +00:00
Ellie Huxtable
198b4e2ceb
fix(server): typo with default config (#1493)
Without TLS config, the server fails to load defaults. Until this is
released, add this to your server config

```
[tls]
enable = false
cert_path = ""
pkey_path = ""
```
2024-01-03 13:30:17 +00:00
Ellie Huxtable
999a98c577
chore(release): prepare for release v17.2.0 (#1492) 2024-01-03 12:46:08 +00:00
Eric Hodel
d52e576129
feat: Add TLS to atuin-server (#1457)
* Add TLS to atuin-server

atuin as a project already includes most of the dependencies necessary
for server-side TLS.  This allows `atuin server start` to use a TLS
certificate when self-hosting in order to avoid the complication of
wrapping it in a TLS-aware proxy server.

Configuration is handled similar to the metrics server with its own
struct and currently accepts only the private key and certificate file
paths.

Starting a TLS server and a TCP server are divergent because the tests
need to bind to an arbitrary port to avoid collisions across tests.  The
API to accomplish this for a TLS server is much more verbose.

* Fix clippy, fmt

* Add TLS section to self-hosting
2023-12-27 14:15:48 +00:00
Ellie Huxtable
86f50e0356
feat: add semver checking to client requests (#1456)
* feat: add semver checking to client requests

This enforces that the client and the server run the same major version
in order to sync successfully.

We're using the `Atuin-Version` http header to transfer this information

If the user is not on the same MAJOR, then they will see an error like
this

> Atuin version mismatch! In order to successfully sync, the client and the server must run the same *major* version
> Client: 17.1.0
> Server: 18.1.0
> Error: could not sync records due to version mismatch

This change means two things

1. We will now only increment major versions if there is a breaking
   change for sync
2. We can now add breaking changes to sync, for any version >17.1.0.
   Clients will fail in a meaningful way.

* lint, fmt, etc

* only check for client newer than server

* Add version header to client too
2023-12-20 09:03:04 +00:00
Ellie Huxtable
da2e58fbb1
chore(release): prepare for release v17.1.0 (#1432) 2023-12-10 13:00:59 +00:00
Ellie Huxtable
7575a83fa7
feat: add some metrics related to Atuin as an app (#1399) 2023-11-18 18:07:23 +00:00
Ellie Huxtable
15d214e237
feat: add metrics server and http metrics (#1394)
* feat: add metrics server and http metrics

* setup metrics

* update default config

* fix tests
2023-11-16 23:18:13 +00:00
Ellie Huxtable
bb438d8d59
Add Kris Nova to X-Clacks-Overhead (#1355)
Rest in peace 😔

https://nivenly.org/memorials/krisnova/
2023-10-28 21:18:16 +01:00
Ellie Huxtable
2959891f58
Release v17.0.1 (#1354) 2023-10-28 19:19:10 +00:00
Ellie Huxtable
0b22d06ad3
Prepare release v17.0.0 (#1327) 2023-10-25 18:06:59 +00:00
Conrad Ludgate
d202afeaf5
allow binding server to hostname (#1318) 2023-10-21 12:30:56 +01:00
Tobias Genannt
20afcd2b63
Add commands to print the default configuration (#1241)
* Add commands to print the default configuration

When updating a software I often want to compare my configuration with the
configuration of the new version. To make this possible atuin can now print
the default configuration.
This also updates the example files with the actual values used as default in
the settings.rs files.

* Changed command name to 'default-config'

* Fixed merge
2023-10-12 22:13:50 +01:00
Chris Rose
573ff69749
A man is not dead while his name is still spoken (#1280) 2023-10-03 19:36:16 +00:00
Conrad Ludgate
b4428c27c6
support timezones in calendar (#1259) 2023-09-29 17:49:38 +01:00
Conrad Ludgate
bdba88c11f
better sync error messages (#1254) 2023-09-26 14:44:56 +01:00
dependabot[bot]
8c0103dfff
Bump tower-http from 0.3.5 to 0.4.4 (#1210)
Bumps [tower-http](https://github.com/tower-rs/tower-http) from 0.3.5 to 0.4.4.
- [Release notes](https://github.com/tower-rs/tower-http/releases)
- [Commits](https://github.com/tower-rs/tower-http/compare/tower-http-0.3.5...tower-http-0.4.4)

---
updated-dependencies:
- dependency-name: tower-http
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-13 08:44:59 +01:00
Conrad Ludgate
f90c01f702
replace chrono with time (#806)
* replace chrono with time

* Fix test chrono usage

---------

Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
2023-09-11 09:26:05 +01:00
Ellie Huxtable
dead8f3645
Run formatting (#1202) 2023-08-30 22:37:15 +01:00
Ellie Huxtable
0d5332a87f
Prepare release v16.0.0 (#1143)
* Prepare release v16.0.0

* Remove debug output

* Fix kv dupes if the store already exists

* Add limit in frontend as well as sync backend
2023-08-07 11:18:39 +01:00
LeoniePhiline
73da97666f
fix(server): Teapot is a cup of coffee (#1137) 2023-07-31 17:17:33 +00:00
Conrad Ludgate
c10ba684e0
some simple server tests (#1096)
* some simple server tests

* fmt

* logging in server test

* log server errors

* fix postgres uri

* postgres ports

* localhost again?

* Rebase fixes

---------

Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
2023-07-27 09:34:13 +01:00
Ellie Huxtable
5786155969
Add total history count to the index API (#1102)
Thought it would be fun to collect some cool stats, maybe put them on
atuin.sh.
2023-07-14 20:44:47 +01:00
Ellie Huxtable
97e24d0d41
Add new sync (#1093)
* Add record migration

* Add database functions for inserting history

No real tests yet :( I would like to avoid running postgres lol

* Add index handler, use UUIDs not strings

* Fix a bunch of tests, remove Option<Uuid>

* Add tests, all passing

* Working upload sync

* Record downloading works

* Sync download works

* Don't waste requests

* Use a page size for uploads, make it variable later

* Aaaaaand they're encrypted now too

* Add cek

* Allow reading tail across hosts

* Revert "Allow reading tail across hosts"

Not like that

This reverts commit 7b0c72e7e0.

* Handle multiple shards properly

* format

* Format and make clippy happy

* use some fancy types (#1098)

* use some fancy types

* fmt

* Goodbye horrible tuple

* Update atuin-server-postgres/migrations/20230623070418_records.sql

Co-authored-by: Conrad Ludgate <conradludgate@gmail.com>

* fmt

* Sort tests too because time sucks

* fix features

---------

Co-authored-by: Conrad Ludgate <conradludgate@gmail.com>
2023-07-14 20:44:08 +01:00
YummyOreo
85c7339e65
fix: fixes unix specific impl of shutdown_signal (#1061) 2023-06-19 08:14:03 +01:00
Conrad Ludgate
8655c93853
refactor server to allow pluggable db and tracing (#1036)
* refactor server to allow pluggable db and tracing

* clean up

* fix descriptions

* remove dependencies
2023-06-12 09:04:35 +01:00
Marijan Smetko
5dc189cf83
Add graceful shutdown on SIGTERM (#1014)
* Add graceful shutdown on SIGTERM

* Fix linter
2023-05-30 05:51:16 +01:00
Ellie Huxtable
9e3fa8b88a
Release v15.0.0 (#995)
* Release v15.0.0

* Draft post

* Update contributors
2023-05-28 19:39:45 +01:00
Ellie Huxtable
d2240e1163
Allow server configured page size (#994)
* Allow server configured page size

* Backwards compat via semver checks

* Correct header name
2023-05-21 15:21:51 +00:00
Ellie Huxtable
ca263834e9
Restructure account commands to account subcommand (#984)
* Stop running triggers on history delete

* Move to account management dir

* Alter trigger function to only run for inserts

* wip

* Add atuin account subcommands, and re-org delete

* Clarify docs

* Delete silly dupe migration

* Um where did this come from

* Oops, insert only plz
2023-05-17 21:28:37 +01:00
Conrad Ludgate
7d5a82df14
validate usernames on registration (#982)
improve login password incorrect error message

update docs for registration with passwords
2023-05-16 22:03:53 +01:00
Yannick Ulrich
7b9dea72e3
feat: add delete account option (attempt 2) (#980)
* Added DELETE register endpoint

* Added remove function to database

* Added unregister to client

* Updated docs

* Renamed functions

* Reformatting

* Used execute instead of fetch in delete_user
2023-05-16 22:00:59 +01:00
Ellie Huxtable
bf7432f392
Patch bash history import regression (#970)
* At least patch this on the server side so we don't loop forever

* Postgres doesn't support <microsecond precision

Use millis - almost everything should support them and they are still
faster than a human can reasonably spam a button.
2023-05-10 13:02:35 +00:00
Conrad Ludgate
c7d89c1703
chore: uuhhhhhh crypto lol (#805)
* chore: uuhhhhhh crypto lol

* remove dead code

* fix key decoding

* use inplace encryption
2023-04-17 21:12:02 +01:00
Ellie Huxtable
7c079070c5
Release v14.0.1 (#883) 2023-04-16 11:25:48 +00:00
Vladislav Stepanov
c05d285042
Workspace reorder (#868)
* Try different workspace structure

Move main crate (atuin) to be on the same level with other crates in
this workspace

* extract common dependencies to the workspace definition

* fix base64 v0.21 deprecation warning

* questionable: update deps & fix chrono deprecations

possible panic sites are unchanged, they're just more visible now

* Revert "questionable: update deps & fix chrono deprecations"

This reverts commit 993e60f8de.
2023-04-14 20:18:58 +01:00
Ellie Huxtable
4e4fdb9f8e
Release Atuin v14 (#836)
* Bump versions

* Write release notes

* add link
2023-04-01 18:17:38 +01:00
Ellie Huxtable
0d16a113c5
Add atuin status (#830)
Useful for debugging, checking the state of things, and for if you
forget your username!
2023-03-30 06:45:49 +01:00
Ellie Huxtable
c30b457fc5
Account for user not yet having count cache (#812)
* Account for user not yet having count cache

* Make clippy happy
2023-03-26 17:48:41 +01:00
Ellie Huxtable
dcd77749dd
Add history deletion (#791)
* Drop events. I'd still like to do them, but differently

* Start adding delete api stuff

* Set mailmap

* Delete delete delete

* Fix tests

* Make clippy happy
2023-03-20 09:26:54 +00:00
Ellie Huxtable
b978f9a4de
Add register notification webhook (#764)
I find it super motivating when people use my stuff, so this makes it
_even easier_ to know when someone new signs up!
2023-03-07 22:09:19 +00:00