-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from infracloudio/rust-app
Rust app
- Loading branch information
Showing
44 changed files
with
5,566 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Publish Acorn image | ||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- "v[0-9]*" | ||
|
||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: acorn-io/actions-setup@v2 | ||
with: | ||
acorn-version: "main" | ||
- name: Login to GHCR | ||
uses: acorn-io/actions-login@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and Publish with signature | ||
run: | | ||
TAG=${GITHUB_REF#refs/*/} | ||
acorn build --platform linux/amd64 --platform linux/arm64 --push -t ghcr.io/infracloudio/rust-acorn:${TAG} . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: "Rust Sample Acorn" | ||
description: "Acorn running a sample Rust app" | ||
readme: "./README.md" | ||
icon: "./rust_icon.png" | ||
|
||
|
||
args: { | ||
// Name of the database to create. Defaults to "rust-sqlx" | ||
dbName: "rust-sqlx" | ||
// Name of the database user to create. Defaults to "rust" | ||
dbUser: "rust" | ||
} | ||
|
||
services: db: { | ||
image: "ghcr.io/acorn-io/postgres:v15.#-#" | ||
serviceArgs: { | ||
dbName: args.dbName | ||
dbUser: args.dbUser | ||
} | ||
} | ||
|
||
containers: { | ||
backend: { | ||
image: "ghcr.io/infracloudio/rust-backend:v2" | ||
env: { | ||
"POSTGRES_HOST": "@{service.db.address}" | ||
"POSTGRES_PORT": "@{service.db.port.5432}" | ||
"POSTGRES_USER": "@{service.db.secrets.admin.username}" | ||
"POSTGRES_PASSWORD":"@{service.db.secrets.admin.password}" | ||
"POSTGRES_DB":"@{service.db.data.dbName}" | ||
"DATABASE_URL":"postgresql://@{service.db.secrets.admin.username}:@{service.db.secrets.admin.password}@@{service.db.address}:5432/@{service.db.data.dbName}?schema=public" | ||
"PGADMIN_DEFAULT_EMAIL":"[email protected]" | ||
"PGADMIN_DEFAULT_PASSWORD":"password123" | ||
} | ||
ports: { | ||
publish: "8000:8000/http" | ||
} | ||
memory: 1048Mi | ||
consumes: ["db"] | ||
} | ||
frontend: { | ||
image: "ghcr.io/infracloudio/rust-frontend:v1" | ||
cmd: ["/bin/sh", "-c", "cd /usr/src/fullstack-rust-app/frontend && BACKEND_SERVER=$BACKEND_SERVER trunk serve --address 0.0.0.0 --port 3000"] | ||
ports: { | ||
publish: "3000:3000/http" | ||
} | ||
env: { | ||
// Frontend forwards the requests to the Backend Container Service Endpoint | ||
"BACKEND_SERVER": "@{services.backend.endpoint}" | ||
} | ||
memory: 1048Mi | ||
dependsOn: ["backend"] | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM rust:1.73-slim-bullseye | ||
|
||
RUN apt --yes update && apt --yes install git pkg-config curl libssl-dev ca-certificates curl gnupg | ||
RUN cargo install wasm-bindgen-cli sqlx-cli | ||
RUN rustup target add wasm32-unknown-unknown | ||
|
||
WORKDIR /usr/src/ | ||
COPY . . | ||
|
||
ENTRYPOINT ["/bin/sh", "-c", "cd /usr/src/fullstack-rust-app/backend && sqlx migrate run; cargo run --bin backend -- --port 8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM rust:1.73-slim-bullseye | ||
|
||
RUN apt --yes update && apt --yes install git pkg-config curl libssl-dev ca-certificates curl gnupg | ||
RUN cargo install trunk wasm-bindgen-cli | ||
RUN rustup target add wasm32-unknown-unknown | ||
|
||
WORKDIR /usr/src/ | ||
COPY . . | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - | ||
RUN apt-get install -y nodejs | ||
|
||
RUN npx tailwindcss-cli@latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Acorn for a Rust sample app - Feedback App | ||
|
||
This is a Fullstack Rust app created in using Actix, SQLX and Postgres as Backend and Yew-TailwindCSS as its frontend. The user can provide feedback ratings and comments using this SPA web app. The application utilises the Acorn Postgres DB service to store the feedback data where the dbName and dbUser are customisable. Once deployed, the SPA web app is available on the Frontend Service Endpoint. | ||
|
||
|
||
## What is Rust? | ||
|
||
Rust has been Stack Overflow's most loved language for four years in a row and rightfully so. Rust is a blazing fast and memory-efficient static compiled language with a rich type system and ownership model. It can be used to power performance-critical services while guaranteeing memory-safety and thread-safety, empowering developers to debug at compile-time. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Oops, something went wrong.