All Projects → odino → rkd

odino / rkd

Licence: other
Think Dockerfile & docker-compose for rkt

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
shell
77523 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to rkd

Rkt
[Project ended] rkt is a pod-native container engine for Linux. It is composable, secure, and built on standards.
Stars: ✭ 8,870 (+68130.77%)
Mutual labels:  rkt
mulled
Mulled - Automatized Containerized Software Repository
Stars: ✭ 49 (+276.92%)
Mutual labels:  rkt
rktmachine
Menu bar macOS app for running rkt in a macOS hypervisor CoreOS VM.
Stars: ✭ 31 (+138.46%)
Mutual labels:  rkt
rkt-compose
CLI to run Docker Compose file as pod on rkt with integrated service discovery using Consul - EOL
Stars: ✭ 24 (+84.62%)
Mutual labels:  rkt

rkd

Think Dockerfile & docker-compose for rkt containers

up

rkd (aka rock-it dev) is a simple tool to build and run rkt containers locally.

$ rkd
Development environments powered by rkt containers, with ease.

Usage:
  rkd [command]

Available Commands:
  build       Build the containers
  help        Help about any command
  up          Run the container
  version     Print the version number of rkd

Flags:
  -h, --help   help for rkd

Use "rkd [command] --help" for more information about a command.

$ sudo rkd up
/root/.rkd/5290facf0b502d01ba15b7de9a1b9633.aci already built
/root/.rkd/a023872855269062eca818f2ea8c0b32.aci already built
rkt --insecure-options=image --net=host run --interactive --volume src,kind=host,source=/home/odino/projects/go/src/github.com/odino/rkd/example/src /root/.rkd/a023872855269062eca818f2ea8c0b32.aci
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
server started...

Usage

Suppose you have a NodeJS webserver running locally with docker-compose and want to convert it to rkt, without using conversion tool like docker2aci & the likes.

First, create your prod.rkd which is basically docker's Dockerfile:

set-name example.com/node-hello
dep add quay.io/coreos/alpine-sh
run -- apk add --update nodejs
copy src /src
set-working-directory /src
set-exec -- node index.js
port add www tcp 8080

and create a dev.rkd which is your new docker-compose.yml, where you can define commands dependencies you only need on your local machine:

run -- npm install -g nodemon
mount add src src
set-exec -- nodemon index.js

That's it, now run rkd up in the current folder:

sudo rkd up   
Building /root/.rkd/prod-5290facf0b502d01ba15b7de9a1b9633.aci
acbuild begin
acbuild set-name example.com/node-hello
acbuild dep add quay.io/coreos/alpine-sh
acbuild run -- apk add --update nodejs
Downloading quay.io/coreos/alpine-sh: [========================] 2.65 MB/2.65 MB
fetch http://dl-4.alpinelinux.org/alpine/v3.2/main/x86_64/APKINDEX.tar.gz
(1/4) Installing libgcc (4.9.2-r6)
(2/4) Installing libstdc++ (4.9.2-r6)
(3/4) Installing libuv (1.5.0-r0)
(4/4) Installing nodejs (0.12.10-r0)
Executing busybox-1.23.2-r0.trigger
OK: 28 MiB in 19 packages
acbuild copy src /src
acbuild set-working-directory /src
acbuild set-exec -- node index.js
acbuild port add www tcp 8080
acbuild write /root/.rkd/prod-5290facf0b502d01ba15b7de9a1b9633.aci
acbuild end
Building /root/.rkd/dev-a023872855269062eca818f2ea8c0b32.aci
acbuild begin ./prod.aci
acbuild run -- npm install -g nodemon
Downloading quay.io/coreos/alpine-sh: [========================] 2.65 MB/2.65 MB
npm WARN optional dep failed, continuing [email protected]
/usr/bin/nodemon -> /usr/lib/node_modules/nodemon/bin/nodemon.js
[email protected] /usr/lib/node_modules/nodemon
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
acbuild mount add src src
acbuild set-exec -- nodemon index.js
acbuild write /root/.rkd/dev-a023872855269062eca818f2ea8c0b32.aci
acbuild end
rkt --insecure-options=image --net=host run --interactive --volume src,kind=host,source=/home/odino/projects/go/src/github.com/odino/rkd/example/src /root/.rkd/dev-a023872855269062eca818f2ea8c0b32.aci
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
server started...

and you can head to localhost:8080.

Installation

Make sure acbuild is installed in your system.

Builds for a few systems are available in the releases.

Alternatively, you can compile it straight away:

git clone [email protected]:odino/rkd.git
cd rkd

go build -o rkd main.go
mv rkd /usr/local/bin

and then you have the rkd executable up & running.

Why this?

One of the arguments against rkt is that building and running containers seems generally more complicated than using docker, so I decided to figure out a way to replicate docker's simplicity on dev environments -- 2 files, one command, running app.

The *.rkd files are basically a list or acbuild instructions used for building 2 ACIs (prod.aci & dev.aci): rkd scans them, building the ACIs, and bases dev.aci off of what it build in prod.aci.

Troubleshooting

There's a plethora of stuff that could / needs to be done here as this is an early stage weekend project. There's very less error handling etc in the codebase and that's something I wish to work on granted that (1) I can find the time and (2) there's some interest here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].