Skip to content
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
2 changes: 2 additions & 0 deletions .github/workflows/check-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
./scripts/check-modified-samples.sh > modified.txt
echo "@@ MODIFIED @@"
cat modified.txt
echo "@@ CHECKLIST @@"
cat checklist.txt

# TODO: Uncomment the following lines to validate the Compose files
# once we figure out how to prevent it from erroring on warnings.
Expand Down
11 changes: 11 additions & 0 deletions samples/platformatic/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Note: universal image is not compatible with the devcontainer tools.
# we use the typescript-node image instead here but should switch out per
# project requirements. #REMOVE_ME_AFTER_EDITING

# FROM mcr.microsoft.com/devcontainers/go:1.22-bookworm
# FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
# FROM mcr.microsoft.com/devcontainers/php:8.3-bookworm
# FROM mcr.microsoft.com/devcontainers/ruby:3.2-bookworm
# FROM mcr.microsoft.com/devcontainers/java:11-bookworm
# FROM mcr.microsoft.com/devcontainers/rust:1-bookworm
FROM mcr.microsoft.com/devcontainers/typescript-node:22-bookworm
10 changes: 10 additions & 0 deletions samples/platformatic/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"features": {
"ghcr.io/defanglabs/devcontainer-feature/defang-cli:1.0.4": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
}
}
1 change: 1 addition & 0 deletions samples/platformatic/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
26 changes: 26 additions & 0 deletions samples/platformatic/.github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Deploy
uses: DefangLabs/[email protected]
#REMOVE_ME_AFTER_EDITING - Replace the following line with the list of environment variables you want to pass to the action
with:
config-env-vars: ENV1 ENV2
env:
ENV1: ${{ secrets.ENV1 }}
ENV2: ${{ secrets.ENV2 }}
1 change: 1 addition & 0 deletions samples/platformatic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
32 changes: 32 additions & 0 deletions samples/platformatic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Platformatic App

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.

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.

## Prerequisites

1. Download <a href="https://github.com/defang-io/defang">Defang CLI</a>
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>.

## Deploying

1. Open the terminal and type `defang login`
2. Navigate to the directory "app" with `cd ./app`
3. Type `defang compose up` in the CLI.
4. Your app will be running within a few minutes.

## Local Development

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

---

Title: Platformatic

Short Description: A sample project showcasing a simple Platformatic service with Docker deployment.

Tags: Platformatic, Defang, Docker, Node.js, Service, JavaScript

Languages: nodejs
5 changes: 5 additions & 0 deletions samples/platformatic/app/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PLT_SERVER_HOSTNAME=127.0.0.1
PORT=3042
PLT_SERVER_LOGGER_LEVEL=info
PLT_MANAGEMENT_API=true
PLT_SERVICE1_TYPESCRIPT=false
27 changes: 27 additions & 0 deletions samples/platformatic/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
dist
.DS_Store

# dotenv environment variable files
.env

# database files
*.sqlite
*.sqlite3

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Dependency directories
node_modules/

# ctags
tags

# clinicjs
.clinic/
20 changes: 20 additions & 0 deletions samples/platformatic/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the official Node.js image as the base image
FROM node:20-bookworm-slim

# Set the working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the working directory
COPY package*.json ./

# Install the dependencies
RUN npm install --production

# Copy the rest of the application code to the working directory
COPY . .

# Expose the application port
EXPOSE 3042

# Define the command to run your application
CMD ["npm", "start"]
32 changes: 32 additions & 0 deletions samples/platformatic/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Platformatic App

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.

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.

## Prerequisites

1. Download <a href="https://github.com/defang-io/defang">Defang CLI</a>
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>.

## Deploying

1. Open the terminal and type `defang login`
2. Navigate to the directory "app" with `cd ./app`
3. Type `defang compose up` in the CLI.
4. Your app will be running within a few minutes.

## Local Development

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

---

Title: Platformatic

Short Description: A sample project showcasing a simple Platformatic service with Docker deployment.

Tags: Platformatic, Defang, Docker, Node.js, Service, JavaScript

Languages: nodejs
Loading
Loading