Skip to content

Commit 62fd48e

Browse files
authored
Support Platform CLI (#54)
Switch to the Platform CLI[1] for install/update. - Add `copier.yml` config file - Move template files into `template/` - Move Docker Compose files from project root to `{{app_name}}/`. And tag the app services with `{{app_name}}`. In a multi-app environment, it is unreasonable (and high source of conflicts on update) for a single application template to provide a root Compose file. So apps should provide their own Compose files, the the project can import them into one project-wide Compose file if desired. - Drop unnecessary `.grype.yml`. Can use template-infra's project-wide version since we don't need any app overrides. - Pull back a few things from `pfml-starter-kit` - Remove old install/update scripts [1] https://github.com/navapbc/platform-cli
1 parent 95f5ab6 commit 62fd48e

File tree

195 files changed

+169
-425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+169
-425
lines changed

.grype.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,51 +23,34 @@ See [`navapbc/platform`](https://github.com/navapbc/platform) for other template
2323
## Repo structure
2424

2525
```text
26-
├── .github # GitHub workflows and repo templates
27-
├── docs # Project docs and decision records
28-
├── app-rails # Web application
29-
├── template-only-bin # Scripts for managing this template; not copied into your project
30-
├── template-only-docs # Documentation for this template; not copied into your project
26+
.
27+
├── template # The template (the things that get installed/updated)
28+
│ ├── .github # GitHub workflows
29+
│ ├── docs # Project docs and decision records
30+
│ └── {{app_name}} # Application code
31+
└── template-only-docs # Template repo docs
3132
```
3233

3334
## Installation
3435

35-
To get started using the template application on your project:
36+
To get started using the template application on your project, for an
37+
application to be called `<APP_NAME>`:
3638

37-
1. Run the [download and install script](./template-only-bin/download-and-install-template) in your project's root directory.
38-
39-
```bash
40-
curl https://raw.githubusercontent.com/navapbc/template-application-rails/main/template-only-bin/download-and-install-template | bash -s
41-
```
42-
43-
This script will:
44-
45-
1. Clone the template repository
46-
2. Copy the template files into your project directory
47-
3. Ignore any files specific to the template repository, like this README.
48-
49-
You can optionally pass in a branch, commit hash, or release that you want to install. For example:
50-
51-
```bash
52-
curl https://raw.githubusercontent.com/navapbc/template-application-rails/main/template-only-bin/download-and-install-template | bash -s -- <commit_hash>
39+
1. [Install the nava-platform tool](https://github.com/navapbc/platform-cli).
40+
2. Install template by running in your project's root:
41+
```sh
42+
nava-platform app install --template-uri https://github.com/navapbc/template-application-rails . <APP_NAME>
5343
```
54-
2. [Follow the steps in `app-rails/README.md`](./app-rails/README.md) to set up the application locally.
55-
3. Optional, if using the Platform infrastructure template: [Follow the steps in the `template-infra` README](https://github.com/navapbc/template-infra#installation) to set up the various pieces of your infrastructure.
44+
3. Follow the steps in `<APP_NAME>/README.md` to set up the application locally.
45+
4. Optional, if using the Platform infrastructure template: [Follow the steps in the `template-infra` README](https://github.com/navapbc/template-infra#installation) to set up the various pieces of your infrastructure.
5646

5747
## Updates
5848

59-
If you have previously installed this template and would like to update your project to use a newer version of this application:
60-
61-
1. Run the [update script](./template-only-bin/update-template) in your project's root directory and pass in the branch, commit hash, or release that you want to update to, followed by the name of your application directory (e.g. `app-rails`).
49+
If you have previously installed this template and would like to update your
50+
project to use a newer version of this template:
6251

63-
```bash
64-
curl https://raw.githubusercontent.com/navapbc/template-application-rails/main/template-only-bin/update-template | bash -s -- <commit_hash> <app_name>
52+
1. [Install the nava-platform tool](https://github.com/navapbc/platform-cli).
53+
2. Update app template by running in your project's root:
54+
```sh
55+
nava-platform app update . <APP_NAME>
6556
```
66-
67-
This script will:
68-
69-
1. Clone the template repository
70-
2. Copy the template files into your project directory
71-
3. Ignore any files specific to the template repository, like this README.
72-
73-
⚠️ Warning! This will modify existing files. Review all changes carefully after executing the script by running `git diff`.

copier.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# App vars
3+
#
4+
app_name:
5+
type: str
6+
help: The name of the app
7+
validator: >-
8+
{% if not (app_name | regex_search('^[a-z0-9\-_]+$')) %}
9+
The app name can not be empty and should only contain lower case letters, digits, dashes, and underscores.
10+
{% endif %}
11+
12+
app_local_port:
13+
type: int
14+
help: "The port to be used in local development of '{{ app_name }}'"
15+
default: 3000
16+
17+
_envops:
18+
trim_blocks: true
19+
lstrip_blocks: true
20+
21+
# ideally we could just:
22+
#
23+
# _answers_file: .template-application-rails/{{app_name}}.yml
24+
#
25+
# but alas, no:
26+
#
27+
# https://github.com/copier-org/copier/issues/1868
28+
29+
_subdirectory: template

docs/app-rails/decisions/README.md

Whitespace-only changes.

template-only-bin/README.md

Whitespace-only changes.

template-only-bin/download-and-install-template

Lines changed: 0 additions & 42 deletions
This file was deleted.

template-only-bin/install-template

Lines changed: 0 additions & 43 deletions
This file was deleted.

template-only-bin/rename-template-app

Lines changed: 0 additions & 89 deletions
This file was deleted.

template-only-bin/update-template

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)