Self-hosted, pre-alpha auto-deployment service for Github, built at Tedra.
cabbage
is a is a web service providing a JSON REST API, built with Koa and ioredis, using Redis as a data store.
At it's core, cabbage
has two discrete, manually-built models, in the form of ES6 classes, which handle all data mutation. They abstract calls to the data store and provide high-level methods.
Server
(lib/Server.js)
String
nameString
addressNumber
portString
usernameString
passwordNumber
id
Project
(lib/Project.js)
String
nameString
repoArray[Number]
serversNumber
id
cabbage
implements a JSON REST interface, for a graphical web interface see cabbage-ui.
- Create a
Server
curl -X POST http://cabbage/server/create
with the body
{
"name": "Digital Ocean 1",
"address": "127.0.0.1",
"port": 22,
"username": "www",
"password": "********"
}
returns
"id": 1
}
- Create a
Project
curl -X POST http://cabbage/server/create
with the body
{
"name": "My Website",
"repo": "montyanderson/website",
"servers": [ 1 ],
"directory": "/var/www/website"
}
which returns
"id": 1
}
- Add a webhook to your repository
-
node
(andnpm
) >= 8 -
redis
>= 3 -
ssh
-
scp
-
sshpass
-
Install
ssh
,scp
, andsshpass
$ sudo apt-get install openssh-server sshpass
- Install
node
(usingnvm
)
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
$ su $USER
$ nvm install latest
- Install
redis
as per instructions.
Run the script to create a service.
$ sudo ./utils/install.server.sh
- Clone the
cabbage
repository
$ git clone https://github.com/montyanderson/cabbage
- Install dependencies
$ cd cabbage
$ npm install
- Generate a random 'push secret' for use with webhooks
$ cat /dev/urandom | head -c 32 | base64 > .push_secret
- Generate a user account for viewing/creating/changing projects and servers
$ cat > .auth.json << }
{
"name": "monty",
"pass": "a"
}
- Start the node server
$ node index