drop

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2019 License: MIT Imports: 1 Imported by: 0

README

Drop

Put/Remove your links and access them from multiple devices as they're updated in real-time.

Quicker demo

https://farnasirim.ir/drop

How

Data is stored in redis. Client and backend communicate over GRPC. Clients subscribe for updates using server-side streaming feature of http2 and can also submit requests for creating/deleting entries.

Quick deployment

Create a docker bridge network to contain the following three containers:

docker network create drop

Create a redis server with the name redis:

docker run -v $(pwd)/data:/data -d --net drop -p 127.0.0.1:6379:6379 --name redis redis --appendonly yes

Run the envoy to proxy incoming http requests to the grpc server:

docker run --net drop -v /path/to/cert-chain.pem:/etc/fullchain.pem -v /path/to/privkey.pem:/etc/privkey.pem -d -p 0.0.0.0:18082:8080 --name envoy-sec quay.io/farnasirim/drop-envoy-sec:v0.0.1

If you're not willing to use tls (!) use the container that is named quay.io/farnasirim/drop-envoy:v0.0.1 and remove the -v directives mounting the credentials.

Run drop grpc server:

docker run -d --name drop-server --net drop -p 127.0.0.1:12345:12345 quay.io/farnasirim/drop-server:v0.1.2

The frontend is still not served by the drop server, so you need to manually build a bundle.js from frontend/client.js and somehow serve it alongside frontend/index.html.

Development

To create any of the above artifacts please refer to the Makefile.

TODO

  • Adding multi-user support (Authentication)
    • It must be easy and secure
    • Proposal: Magic link i.e. emailing people a link that they can click (on a possibly different device) that would automatically log them in.
  • Adding support for uploading files up to a certain size
  • Chrome extension to allow for adding links quickly with a hotkey
  • Making the page mobile friendly
  • Progressive web app
  • Json api

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record interface {
	ID() int64
	Text() string
	Address() string
}

type StorageService

type StorageService interface {
	PutRecord(family string, rec Record) (int64, error)
	DeleteRecord(family string, key int64) error
	GetRecord(family string, key int64) (Record, error)

	AllRecordsAfter(ctx context.Context, family string, lastId int64) (<-chan Record, int64)
	AllCreateEventsAfter(ctx context.Context, family string, lastId int64) <-chan Record
	AllDeleteEvents(ctx context.Context, family string) <-chan Record
}

Directories

Path Synopsis
cmd
storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL