mlebkowski / crane
Installs: 2 942
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- cilex/console-service-provider: ~1.0
- igorw/config-service-provider: ~1.0
- justinrainbow/json-schema: ~1.3
- silex/silex: ~1.0
- symfony/config: ~2.3
- symfony/finder: ~2.0
- symfony/yaml: *
This package is auto-updated.
Last update: 2024-10-23 19:20:49 UTC
README
Bootstrap your local environment using docker containers & git
Setup
- Create your config according to the schema. You can find detailed descriptions there
- Push your schema to a git repository, for instance:
git@example.com:vendor/crane-project
Initialize a project
-
Install crane on your local machine using composer.
$ composer global require 'mlebkowski/crane:dev-master'
The binary will be put in
~/.composer/vendor/bin/crane
-
Add project configuration:
$ crane project:init git@example.com:vendor/crane-project
-
Edit the
~/.crane/config.json
to set up thetargets
/current-target
Build images
This is only required once per target. Docker images will be built from Dockerfiles.
$ crane image:build vendor/project-name --verbose
If something changes or goes wrong, you may want to use the --rebuild
flag.
Start the project
Launch all containers.
$ crane project:start vendor/project-name --verbose
Use --restart
if something is wrong or images have changed. The main image is always restarted regardless.
Bootstrap the application
You may want to bootstrap your app in some way (init the database, setup permissions, etc). Crane is application agnostic, so it does not have any build in mechanism. Id does however provide a project:command
command. It will SSH into the running container (if 22
port is exposed inside) using the identity
file as a private key.
To run a bootstrapping command on the main container, for example:
$ crane project:command vendor/project-name 'phing -verbose -f /home/main-image-name/build.xml install' --verbose
Permissions
Make sure you have agent forwarding setup for target host. All SSH commands are using the -A
flag.
Editing files
You may want to edit the application source files. To do this push to any branch at ssh://current-target/.crane/vendor-name/project-name/volumes/main-image-name
. There is a post-receive
hook there that resets the working copy to the pushed commit.
You might as well use sshfs
, but there are cache’ing and performance issues. YMMV.