Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Initial Version #2

Merged
merged 1 commit into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions Cargo.toml
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"]
46 changes: 46 additions & 0 deletions README.md
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.

11 changes: 11 additions & 0 deletions Rocket.toml
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
2 changes: 2 additions & 0 deletions migrations/2018-03-28-211330_create_users_table/down.sql
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;
10 changes: 10 additions & 0 deletions migrations/2018-03-28-211330_create_users_table/up.sql
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);
1 change: 1 addition & 0 deletions setup_diesel.sh
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.
26 changes: 0 additions & 26 deletions src/auth.rs

This file was deleted.

Loading