Skip to content

Commit d4506ba

Browse files
author
Ilja Bobkevic
committed
Merge pull request #20 from craiggenner/master
Docs for running behind Apache
2 parents 8d3da50 + 161fbcf commit d4506ba

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,44 @@ sudo -u forge puppet-forge-server -D -m /opt/forge/modules -x https://forgeapi.p
138138

139139
You are done. Now go install some puppet modules.
140140

141+
### Behind Apache (Passenger Support)
142+
143+
Apache virtualhost config:
144+
```
145+
<VirtualHost *:80>
146+
ServerName localhost
147+
DocumentRoot /opt/forge/public
148+
<Directory /opt/forge/public>
149+
Allow from all
150+
Options -MultiViews
151+
Require all granted
152+
</Directory>
153+
</VirtualHost>
154+
```
155+
156+
Create a `config.ru` one folder down from the Apache DocumentRoot, eg: /opt/forge/config.ru:
157+
```
158+
require 'rubygems'
159+
require 'puppet_forge_server'
160+
161+
# Set base cache directory for proxy backends
162+
cache_dir = '/opt/forge/cache' # default: File.join(Dir.tmpdir.to_s, 'puppet-forge-server', 'cache')
163+
164+
# Create backends
165+
backends = [
166+
PuppetForgeServer::Backends::Directory.new('/opt/forge/modules'),
167+
PuppetForgeServer::Backends::ProxyV3.new('https://forgeapi.puppetlabs.com', cache_dir)
168+
]
169+
170+
# Disable access logging, log errors to STDERR
171+
PuppetForgeServer::Logger.set({:server => STDERR, :access => File.open(File::NULL, "w")})
172+
173+
# Run
174+
run PuppetForgeServer::Server.new.build(backends, PuppetForgeServer::Utils::OptionParser.class_eval('@@DEFAULT_WEBUI_ROOT'))
175+
```
176+
177+
You can now connect to http://localhost and see the web interface, start using and adding modules in the same way as you would running as a Daemon.
178+
141179
## Web UI
142180

143181
Puppet forge server comes with built-in web UI looking very similar to the official puppet forge web page and providing a simple module search feature. Each view haml file corresponds to the request endpoint; for example **/** or index is formed by the index.haml located in the *views* directory and obviously combined with layout.haml that is being refered to during any request.

0 commit comments

Comments
 (0)