Create sites from the command line


The kernel now comes with a script, emergence-create-site, with which you can create sites from the command line. It makes use of a new unix socket readable by root that the kernel exposes as an alternative for accessing its API without HTTP authentication based on /emergence/admins.htpasswd.


Without any arguments, a site will be created with a random handle if the wamerican package (or anything else providing /usr/share/dict/words) is installed.


If no dictionary is available, or a custom handle is desired:

emergence-create-site --handle=mysite

The examples above will create a site extending by default, if you want to specify a parent site:

emergence-create-site --parent-key=f6XqdJ2YIsm2oeXU

If a site with no parent really is desired:

emergence-create-site --no-parent

Without any primary hostname specified, ${HANDLE}.local will be used, to specify a primary hostname:


Additional hostnames to map to this site can be provided too:


Without a site label provided, it will be left unset. To provide a label for the site:

emergence-create-site --label="My Example Site"

Additional tools for initializing the site

The script can also take care of some post-create operations. To precache all of the standard root trees:

emergence-create-site --precache-trees

You can also specify what trees you want to precache:

emergence-create-site --precache-trees=php-config,event-handlers,site-root/sass

Or add trees to the standard set:

emergence-create-site --precache-trees+=content

In the same vein, you can trigger empty database tables being created immediately (the default set is sessions and people):

emergence-create-site --generate-tables
emergence-create-site --generate-tables=UserSession,User
emergence-create-site --generate-tables+=Slate\Courses\Course,Slate\Courses\Section

Finally, you can even get dropped into a PHP shell for the new site:

emergence-create-site --shell

This can be used to pipe additional setup code into the new site after everything else has been processed:

cat my-setup-script.php | emergence-create-site --shell