Skip to content

Instantly share code, notes, and snippets.

@sneal
Last active September 4, 2019 01:15
Show Gist options
  • Save sneal/567d4bcb0f47e71a3f13c44201a8531c to your computer and use it in GitHub Desktop.
Save sneal/567d4bcb0f47e71a3f13c44201a8531c to your computer and use it in GitHub Desktop.
Postfacto Running on PCF without Redis

Download and extract the Postfacto 3.0.1 release. Use the other files in this gist to replace the ones in the extracted archive before pushing.

  • pcf/deploy.sh (script just plain doesn't work for PCF)
  • pcf/assets/Gemfile (Ruby version doesn't exist in buildpack)
  • pcf/assets/api/config/cable.yml (Turn off Redis)
  • pcf/config/manifest-api.yml (Turn off Redis)

With the new replacement files in place you can follow the instructions to deploy the app, with one minor caveat. The new deploy.sh doesn't take a PCF endpoint URL. You're command should now look like:

./deploy.sh postfacto-web postfacto-api

Before running this command make sure you're logged into your PCF environment and targeting the correct org and space. You'll also need to make sure you've already created a postfacto-db MySQL service instance.

#
# Postfacto, a free, open-source and self-hosted retro tool aimed at helping
# remote teams.
#
# Copyright (C) 2016 - Present Pivotal Software, Inc.
#
# This program is free software: you can redistribute it and/or modify
#
# it under the terms of the GNU Affero General Public License as
#
# published by the Free Software Foundation, either version 3 of the
#
# License, or (at your option) any later version.
#
#
#
# This program is distributed in the hope that it will be useful,
#
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#
# GNU Affero General Public License for more details.
#
#
#
# You should have received a copy of the GNU Affero General Public License
#
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
development:
adapter: async
test:
adapter: async
production:
adapter: async
#!/bin/bash
set -e
WEB_HOST=$1
API_HOST=$2
APP_DOMAIN="$(cf domains | grep shared | head -1 | awk -F ' ' '{print $1}')"
SESSION_TIME=${SESSION_TIME:-'""'}
# The directory in which this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ASSETS_DIR="$SCRIPT_DIR"/assets
CONFIG_DIR="$SCRIPT_DIR"/config
cf push -f "$CONFIG_DIR"/manifest-api.yml -p "$ASSETS_DIR"/api --var api-app-name=$API_HOST --var web-app-name=$WEB_HOST --var pcf-url=$APP_DOMAIN --var session-time=$SESSION_TIME
cf run-task $API_HOST 'ADMIN_EMAIL=email@example.com ADMIN_PASSWORD=password rake admin:create_user'
sed \
-e "s/{{api-app-name}}/${API_HOST}/" \
-e "s/{{pcf-url}}/${APP_DOMAIN}/" \
<"$CONFIG_DIR"/config.js \
>"$ASSETS_DIR"/web/config.js
cf push -f "$CONFIG_DIR"/manifest-web.yml -p "$ASSETS_DIR"/web --var api-app-name=$API_HOST --var web-app-name=$WEB_HOST
#
# Postfacto, a free, open-source and self-hosted retro tool aimed at helping
# remote teams.
#
# Copyright (C) 2016 - Present Pivotal Software, Inc.
#
# This program is free software: you can redistribute it and/or modify
#
# it under the terms of the GNU Affero General Public License as
#
# published by the Free Software Foundation, either version 3 of the
#
# License, or (at your option) any later version.
#
#
#
# This program is distributed in the hope that it will be useful,
#
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#
# GNU Affero General Public License for more details.
#
#
#
# You should have received a copy of the GNU Affero General Public License
#
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
source 'https://rubygems.org'
ruby '2.6.3'
gem 'rails', '5.2.1.1'
gem 'activeadmin'
gem 'addressable'
gem 'bcrypt'
gem 'cf-app-utils'
gem 'devise'
gem 'friendly_id'
gem 'inherited_resources'
gem 'jbuilder'
gem 'premailer-rails'
gem 'puma'
gem 'rack-cors', require: 'rack/cors'
gem 'rest-client'
gem 'uglifier'
gem 'jwt'
group :development, :test do
gem 'dotenv-rails'
gem 'pry'
gem 'pry-byebug'
gem 'rspec-rails'
gem 'rubocop', require: false
gem 'shoulda-matchers'
gem 'webmock'
gem 'tzinfo-data'
gem 'climate_control'
gem 'action-cable-testing'
end
group :development do
gem 'sqlite3', '~> 1.3', '< 1.4'
gem 'bullet'
gem 'listen'
gem 'web-console'
end
group :production do
gem 'redis', '~> 3.3.3'
gem 'mysql2'
gem 'pg'
end
---
applications:
- name: ((api-app-name))
instances: 2
buildpack: https://github.com/cloudfoundry/ruby-buildpack
memory: 256M
command: bundle exec rake db:migrate && bundle exec rails s -p $PORT -e $RAILS_ENV
services:
- postfacto-db
env:
CLIENT_ORIGIN: https://((web-app-name)).((pcf-url))
WEBSOCKET_PORT: 443
SESSION_TIME: ((session-time))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment