Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
redreceipt committed Jul 22, 2021
2 parents 8ff720e + bb2bf15 commit db56c96
Show file tree
Hide file tree
Showing 67 changed files with 4,003 additions and 5,862 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12

- name: Install Dependencies
run: yarn --ignore-scripts
Expand All @@ -22,6 +24,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12

- name: Install Dependencies
run: yarn --ignore-scripts
Expand All @@ -38,6 +42,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12

- name: Install Dependencies
run: yarn --ignore-scripts
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ jobs:

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 12

- name: Install Bundler
run: gem install bundler

- name: Decrypt Environment Variables and Apple API Key
run: (cd .. && yarn secrets -d ${{ secrets.ENCRYPTION_PASSWORD }})
run: (npx @apollosproject/apollos-cli secrets -d ${{ secrets.ENCRYPTION_PASSWORD }})

- run: cp .env.shared .env

Expand Down Expand Up @@ -96,12 +98,14 @@ jobs:

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 12

- name: Install Bundler
run: gem install bundler

- name: Decrypt Environment Variables and Keystore
run: (cd .. && yarn secrets -d ${{ secrets.ENCRYPTION_PASSWORD }})
run: (npx @apollosproject/apollos-cli secrets -d ${{ secrets.ENCRYPTION_PASSWORD }})

- run: cp .env.shared .env

Expand All @@ -119,8 +123,3 @@ jobs:

