Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
tantalic committed Feb 24, 2016
0 parents commit 0c4c21e
Show file tree
Hide file tree
Showing 11 changed files with 690 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.service
build/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Kevin Stock

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
build: bindata-assetfs
go build

bindata-assetfs:
go-bindata-assetfs assets

run:
go-bindata-assetfs -debug assets
go run *.go

install: bindata-assetfs
go install

osx: bindata-assetfs
env GOOS=darwin GOARCH=amd64 go build -o build/hackbellingham-darwin_amd64
env GOOS=darwin GOARCH=386 go build -o build/hackbellingham-darwin_386

linux: bindata-assetfs
env GOOS=linux GOARCH=amd64 go build -o build/hackbellingham-linux_amd64
env GOOS=linux GOARCH=386 go build -o build/hackbellingham-linux_386

freebsd: bindata-assetfs
env GOOS=freebsd GOARCH=amd64 go build -o build/hackbellingham-freebsd_amd64
env GOOS=freebsd GOARCH=386 go build -o build/hackbellingham-freebsd_386

all: osx linux freebsd
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# HackBellingham.com

## About Hack Bellingham
Hack Bellingham is a social group dedicated to growing the local developer community.

We are committed to providing a friendly, safe and welcoming environment for experienced and aspiring technologists, regardless of age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.

## About
The primary purpose of this site is to automate the process for members to join the Hack Bellingham Slack team.

## Building and Running
The website is built using [Go][go] and is 'go gettable'. Once you have your go environment setup you can get dependencies by running:
```sh
go get
```

Once you have dependencies installed you can build for your current platform by running:
```sh
make
```

To run for development purposes run:
```sh
make run
```

To cross-compile to another platform run one of the following:
```sh
make linux
make freebsd
make osx
```

## Running (in Production)
Running the site will require the setting of a number of options. These options can be set via command line flags or environment variables.

| Environment Variable | Flag | Description | Default Value |
|--------------------------------|-----------------|------------------------------------------------------------------------------------------|---------------|
| `$HACK_BELLINGHAM_PORT` | `--port` | The TCP port to listen on. | `3000` |
| `$HACK_BELLINGHAM_HOST` | `--host` | The IP address/hostname to listen on. | All hosts |
| `$HACK_BELLINGHAM_SLACK_TEAM` | `--slack-team` | Slack team name, as found in the slack URL. | `""` |
| `$HACK_BELLINGHAM_SLACK_TOKEN` | `--slack-token` | Access token for your slack team. It can be generated at https://api.slack.com/web#auth. | `""` |

### systemd Configuration
The canonical way to run the site is through the [`systemd`][systemd] service manager to setup the environment, manage when the application is started, and monitor the process to keep it running. This can be done with a system file like the one below:

. The following

```apacheconf
[Unit]
Description=Hack Bellingham Website
[Service]
ExecStart=/usr/local/bin/hackbellingham
Restart=always
User=root
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=hackbellingham
Environment=HACK_BELLINGHAM_PORT=80
Environment=HACK_BELLINGHAM_SLACK_TEAM=hackbellingham
Environment=HACK_BELLINGHAM_SLACK_TOKEN=XXXX-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXXXXX
[Install]
WantedBy=multi-user.target
```


[go]: http://www.golang.org
[systemd]: https://freedesktop.org/wiki/Software/systemd/
146 changes: 146 additions & 0 deletions assets/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html>
<head>
<title>Hack Bellingham</title>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,300' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
html, body {
max-width: 840px;
margin: 0 auto;
padding: 10px 20px 20px;
font-family: 'Roboto Slab', Arial, serif;
font-weight: 300;
font-size: 36px;
background-color: white;
color: rgb(20,20,20);
}
#logo {
width: 400px;
max-width: 94%;
margin: .5em 0;
}
h1, h2 {
font-weight: 400;
font-size: 1em;
font-size: 1rem;
}
h2 {
font-weight: 300;
}
input, button {
font-size: .8em;
font-size: .8rem;
font-family: 'Roboto Slab', Arial, serif;
}
input {
width: 93.25%;
padding: 2.25% 1.125%;
}
button {
border-radius: 1.5em;
border-style: none;
color: white;
background-color: rgb(60, 171, 99);
margin-top: .5em;
padding: .5em 1em;

transition: width .75s, height .75s, background-color .75s;
}
button:hover {
cursor: pointer;
}
button:disabled {
background-color: rgba(53,74,93,.5);
cursor: wait;
}

.success, .failure {
background-color: rgba(60, 171, 99, .2);
border: 1px solid rgb(60, 171, 99);
color: rgb(60, 171, 99);
padding: 0 1em;
}

.failure {
background-color: rgb(241, 222, 222);
border-color: rgb(195, 29, 70);
color: rgb(195, 29, 70);
}

@media (max-width:600px) {
html, body {
font-size: 28px;
}
}

@media (max-width:400px) {
html, body {
font-size: 20px;
}
}

</style>
</head>
<body>
<header>
<img id="logo" src="logo.svg">
</header>

<main>

<h1>Hack Bellingham is a social group dedicated to growing the local developer community.</h1>

<p>We are committed to providing a friendly, safe and welcoming environment for experienced and aspiring technologists, regardless of age, disability, gender, nationality, race, religion, sexuality, or similar personal characteristic.</p>

<div id="status-message"></div>

<div id="slack-form">
<h2>Join us on Slack:</h2>
<input type="text" placeholder="email address" id="email-address" autofocus>
<button onclick="requestInvite();" id="invite-button">Send me an invite</button>
</div>

</main>

<script type="text/javascript">
function requestInvite() {
var button = document.getElementById("invite-button"),
originalLabel = button.innerHTML;

button.disabled = true;
button.innerHTML = "Requesting an invite...";

var xhr = new XMLHttpRequest();
xhr.open('POST', encodeURI('request-invite'));
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({
email: document.getElementById("email-address").value
}));


xhr.onload = function() {
var statusMessage = document.getElementById("status-message"),
slackForm = document.getElementById("slack-form");

if (xhr.status === 200) {
statusMessage.className = "success"
statusMessage.innerHTML = "<p>Your invitation has been sent. Please check your email.</p>";

slackForm.parentNode.removeChild(slackForm);

}
else {
statusMessage.className = "failure"
statusMessage.innerHTML = "<p>There was an error processing your invitation. Please try again later.</p>";

button.disabled = false;
button.innerHTML = originalLabel;
}
};
xhr.send();
}
</script>

</body>
</html>
1 change: 1 addition & 0 deletions assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0c4c21e

Please sign in to comment.