Skip to content

Commit 9310ac2

Browse files
authored
Merge pull request #37 from cipherstash/migrator-docs
feat: migrator docs
2 parents 9bb0cf1 + 9c00be9 commit 9310ac2

File tree

5 files changed

+91
-7
lines changed

5 files changed

+91
-7
lines changed

MIGRATOR.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# CipherStash Migrator
2+
3+
The CipherStash Migrator is a tool that can be used to migrate plaintext data in a database to its encrypted equivalent.
4+
It works inside the CipherStash Proxy Docker container and can handle different data types such as text, JSONB, integers, booleans, floats, and dates.
5+
By specifying the relevant columns in your table, the migrator will seamlessly encrypt the existing data and store it in designated encrypted columns.
6+
7+
## Prerequisites
8+
9+
- [CipherStash Proxy](PROXY.md)
10+
- [Have set up EQL in your database](GETTINGSTARTED.md)
11+
- Ensure that the columns where data will be migrated already exist.
12+
13+
Here’s a draft for the technical usage documentation for the CipherStash Migrator tool:
14+
15+
## Usage
16+
17+
The CipherStash Migrator allows you to specify key-value pairs where the key is the plaintext column, and the value is the corresponding encrypted column.
18+
Multiple key-value pairs can be specified, and the tool will perform a migration for each specified column.
19+
20+
### Running the migrator
21+
22+
You will need to SSH into the CipherStash Proxy Docker container to run the migrator.
23+
24+
```bash
25+
docker exec -it eql-cipherstash-proxy bash
26+
```
27+
28+
Once inside the container, you have access to the migrator tool.
29+
30+
```bash
31+
cipherstash-migrator --version
32+
```
33+
34+
#### Flags
35+
36+
| Flag | Description | Required |
37+
| --- | --- | --- |
38+
| `--columns` | Specifies the plaintext columns and their corresponding encrypted columns. The format is `plaintext_column=encrypted_column`. | Yes |
39+
| `--table` | Specifies the table where the data will be migrated. | Yes |
40+
| `--database-name` | Specifies the database name. | Yes |
41+
| `--username` | Specifies the database username. | Yes |
42+
| `--password` | Specifies the database password. | Yes |
43+
44+
#### Supported data types
45+
46+
- Text
47+
- JSONB
48+
- Integer
49+
- Boolean
50+
- Float
51+
- Date
52+
53+
### Example
54+
55+
The following is an example of how to run the migrator with a single column:
56+
57+
```bash
58+
cipherstash-migrator --columns example_column=example_column_encrypted --table examples --database-name postgres --username postgres --password postgres
59+
```
60+
61+
If you require additional data types, please [raise an issue](https://github.com/cipherstash/encrypt-query-language/issues)
62+
63+
### Running migrations with multiple columns
64+
65+
To run a migration on multiple columns at once, specify multiple key-value pairs in the `--columns` option:
66+
67+
```bash
68+
cipherstash-migrator --columns test_text=encrypted_text test_jsonb=encrypted_jsonb test_int=encrypted_int test_boolean=encrypted_boolean --table examples --database-name migrator_test --username postgres --password postgres
69+
```
70+
71+
## Notes
72+
73+
- Ensure that the corresponding encrypted columns already exist in the table before running the migration.
74+
- Data migration operations should be tested in a development environment before being executed in production.

PROXY.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ Populate the following fields with your values:
5151

5252
## Running the Proxy
5353

54-
To run the proxy, you can use the `start.sh` script in this directory. This script will start the proxy using the configuration in the `cipherstash-proxy.toml` file.
54+
To run the proxy, you can use `docker compose` to start the proxy using the configuration in the `cipherstash-proxy.toml` file.
55+
Run the following command from the `cipherstash-proxy` directory:
5556

5657
```bash
57-
./start.sh
58+
docker compose up
5859
```
5960

6061
## Using the Proxy

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# CipherStash Encrypt Query Language (EQL)
22

33
[![Why we built EQL](https://img.shields.io/badge/concept-Why%20EQL-8A2BE2)](https://github.com/cipherstash/encrypt-query-language/blob/main/WHY.md)
4-
[![CipherStash Proxy](https://img.shields.io/badge/guide-CipherStash%20Proxy-A48CF3)](https://github.com/cipherstash/encrypt-query-language/blob/main/PROXY.md)
54
[![Getting started](https://img.shields.io/badge/guide-Getting%20started-008000)](https://github.com/cipherstash/encrypt-query-language/blob/main/GETTINGSTARTED.md)
5+
[![CipherStash Proxy](https://img.shields.io/badge/guide-CipherStash%20Proxy-A48CF3)](https://github.com/cipherstash/encrypt-query-language/blob/main/PROXY.md)
6+
[![CipherStash Migrator](https://img.shields.io/badge/guide-CipherStash%20Migrator-A48CF3)](https://github.com/cipherstash/encrypt-query-language/blob/main/MIGRATOR.md)
67

78
Encrypt Query Language (EQL) is a set of abstractions for transmitting, storing & interacting with encrypted data and indexes in PostgreSQL.
89

cipherstash-proxy/docker-compose.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: eql
2+
services:
3+
cipherstash-proxy:
4+
container_name: eql-cipherstash-proxy
5+
ports:
6+
- 6432:6432
7+
environment:
8+
- CS_STATEMENT_HANDLER=mylittleproxy
9+
- LOG_LEVEL=debug
10+
volumes:
11+
- ./cipherstash-proxy.toml:/etc/cipherstash-proxy/cipherstash-proxy.toml
12+
image: cipherstash/cipherstash-proxy:cipherstash-proxy-v0.1.1

cipherstash-proxy/start.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)