Skip to content

Commit 36f90fe

Browse files
authored
Merge pull request #336 from DefangLabs/linda-nounly-go
Nounly Sample
0 parents  commit 36f90fe

Some content is hidden

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

80 files changed

+12949
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
FROM mcr.microsoft.com/devcontainers/typescript-node:22-bookworm

.devcontainer/devcontainer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"build": {
3+
"dockerfile": "Dockerfile",
4+
"context": ".."
5+
},
6+
"features": {
7+
"ghcr.io/defanglabs/devcontainer-feature/defang-cli:1.0.4": {},
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
9+
"ghcr.io/devcontainers/features/aws-cli:1": {}
10+
}
11+
}

.dockerignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Ignore node_modules directory since it will be installed inside the container
2+
node_modules
3+
npm-debug.log
4+
yarn-debug.log
5+
yarn-error.log
6+
7+
# Ignore logs
8+
logs
9+
*.log
10+
11+
# Ignore coverage directory
12+
coverage
13+
14+
# Ignore environment variable files
15+
.env
16+
.env.test
17+
18+
# Ignore local development settings
19+
.sailsrc
20+
.sailsrc.js
21+
22+
# Ignore build outputs
23+
build/
24+
.next/
25+
out/
26+
.cache/
27+
public
28+
29+
# Ignore git directory
30+
.git
31+
.gitignore
32+
33+
# Ignore editor directories and files
34+
.idea
35+
.vscode
36+
*.swp
37+
.tmp

