Skip to content

Commit

Permalink
Change the env vars and deployment paths
Browse files Browse the repository at this point in the history
  • Loading branch information
emedvedev committed Oct 23, 2017
1 parent 649b27e commit d7a959f
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
@@ -1,3 +1,3 @@
module.exports = { module.exports = {
"extends": "airbnb-base" "extends": "airbnb-base"
}; }
7 changes: 1 addition & 6 deletions Dockerfile
@@ -1,11 +1,6 @@
FROM node:alpine FROM node:alpine

ADD . /srv/www ADD . /srv/www

WORKDIR /srv/www WORKDIR /srv/www

RUN npm install --unsafe-perm RUN npm install --unsafe-perm


EXPOSE 8080 CMD ./bin/slackin --coc "$SLACKIN_COC" --channels "$SLACKIN_CHANNELS" $SLACK_SUBDOMAIN $SLACK_API_TOKEN

CMD ./bin/slackin --coc "$SLACK_COC" --channels "$SLACK_CHANNELS" --port $APP_PORT $SLACK_SUBDOMAIN $SLACK_API_TOKEN $GOOGLE_CAPTCHA_SECRET $GOOGLE_CAPTCHA_SITEKEY
2 changes: 1 addition & 1 deletion Procfile
@@ -1 +1 @@
web: bin/slackin --coc "$SLACK_COC" --channels "$SLACK_CHANNELS" --port $PORT $SLACK_SUBDOMAIN $SLACK_API_TOKEN $GOOGLE_CAPTCHA_SECRET $GOOGLE_CAPTCHA_SITEKEY web: bin/slackin --coc "$SLACKIN_COC" --channels "$SLACKIN_CHANNELS" $SLACK_SUBDOMAIN $SLACK_API_TOKEN
38 changes: 29 additions & 9 deletions app.json
@@ -1,8 +1,8 @@
{ {
"name": "Slackin", "name": "slackin-extended",
"description": "Let people invite themselves to your Slack", "description": "Let people invite themselves to your Slack",
"logo": "https://i.imgur.com/odDO1Fx.png", "logo": "https://i.imgur.com/odDO1Fx.png",
"repository": "https://github.com/rauchg/slackin", "repository": "https://github.com/emedvedev/slackin-extended",
"keywords": ["node", "slack"], "keywords": ["node", "slack"],
"env": { "env": {
"SLACK_SUBDOMAIN": { "SLACK_SUBDOMAIN": {
Expand All @@ -13,21 +13,41 @@
"description": "A Slack API token (find it on https://api.slack.com/web)", "description": "A Slack API token (find it on https://api.slack.com/web)",
"required": true "required": true
}, },
"GOOGLE_CAPTCHA_SECRET": { "RECAPTCHA_SECRET": {
"description": "Google captcha secret key", "description": "Google captcha secret key",
"required": true "required": false
}, },
"GOOGLE_CAPTCHA_SITEKEY": { "RECAPTCHA_SITEKEY": {
"description": "Google captcha site key", "description": "Google captcha site key",
"required": true "required": false
}, },
"SLACK_COC": { "RECAPTCHA_INVISIBLE": {
"description": "Use invisible reCAPTCHA instead of reCAPTCHA v2",
"required": false
},
"SLACKIN_COC": {
"description": "A URL to a Code of Conduct people must agree on before joining.", "description": "A URL to a Code of Conduct people must agree on before joining.",
"required": false "required": false
}, },
"SLACK_CHANNELS": { "SLACKIN_CHANNELS": {
"description": "Comma-separated list of single guest channels to invite them to (leave blank for a normal, all-channel invite). In order to make this work, you have to have a paid account. You'll only be able to invite as many people as your number of paying members times 5.", "description": "Comma-separated list of single guest channels to invite them to (leave blank for a normal, all-channel invite). In order to make this work, you have to have a paid account. You'll only be able to invite as many people as your number of paying members times 5.",
"required": false "required": false
} },
"SLACKIN_INTERVAL": {
"description": "How frequently (ms) to poll Slack",
"required": false
},
"SLACKIN_ANALYTICS": {
"description": "Google Analytics ID",
"required": false
},
"SLACKIN_THEME": {
"description": "Color scheme to use, \"light\" (default) or \"dark\"",
"required": false
},
"SLACKIN_ACCENT": {
"description": "Accent color to use instead of a theme default",
"required": false
},
} }
} }
2 changes: 1 addition & 1 deletion app.yaml
Expand Up @@ -2,7 +2,7 @@ env: flex
runtime: custom runtime: custom
env_variables: env_variables:
FQDN: "your.slackin.subdomain.com" FQDN: "your.slackin.subdomain.com"
APP_PORT: "8080" SLACKIN_PORT: "8080"
SLACK_INTERVAL: "25000" SLACK_INTERVAL: "25000"
SLACK_SUBDOMAIN: "your-slack-workspace" SLACK_SUBDOMAIN: "your-slack-workspace"
SLACK_API_TOKEN: "your-slack-api-token" SLACK_API_TOKEN: "your-slack-api-token"
Expand Down
4 changes: 2 additions & 2 deletions azuredeploy.json
Expand Up @@ -99,8 +99,8 @@
"SLACK_SUBDOMAIN": "[parameters('slackTeamId')]", "SLACK_SUBDOMAIN": "[parameters('slackTeamId')]",
"SLACK_API_TOKEN": "[parameters('slackApiToken')]", "SLACK_API_TOKEN": "[parameters('slackApiToken')]",
"SLACKIN_RELEASE": "[parameters('slackinRelease')]", "SLACKIN_RELEASE": "[parameters('slackinRelease')]",
"WEBSITE_NPM_DEFAULT_VERSION": "3.3.12", "WEBSITE_NPM_DEFAULT_VERSION": "5.4.2",
"WEBSITE_NODE_DEFAULT_VERSION": "5.1.1", "WEBSITE_NODE_DEFAULT_VERSION": "8.7.0",
"command": "bash scripts/azuredeploy.sh" "command": "bash scripts/azuredeploy.sh"
} }
}, },
Expand Down
5 changes: 3 additions & 2 deletions lib/index.js
Expand Up @@ -29,6 +29,7 @@ export default function slackin({
path = '/', path = '/',
recaptcha, recaptcha,
silent, silent,
analytics,
...params ...params
}) { }) {
// must haves // must haves
Expand Down Expand Up @@ -122,7 +123,7 @@ export default function slackin({
return res return res
.type('html') .type('html')
.render('main', { .render('main', {
coc, path, name, org, logo, channels, active, total, recaptcha, css, theme, coc, path, name, org, logo, channels, active, total, recaptcha, css, theme, analytics,
}); });
}); });


