Skip to content
This repository was archived by the owner on Mar 1, 2023. It is now read-only.

TAS Deployment Instructions #233

Merged
merged 10 commits into from
May 22, 2020
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Postfacto helps teams run great [retrospectives](https://content.pivotal.io/blog
Postfacto lets you run an agile retrospective even when your team is distributed across the world. Your retros will live update across all your devices so each participant can follow along on their device.

### Easy Onboarding
Easily [set up](https://github.com/pivotal/postfacto/tree/master/deployment#allowing-users-to-create-retros) Postfacto to work with Google OAuth so users can sign up with their Google accounts. Alternatively, you can control access to your instance with the admin dashboard.
Easily [set up](deployment/README.md#allowing-users-to-create-retros) Postfacto to work with Google OAuth so users can sign up with their Google accounts. Alternatively, you can control access to your instance with the admin dashboard.

### Run Public or Private Retros
You can create private retro boards for your team that are password protected or choose to leave them public so that anyone you give the link to can access them.
Expand All @@ -28,22 +28,22 @@ Retros are designed to help teams improve and that's hard to do without taking a

## Deployment

Postfacto is a self hosted product, this makes it easier for you to stay in control of your data. We aim to make it easy to deploy to as many locations as possible. We currently support the following:
Postfacto is a self hosted product, this makes it easier for you to stay in control of your data. We aim to make it easy to deploy to as many locations as possible.

* [Cloud Foundry](https://github.com/pivotal/postfacto/tree/master/deployment#pivotal-cloud-foundry)
* [Pivotal Web Services](https://github.com/pivotal/postfacto/tree/master/deployment#pivotal-web-services)
* [Heroku](https://github.com/pivotal/postfacto/tree/master/deployment#heroku)
First, download and extract the latest package from the [releases page](https://github.com/pivotal/postfacto/releases) before following the instructions below for your supported platform:

**Note: Download and extract the latest package from the [releases page](https://github.com/pivotal/postfacto/releases) before following the instructions above.**
* [Tanzu Application Service](deployment/README.md#tanzu-application-service)
* [Pivotal Web Services](deployment/README.md#pivotal-web-services)
* [Cloud Foundry](deployment/README.md#cloud-foundry)
* [Heroku](deployment/README.md#heroku)

If the platforms above don't work for you; you may be able to find a way to run Postfacto yourself by following the Contributing Guide.

## Contributing

See the [Contributing Guide](https://github.com/pivotal/postfacto/blob/master/CONTRIBUTING.md) for more info.
See the [Contributing Guide](CONTRIBUTING.md) for more info.

## License

Postfacto is licensed under the **GNU Affero General Public License** (often referred to as **AGPL-3.0**). The full text
of the license is available [here](https://github.com/pivotal/postfacto/blob/master/LICENSE.md). It's important to note
that this license allows you to deploy an instance of Postfacto for private, public or internal use.
of the license is available [here](LICENSE.md). It's important to note that this license allows you to deploy an instance of Postfacto for private, public or internal use.
2 changes: 1 addition & 1 deletion UPGRADES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To update the version of Ruby used in Postfacto, the following steps need to be

9. Publish the new image to Docker Hub - this needs to happen *before* the Travis build can complete

10. Update the pinned buildpacks in `deployment/{pcf,pws}/config/manifest-api.yml`, according to the latest
10. Update the pinned buildpacks in `deployment/{cf,pws,tas}/config/manifest.yml`, according to the latest
[release][2] that supports the selected version

11. Update the pinned buildpacks in `deployment/{deploy,upgrade}-heroku.sh`, according to the latest [release][3] that
Expand Down
83 changes: 58 additions & 25 deletions deployment/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
# Deployment

**Note: If you have not already done so, download and extract the latest package from the [releases page](https://github.com/pivotal/postfacto/releases)**
## Contents
* [Prerequisites](#prerequisites)
* [Tanzu Application Service](#tanzu-application-service)
* [Pivotal Web Services](#pivotal-web-services)
* [Cloud Foundry](#cloud-foundry)
* [Heroku](#heroku)
* [Configuration](#configuration)

So you're ready to set Postfacto up, choose a name for your app. We'll refer to this as `app-name` from now on.
## Prerequisites
1. Download and extract the latest package from the [releases page](https://github.com/pivotal/postfacto/releases)
2. Choose a name for your app, we'll refer to this as `app-name` from now on

## Tanzu Application Service

#### Initial deployment

1. Set yourself up with an organization and space in your TAS account to deploy Postfacto to.
1. Add a database (Postgres or Mysql) and a Redis service instance to your space from the Marketplace. Name these services `postfacto-db` and `postfacto-redis`.
1. Run the TAS deployment script from the `tas` directory:

```bash
./deploy.sh <app-name>
```

Take note of the URL that has shown up in the `routes:` section of the script output, going forward referred to as `<app-url>`.
1. Log in to the Postfacto admin dashboard (email: `[email protected]` and password: `password`) to check everything has worked at `<app-url>/admin`
1. Create a retro for yourself by clicking on 'Retros' and the 'New Retro'
1. Log in to your retro at `<app-url>/retros/your-retro-slug`
1. Share the URL and password with your team and then run a retro!

#### Upgrading a deployment

1. Presuming the steps in the Initial deployment section have been completed, run the upgrade script from the `tas` directory:
```bash
./upgrade.sh <app-name>
```

## Pivotal Web Services

### Initial deployment
#### Initial deployment

[Pivotal Web Services](https://run.pivotal.io) provides a hosted version of Pivotal's [Cloud Foundry](https://pivotal.io/platform) platform and is probably the easiest place to get Postfacto up and running.
[Pivotal Web Services](https://run.pivotal.io) provides a hosted version of VMware's [Tanzu Application Service](https://tanzu.vmware.com/application-service) platform and is probably the easiest place to get Postfacto up and running.

1. Sign up for a PWS account, install the CF CLI and set yourself up with an organization and space by following the instructions [here](https://docs.run.pivotal.io/starting/)
1. Once logged in to PWS, add a database and a Redis service instance to your space from the Marketplace. We recommend the free plans of ElephantSQL and Redis Cloud respectively for this. Name these services `postfacto-db` and `postfacto-redis`
Expand All @@ -17,81 +50,81 @@ So you're ready to set Postfacto up, choose a name for your app. We'll refer to
```bash
./deploy.sh <app-name>
```
1. Log in to the admin dashboard (email: `[email protected]` and password: `password`) to check everything has worked at `<app-name>.cfapps.io/admin`
1. Log in to the Postfacto admin dashboard (email: `[email protected]` and password: `password`) to check everything has worked at `<app-name>.cfapps.io/admin`
1. Create a retro for yourself by clicking on 'Retros' and the 'New Retro'
1. Log in to your retro at `<app-name>.cfapps.io/retros/your-retro-slug`
1. Share the URL and password with your team and then run a retro!

### Upgrading a deployment
#### Upgrading a deployment

1. Presuming the steps in the Initial deployment section have been completed, run the upgrade script from the `pws` directory:
```bash
./upgrade.sh <app-name>
```

### Migrating a deployment
#### Migrating a deployment

1. If you'd previously deployed a version of Postfacto prior to 4.0, run the migration script from the `pws` directory:
```bash
./migrate.sh <web-app-name> <api-app-name>
```
**Note** that the admin panel will move from `<api-app-name>.cfapps.io/admin` to `<web-app-name>.cfapps.io/admin` and the API app will be deleted

## Pivotal Cloud Foundry
## Cloud Foundry

### Initial deployment
#### Initial deployment

1. Set yourself up with an organization and space in your PCF to deploy your Postfacto to.
1. Take note of your PCF url, going forward referred to as `pcf-url`
1. Set yourself up with an organization and space in your CF to deploy your Postfacto to.
1. Take note of your CF url, going forward referred to as `cf-url`
1. Add a database (Postgres or Mysql) and a Redis service instance to your space from the Marketplace. Name these services `postfacto-db` and `postfacto-redis`.
1. Run the PCF deployment script from the `pcf` directory:
1. Run the CF deployment script from the `cf` directory:

```bash
./deploy.sh <app-name>
```
1. Log in to the admin dashboard (email: `[email protected]` and password: `password`) to check everything has worked at `<app-name>.<pcf-url>/admin`
1. Log in to the Postfacto admin dashboard (email: `[email protected]` and password: `password`) to check everything has worked at `<app-name>.<cf-url>/admin`
1. Create a retro for yourself by clicking on 'Retros' and the 'New Retro'
1. Log in to your retro at `<app-name>.<pcf-url>/retros/your-retro-slug`
1. Log in to your retro at `<app-name>.<cf-url>/retros/your-retro-slug`
1. Share the URL and password with your team and then run a retro!

### Upgrading a deployment
#### Upgrading a deployment

1. Presuming the steps in the Initial deployment section have been completed, run the upgrade script from the `pcf` directory:
1. Presuming the steps in the Initial deployment section have been completed, run the upgrade script from the `cf` directory:
```bash
./upgrade.sh <app-name>
```

### Migrating a deployment
#### Migrating a deployment

1. If you'd previously deployed a version of Postfacto prior to 4.0, run the migration script from the `pcf` directory:
1. If you'd previously deployed a version of Postfacto prior to 4.0, run the migration script from the `cf` directory:
```bash
./migrate.sh <web-app-name> <api-app-name>
```
**Note** that the admin panel will move from `<api-app-name>.<pcf-url>/admin` to `<web-app-name>.<pcf-url>/admin` and the API app will be deleted
**Note** that the admin panel will move from `<api-app-name>.<cf-url>/admin` to `<web-app-name>.<cf-url>/admin` and the API app will be deleted

## Heroku

### Initial deployment
#### Initial deployment

1. Install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
1. Run the Heroku deployment script from the `heroku` directory:

```bash
./deploy.sh <app-name>
```
1. Log in to the admin dashboard (email: `[email protected]` and password: `password`) to check everything has worked at `<app-name>.herokuapp.com/admin`
1. Log in to the Postfacto admin dashboard (email: `[email protected]` and password: `password`) to check everything has worked at `<app-name>.herokuapp.com/admin`
1. Create a retro for yourself by clicking on 'Retros' and the 'New Retro'
1. Log in to your retro at `<app-name>.herokuapp.com/retros/your-retro-slug`
1. Share the URL and password with your team and then run a retro!

### Upgrading a deployment
#### Upgrading a deployment

1. Presuming the steps in the Initial deployment section have been completed, run the upgrade script from the `heroku` directory:
```bash
./upgrade.sh <app-name>
```

### Migrating a deployment
#### Migrating a deployment

> ⚠️ **Warning**: the Heroku migration will attempt to migrate your data to a new database instance and delete the old one. Take a look at what the script is doing and make sure you understand the implications before running it.

Expand All @@ -107,13 +140,13 @@ So you're ready to set Postfacto up, choose a name for your app. We'll refer to

In order for users to sign-up and create their own retros using the web UI, Postfacto needs Google OAuth setup.
For deployments that do not want to setup Google OAuth, you will need to create your retros through the admin console of your server via
`<app-name>.cfapps.io/admin` or `<app-name>.<pcf-url>/admin`.
`<app-name>.cfapps.io/admin` or `<app-name>.<cf-url>/admin`.

1. Go to [Google Cloud Console](https://console.cloud.google.com) and
create a new project
1. Go to APIs & Services > Credentials > Create Credentials > OAuth client ID > Web application
1. Choose a name for your app
1. In `Authorized JavaScript Origins`, set it to the public URL of your `app-name`. For example: if deploying to PWS, your public URL will be `https://<app-name>.<pcf-url>`
1. In `Authorized JavaScript Origins`, set it to the public URL of your `app-name`. For example: if deploying to PWS, your public URL will be `https://<app-name>.cfapps.io`
1. You can leave redirect blank
1. Take note of your `client-id` that is generated
1. Add `"google_oauth_client_id": {{client-id}}` to the `config.js` for your installation.
Expand Down
55 changes: 55 additions & 0 deletions deployment/deploy-tas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
#
# 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/>.
#
set -euo pipefail

if [ $# -lt 1 ]; then
echo "usage: ./deploy.sh <app-name>"
echo "This will deploy the app to a TAS instance of your choosing"
exit 1
fi
# The directory in which this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
"$SCRIPT_DIR/mixpanel.sh" "TAS $(basename "${BASH_SOURCE[0]}")" "$@"

APP_HOST=$1
SESSION_TIME=${SESSION_TIME:-'""'}

ASSETS_DIR="$SCRIPT_DIR/../assets"
CONFIG_DIR="$SCRIPT_DIR/config"

cf target \
|| (echo 'You need to have the CF CLI installed and be logged in' \
&& exit 1)

cp "$CONFIG_DIR/config.js" "$ASSETS_DIR/client/config.js"
cf push -f "$CONFIG_DIR"/manifest.yml -p "$ASSETS_DIR" --var api-app-name=$APP_HOST --var session-time=$SESSION_TIME
cf run-task $APP_HOST '[email protected] ADMIN_PASSWORD=password rake admin:create_user'
44 changes: 44 additions & 0 deletions deployment/tas/config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
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/>.
*/
window.Retro = {
config: {
"globalNamespace": "Retro",
"title": "Postfacto",
"scripts": ["application.js"],
"stylesheets": ["application.css"],
"useRevManifest": true,
"api_base_url": "/api",
"websocket_url": "/cable",
"enable_analytics": false,
"contact": "",
"terms": "",
"privacy": ""
}
};
14 changes: 14 additions & 0 deletions deployment/tas/config/manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
applications:
- name: ((api-app-name))
instances: 2
buildpacks:
- https://github.com/cloudfoundry/ruby-buildpack.git#v1.7.40
memory: 256M
command: bundle exec rake db:migrate && bundle exec rails s -p $PORT -e $RAILS_ENV
services:
- postfacto-db
- postfacto-redis
env:
WEBSOCKET_PORT: 443
SESSION_TIME: ((session-time))
55 changes: 55 additions & 0 deletions deployment/upgrade-tas.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
#
# 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/>.
#
set -euo pipefail

if [ $# -lt 1 ]; then
echo "usage: ./upgrade.sh <app-name>"
echo "This will upgrade the app on a TAS instance of your choosing"
exit 1
fi

# The directory in which this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
"$SCRIPT_DIR/mixpanel.sh" "CF $(basename "${BASH_SOURCE[0]}")" "$@"

APP_HOST=$1
SESSION_TIME=${SESSION_TIME:-'""'}

ASSETS_DIR="$SCRIPT_DIR/../assets"
CONFIG_DIR="$SCRIPT_DIR/config"

cf target \
|| (echo 'You need to have the CF CLI installed and be logged in' \
&& exit 1)

cp "$CONFIG_DIR/config.js" "$ASSETS_DIR/client/config.js"
cf push -f "$CONFIG_DIR/manifest.yml" -p "$ASSETS_DIR" --var api-app-name=$APP_HOST --var session-time=$SESSION_TIME
Loading