.github/workflows/deploy.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
environment: playground
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
steps:
17+
- name: Checkout Repo
18+
uses: actions/checkout@v4
19+
20+
- name: Deploy
21+
uses: DefangLabs/[email protected]

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Sailsjs
2+
3+
[![1-click-deploy](https://defang.io/deploy-with-defang.svg)](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-sailsjs-template%26template_owner%3DDefangSamples)
4+
5+
This sample demosntrates how to deploy a very basic Sailsjs sample with Defang. The sample simply outputs hello world on the webpage.
6+
7+
## Prerequisites
8+
9+
1. Download [Defang CLI](https://github.com/DefangLabs/defang)
10+
2. (Optional) If you are using [Defang BYOC](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) authenticated with your AWS account
11+
3. (Optional - for local development) [Docker CLI](https://docs.docker.com/engine/install/)
12+
13+
## Deploying
14+
15+
1. Open the terminal and type `defang login`
16+
2. Type `defang compose up` in the CLI.
17+
3. Your app will be running within a few minutes.
18+
19+
## Development
20+
21+
For development, we use a local container. This can be seen in the compose.yaml document. To run the sample locally after cloning the respository, you can run on docker by using the following command:
22+
23+
1. docker compose -f compose.dev.yaml up --build
24+
25+
---
26+
27+
Title: Sails.js
28+
29+
Short Description: A short hello world application demonstrating how to deploy Sails.js onto Defang.
30+
31+
Tags: Sails.js, Node.js
32+
33+
Languages: nodejs

compose.dev.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
services:
2+
sails:
3+
build:
4+
context: ./sails
5+
ports:
6+
- target: 1337
7+
published: 1337
8+
protocol: tcp
9+
mode: ingress
10+
volumes:
11+
- ./sails:/usr/src/app
12+
- /usr/src/app/node_modules
13+
environment:
14+
- NODE_ENV=production
15+
command: sails lift

compose.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
sails:
3+
restart: unless-stopped
4+
build:
5+
context: ./sails
6+
ports:
7+
- target: 1337
8+
published: 1337
9+
protocol: tcp
10+
mode: ingress
11+
volumes:
12+
- ./sails:/usr/src/app
13+
- /usr/src/app/node_modules
14+
environment:
15+
- NODE_ENV=production
16+
command: sails lift --prod
17+
#deploy:
18+
# resources:
19+
# reservations:
20+
# memory: 256M

sails/.editorconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
################################################
2+
# ╔═╗╔╦╗╦╔╦╗╔═╗╦═╗┌─┐┌─┐┌┐┌┌─┐┬┌─┐
3+
# ║╣ ║║║ ║ ║ ║╠╦╝│ │ ││││├┤ ││ ┬
4+
# o╚═╝═╩╝╩ ╩ ╚═╝╩╚═└─┘└─┘┘└┘└ ┴└─┘
5+
#
6+
# > Formatting conventions for your Sails app.
7+
#
8+
# This file (`.editorconfig`) exists to help
9+
# maintain consistent formatting throughout the
10+
# files in your Sails app.
11+
#
12+
# For the sake of convention, the Sails team's
13+
# preferred settings are included here out of the
14+
# box. You can also change this file to fit your
15+
# team's preferences (for example, if all of the
16+
# developers on your team have a strong preference
17+
# for tabs over spaces),
18+
#
19+
# To review what each of these options mean, see:
20+
# http://editorconfig.org/
21+
#
22+
################################################
23+
root = true
24+
25+
[*]
26+
indent_style = space
27+
indent_size = 2
28+
end_of_line = lf
29+
charset = utf-8
30+
trim_trailing_whitespace = true
31+
insert_final_newline = true

sails/.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
assets/dependencies/**/*.js
2+
views/**/*.ejs
3+

sails/.eslintrc

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
// ╔═╗╔═╗╦ ╦╔╗╔╔╦╗┬─┐┌─┐
3+
// ║╣ ╚═╗║ ║║║║ ║ ├┬┘│
4+
// o╚═╝╚═╝╩═╝╩╝╚╝ ╩ ┴└─└─┘
5+
// A set of basic code conventions designed to encourage quality and consistency
6+
// across your Sails app's code base. These rules are checked against
7+
// automatically any time you run `npm test`.
8+
//
9+
// > An additional eslintrc override file is included in the `assets/` folder
10+
// > right out of the box. This is specifically to allow for variations in acceptable
11+
// > global variables between front-end JavaScript code designed to run in the browser
12+
// > vs. backend code designed to run in a Node.js/Sails process.
13+
//
14+
// > Note: If you're using mocha, you'll want to add an extra override file to your
15+
// > `test/` folder so that eslint will tolerate mocha-specific globals like `before`
16+
// > and `describe`.
17+
// Designed for ESLint v4.
18+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
19+
// For more information about any of the rules below, check out the relevant
20+
// reference page on eslint.org. For example, to get details on "no-sequences",
21+
// you would visit `http://eslint.org/docs/rules/no-sequences`. If you're unsure
22+
// or could use some advice, come by https://sailsjs.com/support.
23+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24+
25+
"env": {
26+
"node": true
27+
},
28+
29+
"parserOptions": {
30+
"ecmaVersion": 2018
31+
},
32+
33+
"globals": {
34+
// If "no-undef" is enabled below, be sure to list all global variables that
35+
// are used in this app's backend code (including the globalIds of models):
36+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37+
"Promise": true,
38+
"sails": true,
39+
"_": true
40+
// …and any others (e.g. `"Organization": true`)
41+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
42+
},
43+
44+
"rules": {
45+
"block-scoped-var": ["error"],
46+
"callback-return": ["error", ["done", "proceed", "next", "onwards", "callback", "cb"]],
47+
"camelcase": ["warn", {"properties":"always"}],
48+
"comma-style": ["warn", "last"],
49+
"curly": ["warn"],
50+
"eqeqeq": ["error", "always"],
51+
"eol-last": ["warn"],
52+
"handle-callback-err": ["error"],
53+
"indent": ["warn", 2, {
54+
"SwitchCase": 1,
55+
"MemberExpression": "off",
56+
"FunctionDeclaration": {"body":1, "parameters":"off"},
57+
"FunctionExpression": {"body":1, "parameters":"off"},
58+
"CallExpression": {"arguments":"off"},
59+
"ArrayExpression": 1,
60+
"ObjectExpression": 1,
61+
"ignoredNodes": ["ConditionalExpression"]
62+
}],
63+
"linebreak-style": ["error", "unix"],
64+
"no-dupe-keys": ["error"],
65+
"no-duplicate-case": ["error"],
66+
"no-extra-semi": ["warn"],
67+
"no-labels": ["error"],
68+
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
69+
"no-redeclare": ["warn"],
70+
"no-return-assign": ["error", "always"],
71+
"no-sequences": ["error"],
72+
"no-trailing-spaces": ["warn"],
73+
"no-undef": ["off"],
74+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
75+
// ^^Note: If this "no-undef" rule is enabled (set to `["error"]`), then all model globals
76+
// (e.g. `"Organization": true`) should be included above under "globals".
77+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
78+
"no-unexpected-multiline": ["warn"],
79+
"no-unreachable": ["warn"],
80+
"no-unused-vars": ["warn", {"caughtErrors":"all", "caughtErrorsIgnorePattern": "^unused($|[A-Z].*$)", "argsIgnorePattern": "^unused($|[A-Z].*$)", "varsIgnorePattern": "^unused($|[A-Z].*$)" }],
81+
"no-use-before-define": ["error", {"functions":false}],
82+
"one-var": ["warn", "never"],
83+
"prefer-arrow-callback": ["warn", {"allowNamedFunctions":true}],
84+
"quotes": ["warn", "single", {"avoidEscape":false, "allowTemplateLiterals":true}],
85+
"semi": ["warn", "always"],
86+
"semi-spacing": ["warn", {"before":false, "after":true}],
87+
"semi-style": ["warn", "last"]
88+
}
89+
90+
}

0 commit comments

Comments
 (0)