Expand Down Expand Up @@ -208,7 +209,7 @@ export default function slackin({
} }
res.type('html'); res.type('html');
res.render('main', { res.render('main', {
coc, path, name, org, channels, active, total, large, recaptcha, theme, iframe: true, coc, path, name, org, channels, active, total, large, recaptcha, theme, analytics, iframe: true,
}); });
}); });


Expand Down
4 changes: 1 addition & 3 deletions package.json
Expand Up @@ -79,9 +79,7 @@
], ],
"env": [ "env": [
"SLACK_API_TOKEN", "SLACK_API_TOKEN",
"SLACK_SUBDOMAIN", "SLACK_SUBDOMAIN"
"GOOGLE_CAPTCHA_SECRET",
"GOOGLE_CAPTCHA_SITEKEY"
] ]
} }
} }
12 changes: 6 additions & 6 deletions readme.md
Expand Up @@ -14,15 +14,15 @@ Check out the [Demo](https://slackin.now.sh/) or read more about the [motivation
Set up [Now](https://zeit.co/now) on your device and run this command. [Now](https://zeit.co/now) will automatically ask you for the required information and then spin up a deployment instantly. That easy! Set up [Now](https://zeit.co/now) on your device and run this command. [Now](https://zeit.co/now) will automatically ask you for the required information and then spin up a deployment instantly. That easy!


```bash ```bash
now rauchg/slackin now emedvedev/slackin-extended
``` ```


Other platforms: Other platforms:


- [Heroku](https://heroku.com/deploy?template=https://github.com/rauchg/slackin/tree/master) - [Heroku](https://heroku.com/deploy?template=https://github.com/emedvedev/slackin-extended/tree/master)
- [Azure](https://azuredeploy.net/) - [Azure](https://azuredeploy.net/)
- [OpenShift](https://github.com/rauchg/slackin/wiki/OpenShift) - [OpenShift](https://github.com/rauchg/slackin/wiki/OpenShift)
- [IBM Bluemix](https://bluemix.net/deploy?repository=https://github.com/rauchg/slackin) - [IBM Bluemix](https://bluemix.net/deploy?repository=https://github.com/emedvedev/slackin-extended)


### Tips ### Tips


Expand Down Expand Up @@ -59,7 +59,7 @@ sitekey](https://www.google.com/recaptcha/admin) for Google reCAPTCHA.
Loading `slackin` will return a `Function` that creates a `HTTP.Server` instance: Loading `slackin` will return a `Function` that creates a `HTTP.Server` instance:


```js ```js
const slackin = require('slackin') const slackin = require('slackin-extended')


slackin.default({ slackin.default({
token: 'yourtoken', // required token: 'yourtoken', // required
Expand All @@ -78,8 +78,8 @@ All the metadata for your organization can be fetched via a JSON HTTP request to
## Caught a Bug? ## Caught a Bug?


1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device 1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
2. Uninstall slackin if it's already installed: `npm uninstall -g slack` 2. Uninstall slackin if it's already installed: `npm uninstall -g slackin-extended`
3. Link it to the global module directory: `npm link` 3. Link it to the global module directory: `npm link`
4. Transpile the source code and watch for changes: `npm start` 4. Transpile the source code and watch for changes: `npm start`


Yey! Now can use the `slack` command everywhere. Yey! Now can use the `slackin` command everywhere.
14 changes: 7 additions & 7 deletions scripts/azuredeploy.sh
Expand Up @@ -81,7 +81,7 @@ selectNodeVersion () {
NODE_EXE=`cat "$DEPLOYMENT_TEMP/__nodeVersion.tmp"` NODE_EXE=`cat "$DEPLOYMENT_TEMP/__nodeVersion.tmp"`
exitWithMessageOnError "getting node version failed" exitWithMessageOnError "getting node version failed"
fi fi

if [[ -e "$DEPLOYMENT_TEMP/.tmp" ]]; then if [[ -e "$DEPLOYMENT_TEMP/.tmp" ]]; then
NPM_JS_PATH=`cat "$DEPLOYMENT_TEMP/__npmVersion.tmp"` NPM_JS_PATH=`cat "$DEPLOYMENT_TEMP/__npmVersion.tmp"`
exitWithMessageOnError "getting npm version failed" exitWithMessageOnError "getting npm version failed"
Expand Down Expand Up @@ -114,12 +114,12 @@ echo Deploying Slackin: $SLACKIN_RELEASE


if [[ "$SLACKIN_RELEASE" == "stable" ]]; then if [[ "$SLACKIN_RELEASE" == "stable" ]]; then
# Stable # Stable
echo Installing from npm echo Installing from npm

cd "$DEPLOYMENT_TARGET" cd "$DEPLOYMENT_TARGET"

# 1. Install latest release of slackin from npm # 1. Install latest release of slackin from npm
eval $NPM_CMD install slackin eval $NPM_CMD install slackin-extended


# 2. Copy to root folder # 2. Copy to root folder
cp -rv node_modules/slackin/* . cp -rv node_modules/slackin/* .
Expand All @@ -130,12 +130,12 @@ else
# Latest (from git repo) # Latest (from git repo)
echo Installing from git repo echo Installing from git repo


# 1. KuduSync # 1. KuduSync
if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then
"$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh" "$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh"
exitWithMessageOnError "Kudu Sync failed" exitWithMessageOnError "Kudu Sync failed"
fi fi

# 2. Install npm packages # 2. Install npm packages
if [ -e "$DEPLOYMENT_TARGET/package.json" ]; then if [ -e "$DEPLOYMENT_TARGET/package.json" ]; then
echo npm install echo npm install
Expand Down

0 comments on commit d7a959f

Please sign in to comment.