This repository has been archived by the owner on Jan 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a rust implementation of PushBox and is a work in progress.
- Loading branch information
Showing
18 changed files
with
1,553 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
# Remember to run `cargo update` to ensure that versions are updated. | ||
# `cargo clean` does not change the Cargo.lock file. | ||
[package] | ||
name = "rustbox" | ||
version = "0.1.0" | ||
authors = ["jrconlin <jconlin+git@mozilla.com>"] | ||
|
||
[dependencies] | ||
rocket="0.3" | ||
rocket_codegen="0.3" | ||
serde="1.0" | ||
serde_json="1.0" | ||
serde_derive="1.0" | ||
mysql="12.2" | ||
reqwest="0.8" # for HTTP Client calls. | ||
|
||
failure="~0.1" | ||
mysql="~12.2" | ||
rand="~0.4" | ||
reqwest="^0.8.5" | ||
rocket="~0.3" | ||
rocket_codegen="~0.3" | ||
serde="~1.0" | ||
serde_derive="~1.0" | ||
serde_json="~1.0" | ||
slog="~2.2" | ||
slog-async="~2.2" | ||
slog-term="~2.3" | ||
slog-json="~2.2" | ||
slog-scope="~4.0" | ||
slog-stdlog="~3.0" | ||
time="~0.1" | ||
|
||
[dependencies.rocket_contrib] | ||
default-features=false | ||
version="~0.3" | ||
default-features=true | ||
|
||
[dependencies.diesel] | ||
version="~1.1" | ||
features=["mysql", "r2d2"] | ||
|
||
[dependencies.mysql] | ||
version="*" | ||
#features=["ssl"] | ||
[dependencies.diesel_migrations] | ||
version="~1.1" | ||
features=["mysql"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Rustbox - A rust implementation of PushBox long term storage | ||
|
||
## What is it? | ||
|
||
This is an internal project. mozilla needs the ability to store large data | ||
chunks that may not fit perfectly within a standard WebPush message. PushBox | ||
acts as an intermediary store for those chunks. | ||
|
||
Messages are created by Firefox Accounts (FxA), stored here, and then a | ||
WebPush message containing a URL that points back to this storage is sent | ||
to the User Agent. | ||
|
||
The User Agent can then fetch the data, decrypt it and do whatever it needs | ||
to. | ||
|
||
This project, once completed, will eventually replace the AWS Severless | ||
PushBox project. It's being developed here because serverless can be a bit | ||
greedy about what it grabs, and since PushBox is a rapid prototype, it's | ||
good to treat it in a clean room environment. | ||
|
||
|
||
## Requirements | ||
|
||
The project requires Rust Nightly, a MySQL compliant data store, and | ||
access to a [Firefox Accounts token verifier](https://github.com/mozilla/fxa-auth-server) system. | ||
|
||
|
||
## Setting Up | ||
|
||
1) Install Rust Nightly. | ||
|
||
The rocket.rs [Getting Started](https://rocket.rs/guide/getting-started/) | ||
document lists information on how to set that up. | ||
|
||
2) create the Rustbox MySQL user and database. | ||
|
||
Because I'm horribly creative and because this is a WIP, I use "`test:test@localhost/pushbox`". | ||
This is not recommended for production use. You can set your preferred | ||
MySQL access credential information as "database_url" in the `Rocket.toml` | ||
settings file (See [Rocket Config](https://rocket.rs/guide/configuration/#rockettoml) | ||
information.) | ||
|
||
3) Run the MySQL migrations `up.sql` file located in `./migrations/*/up.sql` | ||
|
||
4) Run `cargo run` to start the application, which (depending on the last commit) may actually start the program. YMMV. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[development] | ||
database_url="mysql://test:test@localhost/pushbox" | ||
fxa_host="oauth.stage.mozaws.net" | ||
dryrun=true | ||
|
||
[staging] | ||
|
||
[production] | ||
|
||
[global.limits] | ||
json = 1048576 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- This file should undo anything in `up.sql` | ||
Drop Table pushboxv1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE pushboxv1 ( | ||
user_id Varchar(200) Not Null, | ||
device_id Varchar(200), | ||
data Blob, | ||
idx BigInt Auto_Increment, | ||
ttl BigInt, | ||
Primary Key(idx) | ||
); | ||
Create Index user_id_idx on pushboxv1 (user_id); | ||
Create Index full_idx on pushboxv1 (user_id, device_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*REMEMBER* you need to hand edit the up.sql and down.sql files. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.