Known allows you to install Known via the command line, this can be handy for scripted installs, using non-MySQL database backends, or when installing over a terminal connection to a remote server.

The Basics

Go in to /warmup/CLI, and you’ll see CLIInstaller.

To install a brand new Known using an interactive install simply run

./CLIInstaller install

The Manifest

A manifest is used to pass configuration options to the CLI installer so that you won’t be prompted for them. This is useful for scripting installs.

First, generate a manifest template:

./CLIInstaller generate-manifest /path/to/manifest

Next, edit that file and fill in the appropriate option.

Now, you are able to pass these options to the installer:

./CLIInstaller install config.ini /path/to/manifest

You’ll also notice I’m specifying the config.ini ini file to write to, you can write this config to other files as necessary, which is handy if you’re using per-domain configuration.

Other options

The CLI installer has a few other options that might be useful:

Checking requirements

If you just want to check that your server has the necessary requirements to run Known, you can execute:

./CLIInstaller.php check-requirements

Generate config from manifest

If you want to generate a config file, but without going through the full install (useful if you want to generate a new domain config in a script), you can use the following command to do so

./CLIInstaller.php makeconfig /path/to/manifest 

This will output the new config to stdOut. You can save it to an ini file as appropriate.

A little while ago I introduced you to some command line tools for talking to your Known site.

So, using this, I put together a very quick hack that lets you tweet, via your known site, from the Unix command line.

Because, that’s how I roll.

In .bashrc I added the following:

alias tweet='status.sh https://mysite.com USERNAME APIKEY twitter::TWITTERUSER'

Assuming status.sh is on your path, when you type tweet it’ll let you write a single line of text which will be sent to your Known site and syndicated elsewhere.

Note, due to this bug, you’ll need to be running the latest version of Known for this to work!

I needed some tools for talking to the Known API from the command line in order to play around with a few ideas I’ve been having.

So, I put together a few BASH shell scripts.

Installation

  • Install the prerequisites: curl php_cli python openssl base64
  • Check out the repository and add it to your system path.

Note, due to this bug, you’ll need to be running the latest version of Known if you want to use the syndication functionality.

Talking to Known

The first thing you’ll need (other than a Known account of course) is to get your API key, you can find this in your settings page under “Tools and Apps”.

You can then use those as parameters to known.sh. For example, to make a status update you’d type:

echo "body=my+data" | known.sh https://mysite.com/status/edit *username* *apikey*

Of course, you might want to use one of the wrapper scripts like status.sh, which also supports syndication e.g:

echo "my tweet" | status.sh https://mysite.com *username* *apikey* twitter::username

If successful, the scripts will output a JSON representation of what the API says.

Have fun!

» Visit the project on Github...