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

deploy to now #89

Merged
merged 3 commits into from
Sep 8, 2017
Merged

deploy to now #89

merged 3 commits into from
Sep 8, 2017

Conversation

gr2m
Copy link
Contributor

@gr2m gr2m commented Sep 7, 2017

Here are my notes on how to make it work, it’s not as simple as I initially thought :)

  1. Create a new now account
    Make a dedicated account for each open source application you want to deploy, as the free account is limited to 3 instances only. Sign up/in at https://zeit.co/login (leave page open, click the link on the email, go back to the tab where you entered your email).
  2. create a new token at https://zeit.co/account/tokens
  3. Set the token in Travis’ repository settings as NOW_TOKEN
  4. Now use the terminal so set secrets in your now account
    • now secret add app-id
    • now secret add webhook-secret
    • now secret add private-key
      To encode the private key from GitHub, run this command in the folder that you downloaded private-key.pem to: cat private-key.pem | base64 --input - | pbcopy. The base64 encoded private-key.pem is now in your clipboard, you can paste it into your terminal after now secret add private-key
  5. In your package.json file, create a new key “now”:
      "now": {
        "alias": “<your app name>“,
        "env": {
          "APP_ID": "@app-id",
          "NODE_ENV": "production",
          "PRIVATE_KEY": "@private-key",
          "WEBHOOK_SECRET": "@webhook-secret"
        }
      }
    
    <your app name> will end up as the sodomain of .now.sh.
  6. Also in your package.json file, create a new script key "now-start", next to the current "start" script
    "scripts": {
      "start": "probot run ./server.js",
      "now-start": "PRIVATE_KEY=$(echo $PRIVATE_KEY | base64 -d) npm start"
    },
    
  7. Create a file scripts/deploy.sh with this content
    #!/bin/sh
    now="npx now@7.1.1 --token=$NOW_TOKEN"
    $now --public
    $now alias
    $now rm --safe --yes wip-bot
    
  8. Make it executable with chmod +x scripts/deploy.sh
  9. Add to your .travis.yml file
    #!/bin/sh
    now="npx now@7.1.1 --token=$NOW_TOKEN"
    $now --public
    $now alias
    $now rm --safe --yes wip-bot
    
  10. That’s it :) When tests pass on master, your app will be deployed to now automagically

So after you merge this PR, watch the travis build logs at travis-ci.org/hoodiehq/first-timers-bot and wait for the deploy step. If all goes well, you should see the logs of the newly deployed version at https://first-timers-bot.now.sh/_logs (look for the timestamps) 🙏

Once that looks all good, you can change the Webhook URL URL to https://first-timers-bot.now.sh on the bot's app settings.

We can add deploy to Glitch separately in another PR

closes #79

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.

Deploy to Now
2 participants