- name: Fastlane Deploy
run: bundle exec fastlane android deploy
env:
KEYSTORE_FILE: apollos.keystore
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: apollos
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
8 changes: 6 additions & 2 deletions BUGSNAG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ const apolloServer = new ApolloServer({
## App
First add the CLI to the app dev dependencies
First, go to Bugsnag's website and create a new project. Use "Mobile" > "React Native" > "React Native" in the onboarding. This will give you an API key to use.
Then, make sure you are in the `apolloschurchapp` folder and add the CLI to the app dev dependencies.
```
cd apolloschurchapp
Expand All @@ -50,7 +52,7 @@ cp ../yarn.lock yarn.lock
yarn bugsnag-react-native-cli init
```
**_Make sure to not commit the local `yarn.lock` file!_**
**_Make sure to not commit the local `yarn.lock` file in the `apolloschurchapp` folder!_**
```
rm yarn.lock
Expand All @@ -59,6 +61,8 @@ rm yarn.lock
You can verify it's working by throwing an error right after Bugsnag is initialized on the `index.js` file
```
import Bugsnag from "@bugsnag/react-native";

Bugsnag.start();
Bugsnag.notify(new Error('Test error'));
```
2 changes: 1 addition & 1 deletion BULL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ JOBS_USERNAME=<whatever>
JOBS_PASSWORD=<whatever>
```

You can view and manage jobs through the `/admin/queues` endpoint
You can view and manage jobs through the `<YourHerokuAppUrl>/admin/queues` endpoint
61 changes: 61 additions & 0 deletions CONTENT_SHOVEL_MIGRATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Content Shovel Migration Steps

Migrating Content from being pulled directly from Rock to being pulled via the shovel is a one time process. Depending on the level of customization of your API, it may be time consuming, but overall will result in far greater stability and maintainability.

Listed below are a number of steps you may have to take in order to complete the migration.

## Understanding Core API changes

Moving all the content item data to Postgres comes with some rethinking of how the Content Item data is structured. Here are some of the important changes.

Personas are now tags (with `type: persona`). Content Items can have tags, and people can have tags.

Content items now have a `parentId`

Content items have a `coverImageId`, pointing at their cover image.

ApollosIDs (what you see come through GraphQL) are now stored directly on the content item table.

Features are now a row in the Features table. The entire configuration for the feature is no longer stored in the ID. (Right now this is only true for Content Item features.)

A lot of the ContentItem.dataSource methods have been renamed or changed. In general, a lot more data is available on the ContentItem objects themselves (example - `contentItem.getCoverImage()` vs `ContentItemDataSource.getCoverImage(contentItem)`) but a lot of methods have been aliased to ease the transition.

The request builder is no more. You will want to read up on Sequelize query syntax. Most `getByXXX` methods take a `args` argument that lets you pass filters, eager loads, etc.

*Important*. You can't spread the objects returned by Sequelize methods. For example, if you have a an `item` returned by `getFromId()` doing `{ ...item, attribute: value }` will cause problems.



## Move Typename Configuration to the Shovel.

Moving forward, typenames are pre-determined for content items. The API no longer has to decide what type an item is, that information is stored in the shovel. You'll need to create a new Variable in your Airflow instance storing your typename configuration. The form is a subset of the previous config.yml format. Example below

```json
{
"CONTENT_MAPPINGS": {
"ContentSeriesContentItem": {
"ContentChannelTypeId": [
6
]
},
"DevotionalContentItem": {
"ContentChannelId": [
7
]
},
"WeekendContentItem": {
"ContentChannelId": [
5
]
}
}
}
```

## Update Action Algorithm ID references

Once you have the shovel up and running, you'll want to connect to it via your favorite postgres client. Inside your `config.yml`, you'll want to replace references to the Rock integer IDS with the new Postgres UUIDs. This is easily done, by cross referencing the Integer IDs with the Postgres Database, and then copying in the appropriate UUIDS. You'll find the "ContentChannelItems" in the "contentChannel" table, and the "ContentChannel"s in the "ContentItemsCategory" table.

When using `relatedNodes`, you will want to use the apollosId field instead of the `id` field.


20 changes: 14 additions & 6 deletions ONE_SIGNAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@ openssl req -new -key myprivate.key -out csr.certSigningRequest
Fill Prompts with this info:

```
Country Name (2 letter code) [AU]: US
State or Province Name [Some-State]: United States
Locality Name []:
Organization Name []: Apple Inc.
Organizational Unit Name []: Apple Worldwide Developer Relations
Common Name []: Apple Worldwide Developer Relations Certification Authority
Country Name (2 letter code) []: US
State or Province Name (full name) []: United States
Locality Name (eg, city) []:
Organization Name (eg, company) []: Apple Inc.
Organizational Unit Name (eg, section) []: Apple Worldwide Developer Relations
Common Name (eg, fully qualified host name) []: Apple Worldwide Developer Relations Certification Authority
Email Address []: your-email
```

You will then be asked for a challenge password, which you will need in the next step.

```
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
```

Upload new CSR to download a `.cer` file from Apple, then convert to `.p12`, **_remember the password!_**

```
Expand Down
67 changes: 44 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ heroku create APP_NAME [-t OPTIONAL_TEAM]
Add your config variables to the remote application

```
heroku config:set ROCK_API=<url> ROCK_TOKEN=<token>
heroku config:set ROCK_URL=<url> ROCK_TOKEN=<token>
```

We deploy through the Github workflow. You need to set three new [Github secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) in your new repository. First [Install the Github CLI](https://cli.github.com)
Expand Down Expand Up @@ -176,8 +176,8 @@ MATCH_BASIC_GIT_AUTHORIZATION=<base64 encoded token>
Inside the app directory run `match` to configure the certificates

```
bundle exec fastlane match development
bundle exec fastlane match appstore
fastlane match development
fastlane match appstore
```

Use Xcode to switch the certificate and profile settings to "Manual" and choose the new certificates and profiles that you just created.
Expand All @@ -194,34 +194,30 @@ APP_STORE_CONNECT_API_KEY_ISSUER_ID=<issuer ID>
Test the deployment:

```
bundle exec fastlane ios deploy
fastlane ios deploy
```

The last thing you'll want to do to make sure you don't lose your important keys and credentials is encrypt them and add them to the repo. Copy the `.env` file to a new file, `.env.shared`. Then from the root directory, run the encryption command. You can also use this through for the API directory as well as important Android secrets when we get there.
The last thing you'll want to do to make sure you don't lose your important keys and credentials is encrypt them and add them to the repo. Copy the `.env` file to a new file, `.env.shared`. Then run the following encryption command from within the APP directory, `/apolloschurchapp`. You can also use this same process in the API directory, `/apollos-church-api`. The `<TOKEN>` is an encryption password that you will use for automatic Android deploys.

```
yarn secrets -e <password>
npx @apollosproject/apollos-cli secrets -e <TOKEN>
```

Make sure to remember that password as we'll use it later for automatic Android deploys. Add it to Github as a secret
Make sure to remember that password and add it to Github as a secret.

`ENCRYPTION_PASSWORD=<password>`

Now push the changes and watch the app deploy!

##### Android

First, you'll need to have the Developer account owner generate an upload key.

![upload key](https://files-2w1r6fc7m.vercel.app)

Move that file to `android/key.json` once you have it. You can validate the upload key with this command
First, you'll need to have the Developer account owner generate an upload key. [Create a service account](https://developers.google.com/android-publisher/getting_started#using_a_service_account) and add it to the Play Console with "Release Manager" role. Move the downloaded JSON file to `android/key.json` once you have it. You can validate the upload key with this command

```
fastlane run validate_play_store_json_key --json_key android/key.json
fastlane run validate_play_store_json_key json_key:./android/key.json
```

Next, you'll need to generate a new signing key. Keep the passwords it asks you for.
Next, you'll need to generate a new keystore. Keep the passwords it asks you for.

```
keytool -genkey -v -keystore apollos.keystore -alias apollos -keyalg RSA -keysize 2048 -validity 10000
Expand All @@ -231,7 +227,7 @@ Drop the keystore file here: `apolloschurchapp/android/app/apollos.keystore`

**_NOTE:_** You may also want to save this keystore and credentials somewhere safe outside this repo, it's the only keystore you can ever use for this app and if you lose it, it's very difficult to get a new one.

Now just load these environment variables in your `.env.shared` file
Now just load these environment variables in your `.env` and `.env.shared` files

```
KEYSTORE_FILE=apollos.keystore
Expand All @@ -240,20 +236,45 @@ KEY_ALIAS=apollos
KEY_PASSWORD=<alias password>
```

You will need to upload the bundle manually the first time, exporting your private signing key from Android Studio. [Follow these instructions](https://developer.android.com/studio/publish/app-signing#generate-key) to export the key. Then upload the bundle to the internal test track, opting into Google Play Signing with your exported `*.pepk` file.
You will need to upload the bundle manually the first time. First set the Application ID to something unique in the `android/app/build.gradle` file:

![play store](https://files-l4eap9235-redreceipt.vercel.app)

Go through the steps to finish your first release.
```
defaultConfig {
applicationId "com.company.appname"
...
...
...
}
```

Now you're ready to test the deploy
Run the fastlane command to generate a release build:

```
bundle exec fastlane android deploy
fastlane run gradle task:bundle build_type:Release project_dir:android
```

Lastly, to get automated deploys working on the CI, re-run the encryption command from a previous step to add the new keystore and upload key to the repo
You can find the bundle in `android/app/build/outputs/bundle/release/app-release.aab`. Upload the bundle to the **closed testing** track the first time. The app must have been "released" before we push anything to internal. Fastlane will take care of uploading to internal, so you only need to upload to closed testing.

![play store](https://files-6ngafis8q-redreceipt.vercel.app)

Go through the steps to finish your first release.

Lastly, to get automated deploys working on the CI, move the keystore variables to `.env.shared` and re-run the encryption command from a previous step, using the same token from the iOS steps above:

```
yarn secrets -e <password>
npx @apollosproject/apollos-cli secrets -e <TOKEN>
```

Change the metadata information for the Android release:

- `fastlane/metadata/android/en-US/full_description.txt`
- `fastlane/metadata/android/en-US/short_description.txt`
- `fastlane/metadata/android/en-US/title.txt`

Add new images and screenshots

- `fastlane/metadata/android/en-US/images/phoneScreenshots/` (three images)
- `fastlane/metadata/android/en-US/images/icon.png` (512 x 512 jpg)
- `fastlane/metadata/android/en-US/images/featureGraphic.png` (1024 x 500 jpg)

Now when you push to master, you should be all set for automatic deploys!
Binary file modified apollos-church-api/.env.shared.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion apollos-church-api/apollos.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.21.0",
"version": "2.27.2",
"environment": "api"
}
Loading

0 comments on commit db56c96

Please sign in to comment.