Skip to content

Commit c7182c7

Browse files
committed
feat: migrator docs
1 parent 5ca6b1e commit c7182c7

File tree

2 files changed

+76
-2
lines changed

2 files changed

+76
-2
lines changed

MIGRATOR.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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. Multiple key-value pairs can be specified, and the tool will perform a migration for each specified column.
18+
19+
### Running the migrator
20+
21+
You will need to SSH into the CipherStash Proxy Docker container to run the migrator.
22+
23+
```bash
24+
docker exec -it eql-cipherstash-proxy bash
25+
```
26+
27+
Once inside the container, you have access to the migrator tool.
28+
29+
```bash
30+
cipherstash-migrator --version
31+
```
32+
33+
#### Flags
34+
35+
| Flag | Description | Required |
36+
| --- | --- | --- |
37+
| `--columns` | Specifies the plaintext columns and their corresponding encrypted columns. The format is `plaintext_column=encrypted_column`. | Yes |
38+
| `--table` | Specifies the table where the data will be migrated. | Yes |
39+
| `--database-name` | Specifies the database name. | Yes |
40+
| `--username` | Specifies the database username. | Yes |
41+
| `--password` | Specifies the database password. | Yes |
42+
43+
#### Supported data types
44+
45+
- Text
46+
- JSONB
47+
- Integer
48+
- Boolean
49+
- Float
50+
- Date
51+
52+
### Example
53+
54+
The following is an example of how to run the migrator with a single column:
55+
56+
```bash
57+
cipherstash-migrator --columns example_column=example_column_encrypted --table examples --database-name postgres --username postgres --password postgres
58+
```
59+
60+
If you require additional data types, please [raise an issue](https://github.com/cipherstash/encrypt-query-language/issues)
61+
62+
### Running migrations with multiple columns
63+
64+
To run a migration on multiple columns at once, specify multiple key-value pairs in the `--columns` option:
65+
66+
```bash
67+
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
68+
```
69+
70+
## Notes
71+
72+
- Ensure that the corresponding encrypted columns already exist in the table before running the migration.
73+
- 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

0 commit comments

Comments
 (0)