-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also implemented DependencyGraph, to support the corresponding changes to dependant calculations.
- Loading branch information
Showing
105 changed files
with
4,983 additions
and
365 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,5 +0,0 @@ | ||
kubernetes: | ||
previous-usernames: | ||
- hello | ||
linkedModuleSources: [] | ||
linkedProjectSources: [] | ||
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,6 @@ | ||
project: | ||
name: tasks | ||
environments: | ||
- name: local | ||
providers: | ||
- name: local-kubernetes |
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,4 @@ | ||
node_modules | ||
Dockerfile | ||
garden.yml | ||
app.yaml |
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 node:9-alpine | ||
|
||
ENV PORT=8080 | ||
EXPOSE ${PORT} | ||
WORKDIR /app | ||
|
||
ADD package.json /app | ||
RUN npm install knex -g | ||
RUN npm install | ||
|
||
ADD . /app | ||
|
||
CMD ["npm", "start"] |
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,25 @@ | ||
const express = require("express") | ||
const knex = require("knex")({ | ||
client: "postgresql", | ||
connection: { | ||
host: "postgres-service", | ||
port: 5432, | ||
database: "postgres", | ||
user: "postgres", | ||
}, | ||
pool: { | ||
min: 4, | ||
max: 10 | ||
}, | ||
}) | ||
|
||
const app = express(); | ||
|
||
app.get("/hello", (req, res) => { | ||
knex.select("name").from("users") | ||
.then((rows) => { | ||
res.send(`Hello from Node! Usernames: ${rows.map(r => r.name).join(', ')}`) | ||
}) | ||
}); | ||
|
||
module.exports = { app } |
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,24 @@ | ||
module: | ||
name: hello-service | ||
description: Greeting service | ||
type: container | ||
services: | ||
- name: hello-service | ||
command: [npm, start] | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
ingresses: | ||
- path: /hello | ||
port: http | ||
dependencies: | ||
- node-migration | ||
tests: | ||
- name: unit | ||
command: [npm, test] | ||
tasks: | ||
- name: node-migration | ||
# sleep to give postgres time to get ready | ||
command: ["sleep 5 && knex migrate:latest"] | ||
dependencies: | ||
- postgres-service |
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,18 @@ | ||
module.exports = { | ||
development: { | ||
client: "postgresql", | ||
connection: { | ||
host: "postgres-service", | ||
port: 5432, | ||
database: "postgres", | ||
user: "postgres", | ||
}, | ||
pool: { | ||
min: 4, | ||
max: 10 | ||
}, | ||
migrations: { | ||
tableName: "knex_migrations" | ||
} | ||
} | ||
} |
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,3 @@ | ||
const { app } = require('./app'); | ||
|
||
app.listen(process.env.PORT, '0.0.0.0', () => console.log('Node service started')); |
13 changes: 13 additions & 0 deletions
13
examples/tasks/hello-service/migrations/20181008125224_create_users_table.js
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 @@ | ||
|
||
exports.up = function(knex) { | ||
return knex.schema.createTable("users", function(t) { | ||
t.increments("id").unsigned().primary(); | ||
t.dateTime("created_at").notNull(); | ||
t.dateTime("updated_at").nullable(); | ||
t.string("name").notNull(); | ||
}); | ||
}; | ||
|
||
exports.down = function(knex) { | ||
return knex.schema.dropTable("users"); | ||
}; |
Oops, something went wrong.