Skip to content

Commit 3080b0a

Browse files
committed
platformatic sample
1 parent 3c94de4 commit 3080b0a

File tree

5 files changed

+75
-29
lines changed

5 files changed

+75
-29
lines changed

samples/platformatic/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Platformatic App
2+
3+
This sample project demonstrates how to deploy a simplist Platformatic service that returns "Platformatic x Defang" when accessed. The project includes a Dockerized setup with Docker Compose, making it easy to deploy and manage the service.
4+
5+
Once your app is up and running, you can access it via the defined port (default is 3042). This service is designed to be simple, showcasing how to set up a basic Platformatic application and deploy it using Docker.
6+
7+
## Prerequisites
8+
9+
1. Download <a href="https://github.com/defang-io/defang">Defang CLI</a>
10+
2. (optional) If you are using <a href="https://docs.defang.io/docs/concepts/defang-byoc">Defang BYOC</a>, make sure you have properly <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html">authenticated your AWS account</a>.
11+
12+
## Deploying
13+
14+
1. Open the terminal and type `defang login`
15+
2. Navigate to the directory "app" with `cd ./app`
16+
3. Type `defang compose up` in the CLI.
17+
4. Your app will be running within a few minutes.
18+
19+
## Local Development
20+
21+
1. After cloning the repository and navigating to the root directory of the project, navigate to the directory called "app" with `cd app`
22+
2. Run `docker compose -f compose.dev.yaml up --build`
23+
24+
---
25+
26+
Title: Platformatic
27+
28+
Short Description: A sample project showcasing a simple Platformatic service with Docker deployment.
29+
30+
Tags: Platformatic, Defang, Docker, Node.js, Service, JavaScript
31+
32+
Languages: nodejs

samples/platformatic/app/README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
# Platformatic Runtime API
1+
# Platformatic App
22

3-
This is a generated [Platformatic Runtime](https://docs.platformatic.dev/docs/runtime/overview) application.
3+
This sample project demonstrates how to deploy a simplist Platformatic service that returns "Platformatic x Defang" when accessed. The project includes a Dockerized setup with Docker Compose, making it easy to deploy and manage the service.
44

5-
## Requirements
5+
Once your app is up and running, you can access it via the defined port (default is 3042). This service is designed to be simple, showcasing how to set up a basic Platformatic application and deploy it using Docker.
66

7-
Platformatic supports macOS, Linux and Windows ([WSL](https://docs.microsoft.com/windows/wsl/) recommended).
8-
You'll need to have [Node.js](https://nodejs.org/) >= v18.8.0 or >= v20.6.0
7+
## Prerequisites
98

10-
## Setup
9+
1. Download <a href="https://github.com/defang-io/defang">Defang CLI</a>
10+
2. (optional) If you are using <a href="https://docs.defang.io/docs/concepts/defang-byoc">Defang BYOC</a>, make sure you have properly <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html">authenticated your AWS account</a>.
1111

12-
1. Install dependencies:
12+
## Deploying
1313

14-
```bash
15-
npm install
16-
```
14+
1. Open the terminal and type `defang login`
15+
2. Navigate to the directory "app" with `cd ./app`
16+
3. Type `defang compose up` in the CLI.
17+
4. Your app will be running within a few minutes.
1718

18-
## Usage
19+
## Local Development
1920

20-
Run the API with:
21+
1. After cloning the repository and navigating to the root directory of the project, navigate to the directory called "app" with `cd app`
22+
2. Run `docker compose -f compose.dev.yaml up --build`
2123

22-
```bash
23-
npm start
24-
```
24+
---
2525

26-
## Adding a Service
26+
Title: Platformatic
2727

28-
Adding a new service to this project is as simple as running `create-platformatic` again, like so:
28+
Short Description: A sample project showcasing a simple Platformatic service with Docker deployment.
2929

30-
```
31-
npx create-platformatic
32-
```
30+
Tags: Platformatic, Defang, Docker, Node.js, Service, JavaScript
31+
32+
Languages: nodejs
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
services:
2+
platformatic-app:
3+
build:
4+
context: .
5+
ports:
6+
- "3042:3042"
7+
environment:
8+
NODE_ENV: development
9+
restart: unless-stopped
10+
volumes:
11+
- .:/app
12+
- /app/node_modules
13+
command: npm run start
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
services:
22
platformatic-app:
3-
build: .
3+
build:
4+
context: .
45
ports:
56
- target: 3042
67
published: 3042
@@ -9,6 +10,8 @@ services:
910
environment:
1011
NODE_ENV: production
1112
restart: always
12-
volumes:
13-
- .:/app
14-
- /app/node_modules
13+
deploy:
14+
resources:
15+
limits:
16+
cpus: "0.5"
17+
memory: "512M"

samples/platformatic/app/platformatic.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
"hotReload": true,
66
"autoload": {
77
"path": "services",
8-
"exclude": [
9-
"docs"
10-
]
8+
"exclude": ["docs"]
119
},
1210
"server": {
13-
"hostname": "{PLT_SERVER_HOSTNAME}",
11+
"hostname": "0.0.0.0",
1412
"port": "{PORT}",
1513
"logger": {
1614
"level": "{PLT_SERVER_LOGGER_LEVEL}"
1715
}
1816
},
1917
"managementApi": "{PLT_MANAGEMENT_API}"
20-
}
18+
}

0 commit comments

Comments
 (0)