-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vote example #428
Vote example #428
Conversation
examples/vote/README.md
Outdated
@@ -0,0 +1,36 @@ | |||
# Voting example project | |||
|
|||
Example voting application where you can vote for either cats or dogs. You can vote as many times as you would like. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add something about the intent here, and the structure of the application. What we're demonstrating is a fairly typical backend application configured with Garden, as opposed to how to make a voting application.
</head> | ||
<body> | ||
<noscript> | ||
<strong>We're sorry but hello-world doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello-world?
command: [psql, -w, -U, postgres, -d, postgres, -c, "SELECT 1"] | ||
tasks: | ||
- name: db-init | ||
command: [psql, -w, -U, postgres, --host=db, --port 5432, -d, postgres, "-c 'CREATE TABLE IF NOT EXISTS votes (id VARCHAR(255) NOT NULL UNIQUE, vote VARCHAR(255) NOT NULL, created_at timestamp default NULL)'"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little ugly maybe... I guess adding a script to the postgres container wouldn't make much sense, but what about making a basic migration module, or adding a script to one of the service containers?
port: interface | ||
ports: | ||
- name: interface | ||
protocol: TCP | ||
containerPort: 80 | ||
dependencies: | ||
- redis | ||
tests: | ||
- name: unit | ||
command: [echo ok] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment here would be nice (just explain that we're demonstrating how to define tests, and less how to write unit tests). Also, should be [echo, ok]
, note the comma.
|
||
// app.use('/result', express.static(__dirname + '/views')); | ||
|
||
// app.get('/result', function (req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up commented lines (unless these are used to debug or something?)
ports: | ||
- name: ui | ||
protocol: TCP | ||
containerPort: 80 | ||
tests: | ||
- name: integ | ||
command: [echo ok] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be really good to have actual integ tests
examples/vote/README.md
Outdated
|
||
### View Results | ||
|
||
open http://vote.local.app.garden/result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this accurate?
ingresses: | ||
- path: / | ||
port: http | ||
hostname: frontend.local.app.garden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the naming maybe a little confusing? vote
, results
and frontend
... From the outside I'd expect vote
to be the voting UI, results
to be the results UI and then "frontend" would be...? Either needs explanation or a little more clarity in the naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments/questions. Not all super important, but at least some of them should be fixed before merging.
3990099
to
1e619fe
Compare
1e619fe
to
3990099
Compare
080acf6
to
f1cd740
Compare
examples/vote/garden.sh
Outdated
@@ -0,0 +1,2 @@ | |||
#!/bin/bash | |||
GARDEN_ENABLE_SERVER=1 garden dev --hot-reload=vote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also include GARDEN_SERVER_PORT=9777
also please do #!/bin/bash -e
:)
87ac26e
to
3de6fa6
Compare
* Renamed the multi-container example to vote. * Allow multiple votes per session. * Added front-end service and basic README. * Add missing service dependencies to the relevant modules' config. * Added a health check to the db (postgres) service, and moved the table creation to a task. Removed logic from jworker accordingly.
Need to squash before we merge.