0-vortex / catsup-app

This app will share good first issues.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Open Sauced

πŸ• Open Sauced Catsup App πŸ•

The path to your next Open Source contribution

Release Compliance CodeQL GitHub code size in bytes GitHub commit activity GitHub issues GitHub Release Discord Twitter

πŸ“– Prerequisites

In order to run the project locally we need node>=16 and npm>=8 installed on our development machines.

πŸ–₯️ Local development

To install the application:

npm ci

Befor you can run the application we need to start the smee proxy:

npm run proxy

To start a local copy of the app on port 3000:

npm start

The preconfigured app is of almost no use to anyone as it can only be installed by the preconfigured user and send webhooks to a dead server.

It is quite possible that some of the secrets are rendered invalid as well. THey serve as placeholders and should be replaced with values provided by your testing app.

πŸ“¦ Deploy to production

Cloudflare account

Set up a cloudflare account and enable workers, change account_id in wrangler.toml to your account id.

Go to your workers dashboard and create a new worker, select any template, adjust name in wrangler.toml if it is taken.

Select the "Settings" tab on your newly created worker and click "Variables", add the following placeholders for now:

  • APP_ID
  • APP_PK
  • DISCORD_URL
  • CLIENT_ID
  • CLIENT_SECRET
  • WEBHOOK_SECRET

Note: At the very end of this process you will have to encrypt all the values for the publish command to work.

Copy the "Routes" URL provided by the worker for the next part.

GitHub App

Create a new GitHub application with scopes issues:write and metadata:read while also enabling tracking events.

Upon creation you should have plain-text values for APP_ID, CLIENT_ID.

Add the following secrets to your Cloudflare worker like so:

wrangler secret put APP_ID

Add the remaingin variables using the same CLI command

Click the "Generate a new client secret" button and copy the value of CLIENT_SECRET.

In the webhook return URL copy the value of your worker route as described in the last step of the Cloudflare setup.

It is advised you generate the WEBHOOK_SECRET using the following command:

# random key strokes can work too if you don't have ruby(??)
ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'

Now, go to the very bottom and click "Generate a new private key" and open a terminal in the location of the downloaded file.

Rename this file to private-key.pem for the next command to work:

openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in private-key.pem -out private-key-pkcs8.key

Copy the contents of private-key-pkcs8.key to APP_PK. Note the string will need to be on one line joined with \n.

Discord

Go to your server of choice, click "Settings" and then "Integrations", create a new webhook and copy the URL and paste that value into DISCORD_URL.

Now you are good to use the wrangler release workflows and deploy to production!

Terminal publish

Login to cloudflare with your account credentials, advised you let the browser open an OAuth dialog with:

npm run wrangler -- login

Now you can test all the variables are correct by publishing from the terminal:

# npm run wrangler -- publish
npm run deploy

Open up a production real time log using:

npm run wrangler -- tail

CI publish

Create a new GitHub actions secrets named CF_API_TOKEN, get its value from Cloudflare's create a new token using the "Edit Cloudflare Workers" template.

Push new code to the server, after a release the new code should be sent to the server and instantly propagate.

🀝 Contributing

We encourage you to contribute to Open Sauced! Please check out the Contributing guide for guidelines about how to proceed.

πŸ• Community

Got Questions? Join the conversation in our Discord.
Find Open Sauced videos and release overviews on our YouTube Channel.

🎦 Repository Visualization

Visualization of this repository

βš–οΈ LICENSE

MIT Β© Open Sauced

About

This app will share good first issues.

License:ISC License


Languages

Language:JavaScript 100.0%