Skip to content
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

Merged
merged 1 commit into from
Dec 17, 2018
Merged

Vote example #428

merged 1 commit into from
Dec 17, 2018

Conversation

eysi09
Copy link
Collaborator

@eysi09 eysi09 commented Dec 9, 2018

Need to squash before we merge.

@@ -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.
Copy link
Collaborator

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>
Copy link
Collaborator

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)'"]
Copy link
Collaborator

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]
Copy link
Collaborator

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) {
Copy link
Collaborator

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]
Copy link
Collaborator

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


### View Results

open http://vote.local.app.garden/result
Copy link
Collaborator

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
Copy link
Collaborator

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.

Copy link
Collaborator

@edvald edvald left a 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.

@eysi09 eysi09 force-pushed the vote-example branch 3 times, most recently from 3990099 to 1e619fe Compare December 10, 2018 23:23
@eysi09 eysi09 force-pushed the vote-example branch 2 times, most recently from 080acf6 to f1cd740 Compare December 11, 2018 14:57
@edvald edvald changed the title [WIP] Vote example Vote example Dec 11, 2018
@@ -0,0 +1,2 @@
#!/bin/bash
GARDEN_ENABLE_SERVER=1 garden dev --hot-reload=vote
Copy link
Contributor

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 :)

@edvald edvald force-pushed the vote-example branch 2 times, most recently from 87ac26e to 3de6fa6 Compare December 17, 2018 19:54
* 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.
@edvald edvald merged commit 5ba2c6d into master Dec 17, 2018
@edvald edvald deleted the vote-example branch December 17, 2018 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants