Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @themightychris
78 changes: 78 additions & 0 deletions docs/operations/accessing-prod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Accessing Production

The production instance of `codeforphilly.org` is deployed via the [`cfp-live-cluster`](https://github.com/CodeForPhilly/cfp-live-cluster) via the release configured at [`cfp-live-cluster/code-for-philly`](https://github.com/CodeForPhilly/cfp-live-cluster/tree/main/code-for-philly)

## Deployment process

1. Merge one or more PRs into `develop` under the [`codeforphilly.org`](https://github.com/CodeForPhilly/codeforphilly.org) repository
- A release PR will automatically be generated with a suggested version number in the title, a template for release notes in the description, and a copyable draft changelog in the first comment
- The first comment with the draft changelog will be automatically updated as additional commits/PRs are added to `develop`
- The title or description will not be automatically changed after the PR is initially created, so they are safe to manually edit
2. Copy bullet points from the generated changelog comment and use them to fill out the release notes template in the description, deleting any unused section. The suggested version number in the title will default to incrementing the patch number, and may be manually edited to switch to incrementing the minor number
3. Merge the release PR when ready
- A GitHub release+tag will automatically get created
- The new release/tag will kick off automatically building and tagging a new Docker container image
4. After the new image is built, edit [`code-for-philly/release-values.yaml`](https://github.com/CodeForPhilly/cfp-live-cluster/blob/main/code-for-philly/release-values.yaml) in the `cfp-live-cluster` repository to update the image tag to the new version either as a direct commit to the `main` branch or a PR (see [this example commit](https://github.com/CodeForPhilly/cfp-live-cluster/commit/67ce5a73b94ebd6e12a5aff34f2f7b02a9fd42f2))
5. Ask the Code for Philly ops team to merge your version bump PR if needed
- A deployment PR will automatically be generated after that, previewing the pending changes to the cluster
6. Ask the Code for Philly ops team to merge the pending deployment
- The cluster will automatically be updated and the new image deployed

## Accessing instance

The production database runs within the Kubernetes cluster, and is snapshotted every hour by `restic` to a Linode cloud storage bucket.

The database, as well as application logs and shell, can be accessed via a `KUBECONFIG` file with access to the needed resources. Ask Code for Philly ops to provide one if needed.

### Using admin service account

1. Activate the provided `KUBECONFIG` in your current terminal session:

```bash
export KUBECONFIG=~/.kube/code-for-philly-admin.yaml
```

2. Get the name of the currently running pods and store them in shell variables:

```bash
POD_NAME=$(kubectl -n code-for-philly get pod -l app.kubernetes.io/name=code-for-philly -o jsonpath='{.items[0].metadata.name}')
```

### Open interactive backend shell

```bash
kubectl -n code-for-philly exec -it $POD_NAME -- bash
```

### Open interactive database shell

```bash
kubectl -n code-for-philly exec -it $POD_NAME -- hab pkg exec codeforphilly/site-composite mysql
```

### Run an emergence-console command

```bash
kubectl -n code-for-philly exec -it $POD_NAME -- hab pkg exec codeforphilly/site-composite emergence-console-run migrations:execute
```

### Run an SQL query

```bash
echo 'SELECT * FROM people' | kubectl -n code-for-philly exec -i $POD_NAME -- hab pkg exec codeforphilly/site-composite mysql
```

### Dump the entire database

```bash
kubectl -n code-for-philly exec -it $POD_NAME -- hab pkg exec codeforphilly/site-composite mysqldump 'codeforphilly' > /tmp/codeforphilly.sql
```

### Forward MySQL port

```bash
kubectl -n code-for-philly port-forward pods/$POD_NAME 3306:3306
```

!!! tip "Database logins"
Default database credentials can be found in `helm-chart/values.yaml` (typically `admin` / `admin`)
4 changes: 2 additions & 2 deletions html-templates/home.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
{projectTile name="PHLASK" portfolioModal="#portfolioModal1" short="Access to Public Water" image="phlask.png" }
{projectTile name="PAWS" portfolioModal="#portfolioModal2" short="Homes for all Pets" image="paws.png" }
{projectTile name="PLSE" portfolioModal="#portfolioModal4" short="Legal Support and Expungement" image="plse.png" }
{projectTile name="Only Plant Natives PA" portfolioModal="#portfolioModal5" short="Propagate PA Wildflowers" image="flowers.jpg" }
{projectTile name="Choose Native Plants PA" portfolioModal="#portfolioModal5" short="Propagate PA Wildflowers" image="flowers.jpg" }
{projectTile name="CfP Website Design" portfolioModal="#portfolioModal6" short="Homepage" image="code-for-philly.png" }


Expand Down Expand Up @@ -522,7 +522,7 @@ On July 1st, they will encounter a problem that will severely hinder their abili
This project involves 'scraping' criminal history record information from a publicly-available database and storing it on secure servers only available to PLSE staff for the purpose of expungements. The data will need to be properly organized in order to easily pull up an individual's full record. This project is the only way they could continue providing quick, life-changing services to Philadelphia communities."
project="prevention_point_unified_reporting_system" site="https://www.plsephilly.org/" github="https://github.com/CodeForPhilly/prevention-point" slack="preventionpoint" }

{projectModal name="Only Plant Natives PA" modal="portfolioModal5" image="flowers.jpg"
{projectModal name="Choose Native Plants PA" modal="portfolioModal5" image="flowers.jpg"
description="Native plants are really <a href='https://www.audubon.org/content/why-native-plants-matter'>important...</a><br><br>
But it is a bit overwhelming to select plants (e.g. wildflowers and grasses). This google sheet + tableau solution is designed to assist as a entry point to further research.
I'm seeking user experience feedback from the Code for Philly community. Also - If anyone wants to help with the database, please join the project."
Expand Down
4 changes: 2 additions & 2 deletions html-templates/includes/site.nav-sitelinks.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<a class="dropdown-item" href="/mission">{_ "Mission"}</a>
<a class="dropdown-item" href="/pages/code_of_conduct/">{_ "Code of Conduct"}</a>
<a class="dropdown-item" href="/pages/leadership/">{_ "Organizing Team"}</a>
<a class="dropdown-item" href="/pages/leadership-support_team_open_positions/">{_ "Join the Organizing Team"}</a>
<a class="dropdown-item" href="/pages/open_leadership_positions/">{_ "Join the Organizing Team"}</a>
<a class="dropdown-item" href="/contact">{_ "Contact Us"}</a>
</div>
</li>
</li>