Skip to content

Instantly share code, notes, and snippets.

@joey-coleman
Last active November 1, 2016 19:27
Show Gist options
  • Save joey-coleman/10016371 to your computer and use it in GitHub Desktop.
Save joey-coleman/10016371 to your computer and use it in GitHub Desktop.
Webapps with OS X Server 3.1

Creating a apache-proxy webapp on OS X using Server.app. Just enable the webapp on the appropriate domains; the path etc is configured in the webapp plist.

The examples below come from the config I used to get jenkins running on the Overture build server.

Frankly, I think the mechanism used has promise, but is very poorly documented. So it goes with much of Apple's Server.app stuff, though. Apple's "Advanced Topics" page at http://www.apple.com/support/osxserver/advancedtopics/ is not a bad place to find a bit of help, though.

  • One for the webapp description

    • Lives in /Library/Server/Web/Config/apache2/webapps/
    • Should be auto-detected by Server.app? Doesn't seem to be for me, no idea why.
    • The magic invocation webappctl restart <name> <vhost> appears to force a reload.
  • One for launchd to keep the service running in the background

    • Lives in /Library/LaunchDaemons
    • Load with launchctl load /Library/LaunchDaemons/xxx.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ca.sheepspace.jwc.node</string>
<key>RunAtLoad</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>UserName</key>
<string>jwc</string>
<key>WorkingDirectory</key>
<string>/Users/jwc/Sites/ghost-test/</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/npm</string>
<string>start</string>
<string>/Users/jwc/Sites/ghost-test/</string>
</array>
<key>StandardOutPath</key>
<string>/Users/jwc/Sites/jwc.sheepspace.ca.log</string>
<key>StandardErrorPath</key>
<string>/Users/jwc/Sites/jwc.sheepspace.ca.err.log</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- See man pages for webapp.plist(8) and webappctl(8) for information about this example webapp.plist -->
<plist version="1.0">
<dict>
<key>name</key>
<string>ca.sheepspace.jwc.ghost</string>
<key>displayName</key>
<string>Ghost Blog engine for jwc.sheepspace.ca</string>
<key>includeFiles</key>
<array>
<string>/Library/Server/Web/Config/apache2/httpd_ca.sheepspace.jwc.ghost.conf</string>
</array>
<!-- <key>launchKeys</key> -->
<!-- <array> -->
<!-- <string>ca.sheepspace.jwc.node</string> -->
<!-- </array> -->
<key>sslPolicy</key>
<integer>0</integer>
</dict>
</plist>
ProxyPass / balancer://balancer-group-webapp-ca.sheepspace.jwc.ghost--/
ProxyPassReverse / balancer://balancer-group-webapp-ca.sheepspace.jwc.ghost--/
BalancerMember balancer://balancer-group-webapp-ca.sheepspace.jwc.ghost--/ http://localhost:2368
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>au.eng.jenkins</string>
<key>EnvironmentVariables</key>
<dict>
<key>JENKINS_HOME</key>
<string>/Volumes/BuildserverData/jenkins</string>
<key>TMPDIR</key>
<string>/Volumes/BuildserverData/tmp</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
<string>-Djava.io.tmpdir=/Volumes/BuildserverData/tmp</string>
<string>-jar</string>
<string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
<string>--httpListenAddress=127.0.0.1</string>
<string>--prefix=/jenkins</string>
</array>
<key>UserName</key>
<string>jenkins</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Volumes/BuildserverData/tmp/jenkins-stdout.log</string>
<key>StandardErrorPath</key>
<string>/Volumes/BuildserverData/tmp/jenkins-stderr.log</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- See man pages for webapp.plist(8) and webappctl(8) for information about this example webapp.plist -->
<plist version="1.0">
<dict>
<key>name</key>
<string>au.eng.webapp.jenkins</string>
<key>displayName</key>
<string>Jenkins CI Server</string>
<key>proxies</key>
<dict>
<key>/jenkins</key>
<dict>
<key>keysAndValues</key>
<string></string>
<key>path</key>
<string>/jenkins</string>
<key>urls</key>
<array>
<string>http://localhost:8080/jenkins</string>
</array>
</dict>
</dict>
<key>installationIndicatorFilePath</key>
<string>/usr/local/opt/jenkins/libexec/jenkins.war</string>
<key>sslPolicy</key>
<integer>0</integer>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment