Skip to content

Commit

Permalink
Merge pull request #1 from coi-gov-pl/feature/using-bundler-with-coi-…
Browse files Browse the repository at this point in the history
…fork

Use the latest version of puppet-forge-server gem
  • Loading branch information
cardil authored Jan 31, 2018
2 parents 2d0ba65 + 41aa9e2 commit 38770fb
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sudo: required
language: ruby
services:
- docker
script: rake
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
#
# Dockerfile
#
# Author: Matteo Cerutti <[email protected]>
#

FROM centos:7
MAINTAINER Matteo Cerutti <[email protected]>
MAINTAINER Krzysztof Suszyński <[email protected]>

ENV PUPPET_FORGE_SERVER_USER forge
ENV PUPPET_FORGE_SERVER_USER_ID 576
ENV PUPPET_FORGE_SERVER_RACK puma
ENV PUPPET_FORGE_SERVER_VERSION '-v 1.8.0'
ENV PUPPET_FORGE_SERVER_BASEDIR /srv/puppet-forge-server

RUN yum install gcc make ruby-devel rubygems -y
RUN yum install gcc make ruby-devel -y

# Needed to fetch dependencies
RUN echo ':ssl_verify_mode: 0' > ~/.gemrc
RUN gem install puppet-forge-server $PUPPET_FORGE_SERVER_VERSION
RUN gem install $PUPPET_FORGE_SERVER_RACK
RUN gem install bundler
RUN useradd --system --create-home --uid $PUPPET_FORGE_SERVER_USER_ID --home-dir $PUPPET_FORGE_SERVER_BASEDIR $PUPPET_FORGE_SERVER_USER

ADD run.sh /run.sh
COPY src/Gemfile Gemfile
COPY src/Gemfile.lock Gemfile.lock
RUN bundle --retry=3

WORKDIR $PUPPET_FORGE_SERVER_BASEDIR
USER $PUPPET_FORGE_SERVER_USER

COPY src/run.sh /run.sh

ENTRYPOINT ["/run.sh"]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ docker run -d --restart=always -p 8080:8080 \
```

## Contact
Matteo Cerutti - [email protected]
Centralny Osrodek Informatyki - [email protected]

Original version created by Matteo Cerutti - [email protected]
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

desc 'Cleans produced image'
task :clean do
sh 'docker rmi -f coigovpl/puppet-forge-server || true'
sh 'docker images -q --filter "dangling=true" | xargs docker rmi || true'
end

desc 'Builds an image'
task :build do
sh 'docker build -t coigovpl/puppet-forge-server .'
end

task :default => [:clean, :build]
7 changes: 7 additions & 0 deletions src/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source 'https://rubygems.org'

# Lock Ruby version to default centos-7
ruby '~> 2.0.0'

gem 'puppet-forge-server'
gem 'puma'
66 changes: 66 additions & 0 deletions src/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
GEM
remote: https://rubygems.org/
specs:
PriorityQueue (0.1.2)
backports (3.11.1)
deep_merge (1.2.1)
haml (4.0.7)
tilt
iconv (1.0.5)
json (1.8.6)
logger-colors (1.0.0)
lrucache (0.1.4)
PriorityQueue (~> 0.1.2)
multi_json (1.13.1)
multipart-post (2.0.0)
open4 (1.3.4)
open_uri_redirections (0.2.1)
puma (3.11.2)
puppet-forge-server (1.10.1)
deep_merge (~> 1.0)
haml (~> 4.0)
iconv (~> 1.0.4)
json (~> 1.8)
logger-colors (~> 1.0)
lrucache (~> 0.1.4)
multipart-post (~> 2.0.0)
open4 (~> 1.3)
open_uri_redirections (~> 0.1)
rack (= 1.5.5)
rack-mount (~> 0.8)
redcarpet (~> 3.3.0)
sinatra (~> 1.4)
sinatra-contrib (~> 1.4)
rack (1.5.5)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-protection (1.5.3)
rack
rack-test (0.7.0)
rack (>= 1.0, < 3)
redcarpet (3.3.4)
sinatra (1.4.8)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
sinatra-contrib (1.4.7)
backports (>= 2.0)
multi_json
rack-protection
rack-test
sinatra (~> 1.4.0)
tilt (>= 1.3, < 3)
tilt (2.0.8)

PLATFORMS
ruby

DEPENDENCIES
puma
puppet-forge-server

RUBY VERSION
ruby 2.0.0p648

BUNDLED WITH
1.16.1
6 changes: 5 additions & 1 deletion run.sh → src/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Author: Matteo Cerutti <[email protected]>
#

PUPPET_FORGE_SERVER_CACHE_SIZE=${PUPPET_FORGE_SERVER_CACHE_SIZE:-250}
PUPPET_FORGE_SERVER_CACHE_TTL=${PUPPET_FORGE_SERVER_CACHE_TTL:-1800}
PUPPET_FORGE_SERVER_PORT=${PUPPET_FORGE_SERVER_PORT:-8080}
PUPPET_FORGE_SERVER_USER=${PUPPET_FORGE_SERVER_USER:-$(whoami)}
homedir=$( getent passwd "${PUPPET_FORGE_SERVER_USER}" | cut -d: -f6 )
Expand Down Expand Up @@ -33,8 +35,10 @@ mkdir -p $PUPPET_FORGE_SERVER_CACHE_DIR
mkdir -p $PUPPET_FORGE_SERVER_LOG_DIR

echo "Starting puppet-forge-server"
exec puppet-forge-server \
exec bundle exec puppet-forge-server \
--port $PUPPET_FORGE_SERVER_PORT \
--cache-basedir $PUPPET_FORGE_SERVER_CACHE_DIR \
--ram-cache-ttl $PUPPET_FORGE_SERVER_CACHE_TTL \
--ram-cache-size $PUPPET_FORGE_SERVER_CACHE_SIZE \
--log-dir $PUPPET_FORGE_SERVER_LOG_DIR \
$PUPPET_FORGE_SERVER_OPTS

0 comments on commit 38770fb

Please sign in to comment.