Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

fpm-controller APIs #45

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions FPM.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ implements: fifthtry.github.io/theme
- What is `FPM.manifest.ftd`?: /dev/fpm-manifest/
- File System Organization: /fs/
- `FPM.ftd`: /fpm-ftd-file/

- FPM Controller: /fpm-controller/
- `fpm-ready` API: /fpm-controller/apis/fpm-ready/
- `get-package` API: /fpm-controller/apis/get-package/
- Update `fpm` Binary: /fpm-controller/update-fpm-binary/

- Day To Day:
- How To Run Tests: /day-to-day/how-to-run-tests/
- How To Update Failing Snapshot Tests: /day-to-day/how-to-fix-tests/
Expand Down
26 changes: 26 additions & 0 deletions fpm-controller/apis/fpm-ready.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- ft.page: `fpm-ready` API

This API is get called from `fpm`, when the `fpm serve` is ready to serve the
package.

-- ft.h1: API

-- ft.h2: URL and Parameters

URL of the API is: `/v1/fpm/fpm-ready`

Query Parameters: `ec2_instance_id` and `git_hash`.

-- ft.h2: Request Method

Request Method of this API is `GET`

-- ft.h2: Response

The output of the API is:

-- ft.code:
lang: json
{
"success": true
}
33 changes: 33 additions & 0 deletions fpm-controller/apis/get-package.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
-- ft.page: `get-package` API

This API is get called from `fpm`, when it need to get the package to deploy
on the instance.


-- ft.h1: API

-- ft.h2: URL and Parameters

URL of the API is: `/v1/fpm/get-package`

Query Parameter: `ec2_instance_id`


-- ft.h2: Request Method

Request Method of this API is `GET`

-- ft.h2: Response

The output of the API is:

-- ft.code:
lang: json
{
"success": true,
"result": {
"package": "<name of the package>",
"git": "<git url of the package>",
"base": "<base url of the package>"
}
}
4 changes: 4 additions & 0 deletions fpm-controller/index.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- ft.page: FPM Controller

FPM Controller is an entry service for any FPM package which is served by
FifthTry.
16 changes: 16 additions & 0 deletions fpm-controller/update-fpm-binary.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- ft.page: How to update `fpm` binary on ec2 instance

-- ft.h2: `ssh` To `fpm` Instance

-- ft.code:
lang: sh

ssh -i <private certificate path> <ec2-user>@<machine-ip>

-- ft.h2: On Virtual Machine Restart `fpm-app`

-- ft.code:
lang: sh

sudo systemctl restart fpm-app
journalctl -u fpm-app -ef # for log check of fpm-app