https://github.com/ganchdev/keypea
Online keypair wallet
https://github.com/ganchdev/keypea
microservices ruby secrets-management
Last synced: over 1 year ago
JSON representation
Online keypair wallet
- Host: GitHub
- URL: https://github.com/ganchdev/keypea
- Owner: ganchdev
- License: mit
- Created: 2022-12-10T22:32:36.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-05T15:35:08.000Z (about 3 years ago)
- Last Synced: 2025-01-21T17:48:44.388Z (over 1 year ago)
- Topics: microservices, ruby, secrets-management
- Language: Ruby
- Homepage:
- Size: 690 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Keypea
Keypea is an app that stores encrypted secrets in a database and can be seen running at [keypea.app](https://keypea.app). This is (probably) nothing more than an attempt to implement and deploy a real-life micro-service architecture in a monorepo. The app uses a bunch of different tech, but it's mostly kept simple to show what can be done with as few dependencies as possible. It is built in 4 parts:
- The authentication service `auth-service` is a `rack` application that handles user CRUD and user authentication, it requires its own `mongodb` instance to persist data.
- The secrets service `secrets-service` also a `rack` application that deals with secrets CRUD and secrets encryption/decryption, it also requires its own `mongodb` instance to persist data.
- The gateway `gateway` is a `hanami` app that handles all user requests, sessions and routes requests to the appropriate underlying service. It requires `redis` for session management.
- The web client `frontend` is a `react` app that shows pages to users.
## Pre-requisites for development
- Ruby 3.0 or greater
- Node.js v16.15.1 or greater
- Docker
- Mongodb server
- Redis server
- Bundler
- Yarn
## Running
The whole project can be run in two ways:
- `docker-compose`
- `foreman` (for development)
### Foreman
You'll need to go through a quick setup before we run the whole thing
1) Run `redis` container locally:
```
docker run --rm --name container-redis -d redis
```
2) Run `mongodb` container locally:
```
docker run -d --name container-mongo -p 27017:27017 -d --restart always -e MONGO_INITDB_ROOT_USERNAME=mongoadmin -e MONGO_INITDB_ROOT_PASSWORD=secret mongo
```
3) Install foreman: `gem install foreman`
4) Install auth service dependencies and create db indexes:
```
cd auth-service/ && bundle && rake db:mongoid:create_indexes
```
5) Then install secrets service dependencies and create db indexes:
```
cd ../secrets-service/ && bundle && rake db:mongoid:create_indexes
```
6) Install gateway dependencies:
```
cd ../gateway/ && bundle
```
7) Install frontend dependencies:
```
cd ../frontend/ && yarn install
```
8) Start foreman
```
cd ../ && formean start
```
Visit each project's readme for more information about environment variables and defaults used within the app. You'd also need a reverse proxy such as [caddy](https://caddyserver.com/) to route local subdomains based on each port of the app.
#### Example Caddyfile
```
frontend.localhost {
reverse_proxy localhost:9001
tls internal
}
gateway.localhost {
reverse_proxy localhost:5001
tls internal
}
auth.localhost {
reverse_proxy localhost:5002
tls internal
}
secrets.localhost {
reverse_proxy localhost:5003
tls internal
}
```