Skip to content

UserNotes:justone

Nate Jones edited this page Oct 6, 2016 · 3 revisions

Access

Set up my .ssh/config:

Host alpha.cmd.io
    User justone

First run:

$ ssh alpha.cmd.io                                                                                                                                                                                                 
Usage:
  ssh <user>@cmd.io [command]

Available Commands:
  :add        Install a command
  :ls         List installed commands
  :rm         Uninstall a command

Use "[command] --help" for help about a meta command.

Connection to alpha.cmd.io closed.

Commands

:ls, :add, and :rm help works, although could use some examples. Wondering if there's a way to update a command without removing it first. What about versioning and rollback?

Added the welcome command successfully.

Wondering if I can make my pageres image work.

$ ssh alpha.cmd.io :add pageres nate/pageres
Command installed
$ ssh alpha.cmd.io :ls                                                                                                                                                                                             

Installed Commands:
  demo        
  pageres     

$ ssh alpha.cmd.io pageres:config --help
Manage command configuration

Usage:
  pageres :config [command]

Available Commands:
  set         Manage command configuration
  unset       Manage command configuration

Use "[command] --help" for help about a meta command.

$ ssh alpha.cmd.io pageres:config set STREAM=1
Config updated.
$ ssh alpha.cmd.io pageres:config
STREAM=1
$ ssh alpha.cmd.io pageres google.com 1600x900 > output.tgz
^C
$

I let the command sit there for 5 minutes before aborting it. For comparison, the command to run it from my readme finished quickly after pulling the image (1-2 minutes):

docker run -a stderr -a stdout -e STREAM=1 --rm nate/pageres google.com 1600x900 > output.tgz

NOTE: it's an old repo and can probably be tweaked to make it work.

Does the :config stuff map to environment variables? I assumed that it did, as seen above.

Attempt to get a pandoc markdown -> HTML going

New repo.

$ docker build -t nate/md2html .
Sending build context to Docker daemon 31.23 kB
Step 1 : FROM conoria/alpine-pandoc
 ---> c2d804b69928
Step 2 : MAINTAINER Nate Jones <nate@endot.org>
 ---> Using cache
 ---> 60411b49730d
Step 3 : COPY pandoc.css /pandoc.css
 ---> Using cache
 ---> 81e4700f8cd4
Step 4 : ENTRYPOINT pandoc -t html -T Pandoc Generated --smart --standalone --self-contained -
 ---> Using cache
 ---> 2ef650eeb854
Successfully built 2ef650eeb854
$ docker push !!:3
The push refers to a repository [docker.io/nate/md2html]
f0c7d84b0447: Pushed
776e12fd37cc: Mounted from conoria/alpine-pandoc
1edd71b2c82b: Mounted from conoria/alpine-pandoc
20bdf156e508: Mounted from conoria/alpine-pandoc
9007f5987db3: Mounted from conoria/alpine-pandoc
latest: digest: sha256:05426855f479517d0229f1b6de34c14784db2f0a38f6a4671e8818fe47635fd9 size: 1339
$ ssh alpha.cmd.io :add md2html nate/md2html
Command installed
$ cat > test.md
# Foo

1. One
2. Two
$ cat test.md | ssh alpha.cmd.io md2html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title>Pandoc Generated – </title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<h1 id="foo">Foo</h1>
<ol style="list-style-type: decimal">
<li>One</li>
<li>Two</li>
</ol>
</body>
</html>

It works!!

See about allowing others to run it:

$ ssh alpha.cmd.io md2html:access
Nobody else has access to this command.
$ ssh alpha.cmd.io md2html:access --help
Manage command access

Usage:
  md2html :access [command]

Available Commands:
  add         Give a GitHub user access
  public      Make command public to all
  rm          Take access for GitHub user

Use "[command] --help" for help about a meta command.

$ ssh alpha.cmd.io md2html:access public
Command is now public.

Command line for someone else to run:

echo -e "# Foo\n\n* one\n* two\n" | ssh alpha.cmd.io justone/md2html

git push

TBD

Questions/Thoughts/Ideas

  • It'd be cool to be able to create command aliases that only varied by certain config values.
  • Does the image get pulled again if it is updated? Looks like it does. 👍
  • --help is interpreted by the command and not by cmd.io. Forgot that it's ssh alpha.cmd.io <cmd>:help.
Clone this wiki locally