From 28da309f5ac4bc25dc66dde20020c88450414b5d Mon Sep 17 00:00:00 2001 From: Loren Yu Date: Thu, 22 Sep 2022 14:52:22 -0700 Subject: [PATCH 1/4] Add ADR to separate infra and app templates --- ...eparate-infra-and-application-templates.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/decisions/0001-separate-infra-and-application-templates.md diff --git a/docs/decisions/0001-separate-infra-and-application-templates.md b/docs/decisions/0001-separate-infra-and-application-templates.md new file mode 100644 index 0000000..8b6601f --- /dev/null +++ b/docs/decisions/0001-separate-infra-and-application-templates.md @@ -0,0 +1,31 @@ +# Separate infra template code and application template code into different repositories + +* Status: accepted +* Deciders: @rocketnova @lorenyu +* Date: 2022-09-08 + +Technical Story: [description | ticket/issue URL] + +## Context and Problem Statement + +We want to add support for a Python tech stack to the Platform, but want to avoid duplicating common infrastructure code. + +### Additional context + +The NJ UI project intends to develop a Python API application, which is the second application (after WIC) that will have a Python application. We expect that Python will be a common choice for future projects, and want to have a way to support it in the Platform. There is already a template-application-nextjs template that contains template infrastructure code as well as template code for the NextJS application. Creating a template-application-flask in the same manner would end up duplicating the infrastructure code. + +## Considered Options + +* Create `template-application-flask` similar to `template-application-nextjs` +* Separate the infrastructure code from `template-application-nextjs` into a separate repo `template-infra`, and create `template-application-flask` with just the python application code + +## Decision Outcome + +Decision was to rename the `template-application-nextjs` repo to `template-infra` and create a new repo `template-application-nextjs` with the same git history. This effectively splits up the repo into two parts. The infra part will eventually just contain the infra code, and the other repo will just contain the application code. + +We also created `platform` repo to be the landing page for the platform where we can put instructions for how to use all the pieces together. + +### See also + +* [Slack thread about adding Python stack/API to the platform](https://nava.slack.com/archives/C03G1SWD9H7/p1662570596982139) +* [Follow up Slack thread about naming conventions for separate repos](https://nava.slack.com/archives/C03G1SWD9H7/p1662676260639049?thread_ts=1662665280.211029&cid=C03G1SWD9H7) From e83512a979827a748d9a18d42b021e30a89b5204 Mon Sep 17 00:00:00 2001 From: Loren Yu Date: Thu, 22 Sep 2022 14:52:40 -0700 Subject: [PATCH 2/4] Propose installation methods --- docs/decisions/0002-installation-method.md | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 docs/decisions/0002-installation-method.md diff --git a/docs/decisions/0002-installation-method.md b/docs/decisions/0002-installation-method.md new file mode 100644 index 0000000..77a00e8 --- /dev/null +++ b/docs/decisions/0002-installation-method.md @@ -0,0 +1,82 @@ +# How to use template-infra with template applications + +* Status: proposed +* Deciders: [list everyone involved in the decision] +* Date: [YYYY-MM-DD when the decision was last updated] + +Technical Story: User can follow instructions on how to use template-infra with either of the template applications [#2](https://github.com/navapbc/platform/issues/2) + +## Context and Problem Statement + +We previously decided to [separate infra and application templates into separate repos](./0001-separate-infra-and-application-templates.md). We need to decide how a user of the platform can use the infra template with one of the application templates or with their own custom application. + +## Considered Options + +1. User creates a repo from the template-infra repo, and replaces the `app` folder with one copied from an application template or their own. +2. User copies relevant files from the template-infra repo and from the application template repo. + +## Decision Outcome + +TBD + +## Pros and Cons of the Options + +### Create project repo from template-infra repo + +Pros + +* Fewer things to copy over (github actions, pull request template) + +Cons + +* Doesn't work with existing repo (e.g. if a user already has an application and wants to add template infra to the repo) +* May still need to have a setup script or instructions to remove/clean up files that aren't needed (e.g. the example application in template-infra is likely not needed) + +### Copy files into existing repo + +Add something like this to instructions in [template-infra](https://github.com/navapbc/template-infra) + +```bash +# fetch latest version of template-infra +git clone --single-branch --branch main --depth 1 git@github.com:navapbc/template-infra.git + +# add .gitignore lines +touch .gitignore +echo >> .gitignore # add newline +cat template-infra/.gitignore >> .gitignore + +# copy docker-compose.yml +cp template-infra/docker-compose.yml . + +# copy infra decision records +mkdir -p docs/ +cp -r template-infra/docs/decisions/ docs/decisions/ + +# copy infra code +cp -r template-infra/infra/ infra/ + +# clean up template-infra folder +rm -fr template-infra +``` + +Can also simplify the middle lines into a script e.g. + +```bash +# fetch latest version of template-infra +git clone --single-branch --branch main --depth 1 git@github.com:navapbc/template-infra.git + +# install +./template-infra/scripts/install.sh + +# clean up template-infra folder +rm -fr template-infra +``` + +Pros + +* Allows user to install template to existing repo +* In some cases, potentially allows a user to update their project with new versions of the template + +Cons + +* Requires maintaining installation instructions (or script) for template-infra From fd632a4324244b196cca18b4cb453be729605832 Mon Sep 17 00:00:00 2001 From: Loren Yu Date: Fri, 23 Sep 2022 10:07:10 -0700 Subject: [PATCH 3/4] Remove unused line from template Co-authored-by: Sawyer Hollenshead --- docs/decisions/0001-separate-infra-and-application-templates.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/decisions/0001-separate-infra-and-application-templates.md b/docs/decisions/0001-separate-infra-and-application-templates.md index 8b6601f..7975a34 100644 --- a/docs/decisions/0001-separate-infra-and-application-templates.md +++ b/docs/decisions/0001-separate-infra-and-application-templates.md @@ -4,7 +4,6 @@ * Deciders: @rocketnova @lorenyu * Date: 2022-09-08 -Technical Story: [description | ticket/issue URL] ## Context and Problem Statement From 4c05f832c8e783f0e1e588409bd642e512d31d00 Mon Sep 17 00:00:00 2001 From: Loren Yu Date: Fri, 23 Sep 2022 10:59:32 -0700 Subject: [PATCH 4/4] Don't copy over .gitignore when installing template --- docs/decisions/0002-installation-method.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/decisions/0002-installation-method.md b/docs/decisions/0002-installation-method.md index 77a00e8..8d1236d 100644 --- a/docs/decisions/0002-installation-method.md +++ b/docs/decisions/0002-installation-method.md @@ -40,11 +40,6 @@ Add something like this to instructions in [template-infra](https://github.com/n # fetch latest version of template-infra git clone --single-branch --branch main --depth 1 git@github.com:navapbc/template-infra.git -# add .gitignore lines -touch .gitignore -echo >> .gitignore # add newline -cat template-infra/.gitignore >> .gitignore - # copy docker-compose.yml cp template-infra/docker-compose.yml .