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
@@ -4,7 +4,6 @@ Sykle is a cli tool for calling commonly used commands in docker-compose project
4
4
5
5
#### What sykle does
6
6
7
-
8
7
- Enforces 3 docker-compose environments: `dev`, `test`, and `prod`
9
8
- Provides commands for spinning up dev, running tests, and deploying to prod
10
9
- (Assumes you are deploying to a single remote instance running docker-compose)
@@ -38,7 +37,7 @@ Sykle is a cli tool for calling commonly used commands in docker-compose project
38
37
39
38
### Configuration
40
39
41
-
Because sykle tries to make as few assumptions about your project as possible, you'll need to declaritively define how your app should run via static configuration files
40
+
Because sykle tries to make as few assumptions about your project as possible, you'll need to declaratively define how your app should run via static configuration files
42
41
43
42
#### Docker Compose
44
43
@@ -53,211 +52,27 @@ These separate configurations allow you to tweak how your projects run in those
53
52
54
53
#### .sykle.json
55
54
56
-
In addition to your `docker-compose` files, you'll need a `.sykle.json`. An example is listed below. This example can be viewed from the cli via `syk config`
57
-
58
-
*Example:*
59
-
```js
60
-
61
-
{
62
-
// specifies which version of .sykle.json is being used
63
-
"version":2,
64
-
// name of the project (used when naming docker images)
65
-
"project_name":"cool-project",
66
-
// docker compose service to use for commands by default (EX: for syk dc_run)
67
-
"default_service":"django",
68
-
// list of commands needed to run unittests (run sequentially)
69
-
"unittest": [
70
-
{
71
-
// docker compose service on which to run the command
72
-
"service":"django",
73
-
// command invoked via 'docker-compose run --rm <service>'
74
-
"command":"django-admin test"
75
-
},
76
-
{
77
-
"service":"node",
78
-
"command":"npm test"
79
-
}
80
-
],
81
-
// list of commands needed to run e2e tests (run sequentially)
82
-
"e2e": [
83
-
{
84
-
"service":"django",
85
-
"command":"behave"
86
-
}
87
-
],
88
-
// list of commands to invoke before deploying (run sequentially)
89
-
"predeploy": [
90
-
{
91
-
"service":"django",
92
-
"command":"django-admin collectstatic --no-input"
93
-
}
94
-
],
95
-
// deployment to use by default (must be listed in deployments section)
96
-
"default_deployment":"staging",
97
-
// a collection of locations where you can deploy the project to.
98
-
// each remote instance is assumed to:
99
-
// - be accessible via ssh
100
-
// - have docker installed
101
-
// - have docker-compose installed
102
-
// the machine you are deploying from is assumed to:
103
-
// - have ssh access to the remote machine
104
-
// - have the 'ssh' command
105
-
// - have the 'scp' command
106
-
// - have docker installed
107
-
// - have docker-compose installed
108
-
"deployments": {
109
-
// the location of the deployment (EX: 'syk --location=prod deploy')
110
-
"prod": {
111
-
// the ssh address of the machine the deployment should point to
// name of the command (would type 'syk dj <INPUT>' to use)
137
-
"dj": {
138
-
"service":"django",
139
-
"command":"django-admin"
140
-
}
141
-
},
142
-
// defines settings specific to plugins
143
-
"plugins": {
144
-
// name of the plugin the settings apply to
145
-
"sync_pg_data": {
146
-
"staging": {
147
-
"env_file":".env.staging",
148
-
"args": {
149
-
"HOST":"storefront.staging.sharptype.co",
150
-
"PASSWORD":"$POSTGRES_PASSWORD",
151
-
"USER":"$POSTGRES_USER",
152
-
"NAME":"$POSTGRES_DB"
153
-
}
154
-
},
155
-
"local": {
156
-
"env_file":".env",
157
-
"write":true,
158
-
"args": {
159
-
"HOST":"localhost",
160
-
"PASSWORD":"thisisbogus",
161
-
"USER":"sharptype",
162
-
"NAME":"sharptype",
163
-
"PORT":8887
164
-
}
165
-
}
166
-
}
167
-
}
168
-
}
169
-
170
-
```
55
+
In addition to your `docker-compose` files, you'll need a `.sykle.json`. An example detailing how to build a config file can be viewed from the cli via `syk config`
171
56
172
57
### Usage
173
58
174
59
Usage instructions can be viewed after installation with `syk --help`
175
60
176
61
This will not show any info for plugins. In order to view installed plugins, run `syk plugins`. To view help for a specfic plugin, run `syk <plugin_name> --help`.
--prod-build Run command with prod-build compose file
205
-
--config=<file> Specify JSON config file
206
-
--dest=<dest> Destination path [default: ~]
207
-
--env=<env_file> Env file to use [default: .env]
208
-
--service=<service> Docker service on which to run the command
209
-
--debug Prints debug information
210
-
--deployment=<name> Uses config for the given deployment
211
-
212
-
Description:
213
-
dc Runs docker-compose command
214
-
dc_run Spins up and runs a command on a docker-compose service
215
-
dc_exec Runs a command on an existing docker-compose container
216
-
build Builds docker-compose images
217
-
up Starts docker-compose
218
-
down Stops docker-compose
219
-
unittest Runs unittests on all services defined in "unittest"
220
-
e2e Runs end to end tests on all services defined in "e2e"
221
-
push Pushes images using "docker-compose.prod-build.yml"
222
-
ssh Connects to the ssh target
223
-
ssh_cp Copies file to ssh target home directory
224
-
ssh_exec Executes command on ssh target
225
-
deploy Deploys and starts latest builds on ssh target
226
-
init Creates a blank config file
227
-
plugins Lists available plugins
228
-
config Print an example config
63
+
### Legacy ./run.sh
229
64
230
-
```
65
+
Prior to sykle, the predominate pattern at typecode was to create a `./run.sh` file with a list of commands. For convenience, if a `./run.sh` file is found, sykle will try to run commands through `./run.sh` before running through sykle.
231
66
232
-
### Development
67
+
### Running Tests (for sykle)
233
68
234
-
The README for the main package and each global plugin is generated via mustache (actual README.md files are read only). This allows us to insert the docstrings (which determine command line arguments) into each README so they stay up to date automatically.
69
+
Unittests (that test sykle) can be run via `python setup.py test`
235
70
236
-
When you pull down the repo for the first time, you should run the following command:
237
-
238
-
```sh
239
-
git config core.hooksPath .githooks
240
-
```
241
-
242
-
This will make it so that after commit, if there has been a change to the docstrings, an additional "Update README" commit will be created with up to date documentation.
243
-
244
-
#### Githook Requirements
245
-
246
-
You will need to install `chevron` for the githooks to work:
247
-
248
-
```sh
249
-
pip install chevron
250
-
```
251
-
252
-
#### Running Tests
253
-
254
-
Unittests can be run via `python setup.py test`
255
-
256
-
#### Writing plugins
71
+
### Writing plugins
257
72
258
73
There are two types of plugins: **global** plugins and **local** plugins.
259
74
260
-
#####Local Plugins
75
+
#### Local Plugins
261
76
262
77
Local plugins allow you to create project specific commands. If you have a command or series of commands that you run frequently for a project that are more complicated than an alias, it might make sense to create a local plugin.
263
78
@@ -266,7 +81,7 @@ To create a local plugin:
266
81
1. Create a `.sykle-plugins/` directory in the root of your project (`.sykle-plugins/` should be in same directory as `.sykle.json`)
267
82
2. Add an `__init__.py` file to `.sykle-plugins/`
268
83
3. Add a python file for your plugin to `.sykle-plugins/` (EX: `.sykle-plugins/my_plugin.py`)
269
-
4. Define your plugin like in the exapmle below:
84
+
4. Define your plugin like in the example below:
270
85
271
86
Example
272
87
```py
@@ -302,21 +117,19 @@ Note that `syk` is present in the docopt usage definition before the plugin comm
302
117
303
118
If you defined your plugin correctly, you should be able to see listed when calling `syk plugins`
304
119
305
-
#####Global Plugins
120
+
#### Global Plugins
306
121
307
122
Global plugins are the same as local plugins, but they are added to the `plugins` folder of this repo and are available to anyone who installs sykle.
308
123
309
-
Any `README.mustache` defined in a plugin folder will have a usage variable provided to it, and will result in a `README.md` being created when code is commited
310
-
311
124
### Roadmap
312
125
313
126
-[x] Move to separate repo
314
127
-[x] Allow user to specify `test` commands
315
128
-[x] Add plugins
316
-
-[x] REAMDE.md generation on ~push to repo~ commit
317
129
-[x] Add `init` command to create `.sykle.json`
318
-
-[ ] Fallback to `./run.sh` if it exists and `.sykle.json` does not
319
130
-[x]~Scripts section in `.sykle.json`~ Local plugins
131
+
-~REAMDE.md generation on commit~ (unecessarily complex)
132
+
-[x] Fallback to `./run.sh` if it exists and `.sykle.json` does not
320
133
-[ ] User aliases/way to share aliases
321
134
-[ ] Terraform support
322
135
-[ ] Revisit whether `docker-compose` files can/should be shared
0 commit comments