Skip to content

Instantly share code, notes, and snippets.

@pommi
pommi / rsnapshot_plug_rm_btrfs
Created August 31, 2012 19:19
a small shell script that can be used within rsnapshot as cmd_rm. It provides snapshots generated with btrfs instead of hard-links
#!/bin/sh
# Arg 1: -rf
# Arg 2: /testbtrfs/backups/hourly.4/
# echo 1: $1 2: $@
# Try to delete the given path with btrfs subvolume delete first
# Check if inode number == 256 (all subvolumes have inode number 256)
if [ "$1" = "-rf" -a "$3" = "" -a $(stat --printf='%i' $2) -eq 256 ]; then
@pommi
pommi / mendix-in-docker1.sh
Last active December 31, 2015 06:09
Run a Mendix App in a Docker container in seconds
root@host:~# docker run -d mendix/mendix
root@host:~# curl -XPOST -F model=@project.mda http://172.17.0.5:5000/upload/
File uploaded.
root@host:~# curl -XPOST http://172.17.0.5:5000/unpack/
Runtime downloaded and Model unpacked.
root@host:~# curl -XPOST -d "DatabaseHost=172.17.0.4:5432" -d "DatabaseUserName=docker" -d "DatabasePassword=docker" -d "DatabaseName=docker" http://172.17.0.5:5000/config/
Config set.
root@host:~# curl -XPOST http://172.17.0.5:5000/start/
App started. (Database updated)
@pommi
pommi / mendix-in-docker2.sh
Last active December 31, 2015 06:09
A Debian GNU/Linux Wheezy image
debootstrap wheezy wheezy http://cdn.debian.net/debian
tar -C wheezy -c . | docker import - mendix/wheezy
@pommi
pommi / mendix-in-docker3.sh
Last active December 31, 2015 06:09
Let's show the image we've just created
root@host:~# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mendix/wheezy latest 1bee0c7b9ece 6 seconds ago 218.6 MB
root@host:~#
@pommi
pommi / mendix-in-docker4.sh
Last active December 31, 2015 06:09
To create the Mendix container run
docker build -t mendix/mendix .
@pommi
pommi / mendix-in-docker5.sh
Last active December 31, 2015 06:09
Let's show it
root@host:~#
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
mendix/mendix latest c39ee75463d6 10 seconds ago 589.6 MB
mendix/wheezy latest 1bee0c7b9ece 3 minutes ago 218.6 MB
root@host:~#
@pommi
pommi / mendix-in-docker6
Created December 13, 2013 15:32
m2ee API limited set of actions
GET /about/ # about m2ee-api
GET /status/ # app status
GET /config/ # show configuration
POST /config/ # set configuration
POST /upload/ # upload a new MDA
POST /unpack/ # unpack the uploaded MDA
POST /start/ # start the app
POST /stop/ # stop the running app
POST /terminate/ # terminate the running app
POST /kill/ # kill the running app
@pommi
pommi / mendix-in-docker7.sh
Last active December 31, 2015 06:09
Pull the container and start it
root@host:~# docker pull mendix/mendix
Pulling repository mendix/mendix
c39ee75463d6: Download complete
eaea3e9499e8: Download complete
...
855acec628ec: Download complete
root@host:~# docker run -d mendix/mendix
bd7964940dfc61449da79cddd1c0e8845d61f6ec1092b466e8e2e582726a5eea
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bd7964940dfc mendix/mendix:latest /bin/su mendix -c /u 19 seconds ago Up 18 seconds 5000/tcp, 7000/tcp tender_hawkings
@pommi
pommi / mendix-in-docker8.sh
Created December 13, 2013 15:35
m2ee-api: ask for it's status or show it's configuration
root@host:~# curl -XGET http://172.17.0.5:5000/status/
The application process is not running.
root@host:~# curl -XGET http://172.17.0.5:5000/config/
{
"DatabaseHost": "127.0.0.1:5432",
"DTAPMode": "P",
"MicroflowConstants": {},
"BasePath": "/home/mendix",
"DatabaseUserName": "mendix",
"DatabasePassword": "mendix",
@pommi
pommi / mendix-in-docker9.sh
Created December 13, 2013 15:38
Pull a PostgreSQL container from the Docker Index and start it
root@host:~# docker pull zaiste/postgresql
Pulling repository zaiste/postgresql
0e66fd3d6a6f: Download complete
27cf78414709: Download complete
...
046559147c70: Download complete
root@host:~# docker run -d zaiste/postgresql
9ba56a7c4bb132ef0080795294a077adca46eaca5738b192d2ead90c16ac2df2
root@host:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES