Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task based docker #21

Open
wants to merge 18 commits into
base: task-based
Choose a base branch
from

Conversation

renoirb
Copy link

@renoirb renoirb commented May 11, 2015

Hi again @darobin

Here’s the new Docker container for Publican.

Differences:

  • No need to rsync, let’s make frontend web server use what’s in data/publish/ directly
  • Named anonymous functions in JavaScript code. It was confusing debugging without it
  • Everything is written in data/ (what publican writes), and specs-data/ (for Bikeshed) as a Docker volume so that the Docker container remains untouched and what it generates remains outside of it.
  • Bikeshed and PhantomJS should run

Known issues

  • PhantomJS times out and its unclear what’s missing

How to run

The WebPlatform specs.production.wpdn VM has everything needed to run. But if you want to run it locally, here are the steps. Also you might want to read the DOCKER.md file.

On a server that has Docker installed.

  1. Pull the new image

    docker pull webspecs/publican:latest
    
  2. Create a few directories

    mkdir -p data/{queue,gits,logs,temp}
    mkdir -p spec-data/read-only
    
  3. Make sure directory data/ is owned by uid=999(app-user) and gid=999(app-user). The group and user names doesn’t matter, its their ids that matter.

  4. Create config file in data/config.json

    • Bikeshed is in /opt/bikeshed/bikeshed.py
    • Homedir is in /srv/webplatform/specs/
  5. Run container

    docker run -it --rm -p 7002:7002 -v "$(pwd)/data":/srv/webplatform/specs/data -v "$(pwd)/spec-data":/opt/bikeshed/bikeshed/spec-data webspecs/publican:latest
    

Run it on WebPlatform infrastructure!

The container is ready in a dedicated VM.

ssh specs.production.wpdn
cd /srv/webplatform/publican-workbench/repo

Run containers like this;

  • Run from within the container

    sudo -s
    make docker-bash
    
  • Run an instance and send a hook call

    make docker-run
    

    from another terminal, issue a cURL command

      curl -H "Content-Type: application/json" -XPOST localhost:7002/hook -d '{"base_ref":"master","repository":{"name":"assets","owner":{"name":"webspecs"}}}'
    

    you should see;

      {"ok":true,"details":"Queued 1431380611165-28770219 for processing."}
    

See also

Build steps, to support either native through Makefile, and/or Dockerfile
* Should run bikeshed, phantomjs
* Removed use of rsync, it’ll sync to data/publish/ directory
* Renamed anonymous js functions to help debugging
* npmrc to contextualize node_modules, nothing global plz!
* .gitignore to ignore bikeshed clone (either within Docker or not)
* Change location of bikeshed directory *outside* of data

Includes work on:

* webspecs#19 Forgot npm install in make deps
* webplatform/ops#153

Signed-off-by: Renoir Boulanger <[email protected]>
@renoirb
Copy link
Author

renoirb commented May 11, 2015

Screenshots!

make docker-bash

You can initialize an empty workspace using publican.js init, it’ll write in data/ that should already be mounted through the Makefile.

publican-init

make docker-run

Run a container, and send a hook call

publican-run-hook

On another terminal tab, I issued;

  curl -H "Content-Type: application/json" -XPOST localhost:7002/hook -d '{"base_ref":"master","repository":{"name":"assets","owner":{"name":"webspecs"}}}'

@renoirb
Copy link
Author

renoirb commented May 12, 2015

Wrote instructions on how to run a prebuilt instance locally, like we’ll do in production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant