You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+69-10Lines changed: 69 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,45 +7,104 @@ Allows you to spin up versioned Appwrite deployments for easy testing via CLI of
7
7
```sh
8
8
pip install appwrite-lab
9
9
```
10
-
## Appwrite Lab features (in progress)
10
+
## Appwrite Lab features
11
11
-[x] Spin up ephemeral Appwrite instances with Docker/Podman
12
12
-[x] Automatically grab API keys (for programmatic access)
13
-
-[x] Environment syncing
13
+
-[x] Environment syncing (with `appwrite.json`)
14
14
-[x] Clean teardowns
15
+
-[x] Test suite
15
16
16
-
## Appwrite Lab in progress features
17
-
-[ ] Test suite
17
+
## Appwrite Lab (in progress)
18
18
-[ ] Appwrite data population
19
19
20
20
## CLI Usage
21
21
### Help with appwrite-lab CLI
22
22
```sh
23
23
appwrite-lab --help
24
24
```
25
+
or
26
+
```sh
27
+
awlab --help
28
+
```
29
+
30
+
### To get started spinning up a lab instance, use:
25
31
26
-
To get started spinning up a lab instance, use:
32
+
```sh
33
+
awlab new lab test --version 1.7.4
34
+
```
35
+
#### Example of additional args:
36
+
Additional arguments can be found here.
37
+
```sh
38
+
awlab new lab --help
39
+
```
27
40
28
41
```sh
29
-
appwrite-lab new lab test-lab --version 1.7.4
42
+
awlab new lab test --version 1.7.4 --port 8005 --email test@example.com --password xxxxxxx12
30
43
```
31
44
32
-
To teardown,
45
+
### To teardown
33
46
34
47
```sh
35
-
appwrite-lab stop test-lab
48
+
awlab stop test
49
+
```
50
+
### Listing Appwrite Labs
51
+
```sh
52
+
awlab list labs
36
53
```
37
54
38
55
### Sync an Appwrite lab from your prod lab schema
39
56
Run in the same folder where your `appwrite.json` is located to sync `all` resources:
40
57
```sh
41
-
appwrite-lab sync test-lab
58
+
awlab sync test
42
59
```
43
60
or sync a specific resource:
44
61
45
62
```sh
46
-
appwrite-lab sync test-lab --resource functions
63
+
awlab sync test --resource functions
47
64
```
48
65
66
+
## Python usage
67
+
68
+
### Creating a lab
69
+
```py
70
+
from appwrite_lab import Labs
71
+
from appwrite_lab.models import AppwriteLabCreation
72
+
73
+
labs = Labs()
74
+
lab_res = labs.new(
75
+
name="test",
76
+
version="1.7.4",
77
+
auth=AppwriteLabCreation(
78
+
admin_email="test@example.com",
79
+
admin_password="xxxxxxx12",
80
+
project_id=None, # for auto gen
81
+
project_name=None, # for auto gen
82
+
)
83
+
port=8005
84
+
)
85
+
86
+
assert lab_res.data
87
+
```
88
+
89
+
#### Random generation that's compliant
90
+
```py
91
+
from appwrite_lab.models import AppwriteLabCreation
92
+
93
+
auth = AppwriteLabCreation.generate()
94
+
```
95
+
96
+
### Syncing a lab
97
+
```py
98
+
from appwrite_lab import Labs
99
+
from appwrite_lab.automations.models import Expiration
100
+
101
+
Labs().sync_with_appwrite_config(
102
+
name="test",
103
+
appwrite_json="appwrite.json", # if not directly in folder
104
+
sync_type="all",
105
+
expiration=Expiration.THIRTY_DAYS,
106
+
)
107
+
```
49
108
## Known Troubleshooting
50
109
### Podman support and Selinux
51
110
Since I am mimicking the `compose` file that Appwrite provides, it was not designed to work rootless, but I have adjusted to work also on Fedora. You will need to turn `selinux` off for now to use.
0 commit comments