Skip to content

Commit

Permalink
add heroku deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
madnight committed Sep 29, 2016
1 parent ae4594c commit 511f6f4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ sudo: required
dist: trusty

language: node_js

node_js:
- "6.1"
- '6.1'

cache:
directories:
Expand All @@ -30,3 +31,12 @@ before_install:

after_script:
- if [ $TRAVIS_BRANCH = 'master' ]; then codeclimate-test-reporter < coverage/lcov.info; fi
- wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
- heroku plugins:install heroku-container-registry
- echo "machine api.heroku.com login ${HEROKU_EMAIL} password ${HEROKU_AUTH_TOKEN}" >> ${HOME}/.netrc
- chmod 0600 ${HOME}/.netrc
- docker login --email=_ --username=_ --password=$(heroku auth:token) registry.heroku.com
- sed -i '/ENTRYPOINT/d' Dockerfile # heroku needs
- echo 'ENTRYPOINT ["",""]' >> Dockerfile # default ENTRYPOINT
- echo 'CMD ["npm","start"]' >> Dockerfile # and CMD defined
- heroku container:push web --app docker-wkhtmltopdf-aas
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ RUN node --version && \
npm --version && \
coffee --version

ENTRYPOINT [ "npm", "start" ]
ENTRYPOINT ["npm", "start"]
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
wkhtmltopdf in a docker container as a rest api web service.<br>
This image is based on the [wkhtmltopdf container](https://hub.docker.com/r/traumfewo/docker-wkhtmltopdf).

## Running the service
## Live demo

[https://docker-wkhtmltopdf-aas.herokuapp.com](https://docker-wkhtmltopdf-aas.herokuapp.com)<br>
Token: travisci


## Running the service

```sh
docker run -d -e API_TOKEN='your-secret-api-token' -p 127.0.0.1:80:5555
```bash
docker build -t pdf-service .
docker run -t -e API_TOKEN='travisci' -p 127.0.0.1:80:5555 pdf-service
```

## Using the webservice via JSON API
Expand Down Expand Up @@ -73,13 +79,6 @@ curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
echo curl_exec($ch);

```
## Philosophy
This Service follows the following architectual design principles
- horizontal scalability, be stateless
- don't reeinvent the wheel, use libraries
- start testing early, keep 100% code coverage
- keep it simple stupid (kiss), few files, few sloc, no stuff
- high performance via non blocking asynchronous code

## Features

Expand Down Expand Up @@ -124,6 +123,7 @@ nodejs_memory_heap_used_bytes 22794784
```

## Security

The API (PDF generation) is secured by an api token and can therefore be public hosted. The metrics, status and documentation are not protected by the api token (disable or protect them in case you need it). Keep in mind that you should always use https for communication with the service.

## Tests
Expand All @@ -138,7 +138,16 @@ $ npm install
$ npm test
```

## Philosophy
This Service follows the following architectual design principles
- horizontal scalability, be stateless
- don't reeinvent the wheel, use libraries
- start testing early, keep 100% code coverage
- keep it simple stupid (kiss), few files, few sloc, no stuff
- high performance via non blocking asynchronous code

## Contributing

Issues, pull requests and questions are welcome.<br>
The development of the container takes place on
[Github](https://github.com/Traum-Ferienwohnungen/docker-wkhtmltopdf-aas/issues).<br>If you have a question or a bug report to file, you can report as a github issue.
Expand Down

0 comments on commit 511f6f4

Please sign in to comment.