├── Dockerfile ├── LICENSE ├── README.md ├── nginx-proxy.conf └── supervisord.conf /Dockerfile: -------------------------------------------------------------------------------- 1 | # I'd like to use alpine, but for some reason, DynamoDB Local seems to hang 2 | # in all the alpine java images. 3 | FROM openjdk:8-jre 4 | 5 | MAINTAINER Zach Wily 6 | 7 | # We need java and node in this image, so we'll start with java (cause it's 8 | # more hairy), and then dump in the node Dockerfile below. It'd be nice if there 9 | # was a more elegant way to compose at the image level, but I suspect the 10 | # response here would be "use two containers". 11 | 12 | ################################################################################ 13 | ## START COPY FROM https://github.com/nodejs/docker-node 14 | ################################################################################ 15 | ## 16 | ## Released under MIT License 17 | ## Copyright (c) 2015 Joyent, Inc. 18 | ## Copyright (c) 2015 Node.js contributors 19 | ## 20 | 21 | # gpg keys listed at https://github.com/nodejs/node 22 | RUN set -ex \ 23 | && for key in \ 24 | 9554F04D7259F04124DE6B476D5A82AC7E37093B \ 25 | 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ 26 | 0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \ 27 | FD3A5288F042B6850C66B31F09FE44734EB7990E \ 28 | 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ 29 | DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ 30 | B9AE9905FFD7803F25714661B63B535A4C206CA9 \ 31 | C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ 32 | ; do \ 33 | gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ 34 | done 35 | 36 | ENV NPM_CONFIG_LOGLEVEL info 37 | ENV NODE_VERSION 6.4.0 38 | 39 | RUN curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \ 40 | && curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ 41 | && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ 42 | && grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ 43 | && tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \ 44 | && rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt 45 | 46 | ################################################################################ 47 | ## END COPY 48 | ################################################################################ 49 | 50 | RUN npm install -g dynamodb-admin 51 | 52 | RUN cd /usr/lib && \ 53 | curl -L https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz | tar xz 54 | RUN mkdir -p /var/lib/dynamodb 55 | VOLUME /var/lib/dynamodb 56 | 57 | RUN apt-get update && \ 58 | apt-get install -y supervisor nginx && \ 59 | apt-get clean && \ 60 | rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* 61 | 62 | COPY nginx-proxy.conf /etc/nginx-proxy.conf 63 | COPY supervisord.conf /etc/supervisord.conf 64 | RUN mkdir -p /var/log/supervisord 65 | 66 | # Configuration for dynamo-admin to know where to hit dynamo. 67 | ENV DYNAMO_ENDPOINT http://localhost:8002/ 68 | 69 | # For dinghy users. 70 | ENV VIRTUAL_HOST dynamo.docker 71 | ENV VIRTUAL_PORT 8000 72 | 73 | # Main proxy on 8000, dynamo-admin on 8001, dynamodb on 8002 74 | EXPOSE 8000 8001 8002 75 | 76 | CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Instructure, Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dynamo-local-admin 2 | 3 | This project builds a Docker image with [DynamoDB Local](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) and [dynamodb-admin](https://github.com/aaronshaf/dynamodb-admin) installed and hooked up. 4 | 5 | ## Usage 6 | 7 | ``` 8 | docker pull instructure/dynamo-local-admin 9 | docker run -p 8000:8000 -it --rm instructure/dynamo-local-admin 10 | ``` 11 | 12 | Now open http://localhost:8000/ in your browser, and you'll see the admin UI. You can also hit port 8000 with Dynamo API requests: 13 | 14 | ``` 15 | AWS_ACCESS_KEY_ID=key AWS_SECRET_ACCESS_KEY=secret aws --region us-east-1 dynamodb --endpoint http://localhost:8000/ list-tables 16 | ``` 17 | 18 | A proxy is included which differentiates between Dynamo requests and web requests, and proxies to the appropriate server. 19 | 20 | ## Why? 21 | 22 | It's just very convenient if you do a lot of Dynamo development. 23 | 24 | ## Dinghy Users 25 | 26 | If you're using Dinghy and its automatic proxy, `VIRTUAL_HOST` and `VIRTUAL_PORT` are already set, so you don't have to specify any ports in the `docker run` and can just open http://dynamo.docker/ in your browser. 27 | -------------------------------------------------------------------------------- /nginx-proxy.conf: -------------------------------------------------------------------------------- 1 | daemon off; 2 | pid /tmp/nginx.pid; 3 | 4 | events { 5 | worker_connections 1024; 6 | } 7 | 8 | http { 9 | default_type application/octet-stream; 10 | sendfile on; 11 | 12 | error_log /var/log/nginx/error.log debug; 13 | 14 | upstream dynamodb { 15 | server 127.0.0.1:8002; 16 | } 17 | 18 | upstream admin { 19 | server 127.0.0.1:8001; 20 | } 21 | 22 | map $http_x_amz_target $pool { 23 | default "admin"; 24 | '~*dynamo' "dynamodb"; 25 | } 26 | 27 | server { 28 | listen 8000; 29 | server_name dynamo.docker; 30 | location / { 31 | proxy_pass http://$pool; 32 | 33 | proxy_set_header X-Real-IP $remote_addr; 34 | proxy_redirect off; 35 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 36 | proxy_set_header Host $http_host; 37 | proxy_redirect off; 38 | proxy_set_header X-Forwarded-Proto $scheme; 39 | proxy_set_header X-NginX-Proxy true; 40 | proxy_connect_timeout 60; 41 | proxy_send_timeout 60; 42 | proxy_read_timeout 60; 43 | send_timeout 60; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | logfile=/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log) 3 | nodaemon=true 4 | childlogdir=/var/log/supervisord 5 | 6 | [program:dynamodb] 7 | command=/usr/bin/java -Djava.library.path=/usr/lib/DynamoDBLocal_lib 8 | -jar /usr/lib/DynamoDBLocal.jar 9 | -port 8002 10 | -sharedDb 11 | -dbPath /var/lib/dynamodb 12 | 13 | [program:dynamo-admin] 14 | command=/usr/local/bin/dynamodb-admin 15 | 16 | [program:nginx] 17 | command=/usr/sbin/nginx -c /etc/nginx-proxy.conf 18 | --------------------------------------------------------------------------------