From f2e3ac91dd04b3025574ad5b4ab7f7318d0029d1 Mon Sep 17 00:00:00 2001 From: Bryan Hong Date: Tue, 23 May 2017 05:26:27 +0000 Subject: [PATCH] clean things up to make it easier to switch to a different release swiching to xenial should be as easy as modifying the dockerfile and updating the update_mirror.sh script --- Dockerfile | 8 +++++--- README.md | 4 ++-- assets/startup.sh | 2 ++ shell.sh | 4 +++- vars | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ecdfd4d..cba071e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,19 +12,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM ubuntu:14.04 +FROM ubuntu:trusty MAINTAINER bryan@turbojets.net ENV DEBIAN_FRONTEND noninteractive +ENV DIST=ubuntu +ENV RELEASE=trusty # Add Aptly repository RUN echo "deb http://repo.aptly.info/ squeeze main" > /etc/apt/sources.list.d/aptly.list RUN apt-key adv --keyserver keys.gnupg.net --recv-keys 9E3E53F19C7DE460 # Add Nginx repository -RUN echo "deb http://nginx.org/packages/ubuntu/ trusty nginx" > /etc/apt/sources.list.d/nginx.list -RUN echo "deb-src http://nginx.org/packages/ubuntu/ trusty nginx" >> /etc/apt/sources.list.d/nginx.list +RUN echo "deb http://nginx.org/packages/$DIST/ $RELEASE nginx" > /etc/apt/sources.list.d/nginx.list +RUN echo "deb-src http://nginx.org/packages/$DIST/ $RELEASE nginx" >> /etc/apt/sources.list.d/nginx.list RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 # Update APT repository and install packages diff --git a/README.md b/README.md index 9127434..5c32218 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,8 @@ Point a host at the mirror 1. Fetch the public PGP key from your aptly repository and add it to your trusted repositories ``` - wget http://FQDN.OF.APTLY/aptly_repo_key.pub - apt-key add aptly_repo_key.pub + wget http://FQDN.OF.APTLY/aptly_repo_signing.key + apt-key add aptly_repo_signing.key ``` 2. Backup then replace /etc/apt/sources.list diff --git a/assets/startup.sh b/assets/startup.sh index 9e25f42..46d21f0 100755 --- a/assets/startup.sh +++ b/assets/startup.sh @@ -3,6 +3,8 @@ # If the repository GPG keypair doesn't exist, create it. if [[ ! -f /opt/aptly/aptly.sec ]] || [[ ! -f /opt/aptly/aptly.pub ]]; then /opt/gpg_batch.sh + # If your system doesn't have a lot of entropy this may, take a long time + # Google how-to create "artificial" entropy if this gets stuck gpg --batch --gen-key /opt/gpg_batch fi diff --git a/shell.sh b/shell.sh index 6c4fc78..4c5bf04 100755 --- a/shell.sh +++ b/shell.sh @@ -2,11 +2,13 @@ source vars +PYTHON=`which python || which python3` + docker inspect ${APP_NAME} > /dev/null 2>&1 if [[ $? -ne 0 ]]; then echo "The ${APP_NAME} container doesn't appear to exist, exiting" fi -CONTAINER_ID=`docker inspect ${APP_NAME} | python -c 'import sys, json; print json.load(sys.stdin)[0]["Id"]'` +CONTAINER_ID=`docker inspect ${APP_NAME} | $PYTHON -c 'import sys, json; print(json.load(sys.stdin)[0]["Id"])'` docker exec -it ${CONTAINER_ID} /bin/bash diff --git a/vars b/vars index 15a673e..ef1c2a9 100644 --- a/vars +++ b/vars @@ -14,7 +14,7 @@ EMAIL_ADDRESS=user@example.com # Password used to encrypt the signing key GPG_PASSWORD=repo1234 # The directory on the Docker host to store repository data -APTLY_DATADIR=/path/to/lots/of/space +APTLY_DATADIR=/tmp/path/to/lots/of/space # FQDN of the Docker host that the aptly container will run on HOSTNAME=aptly.example.com # TCP port that aptly will be reachable on, set to something else if you already