Skip to content

Commit

Permalink
docs: add better heroku documentation (#2942)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-nolant authored Feb 14, 2022
1 parent a146ea3 commit f344615
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/streetmerchant-herokuapp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/streetmerchant-herokudynos.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 86 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,89 @@ docker-compose down
```

Replace `<WEB_PORT>` with the value you gave in your `dotenv`.

### Developing in Heroku

#### Prerequisites

- [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli)
- You will need a [Heroku Account](https://signup.heroku.com).
- [GIT](https://git-scm.com)
- Make sure the PATH is set correctly, so you can use it in you command line.
- [StreetMerchant](https://github.com/jef/streetmerchant)
- If you don't already have it.

#### Starting with File correction

1. Make a copy of `dotenv-example` and name it `dotenv`.
1. Edit the `dotenv` file to your liking using a text editor (like [VSCode](https://code.visualstudio.com/) or even Notepad).
1. Find the option `OPEN_BROWSER` and set it to `OPEN_BROWSER=false`
1. After this, I recommend you setup some form of contacting your directly in the dotenv file as well.
2. This can be phone, email, or whatever you'd want. The information won't be public.
3. Save and close file.
1. Locate the `.gitignore` file and open it.
1. Remove `build/` and `dotenv`.
2. Save and close file.
1. Locate the `package.json` file and open it.
1. Locate the `"posttest"` config.
1. Under it, paste:</br>
<pre><code>"postinstall": "npm run tsc",</br>
"tsc": "tsc",</code></pre>
1. Create a file called `Procfile` with no type declaration(.txt/.doc/.etc.)
1. Open it with Notepad
2. Paste: `worker: npm run start:production`
3. Close and save file
1. Navigate to `src/` and find the file `index.ts`
1. Open with IDE or Notepade
2. Find `const args: string[]`
1. Replace with:
<pre><code> const args: string[] = [
'--no-sandbox',
'--disable-setuid-sandbox'
c];</code></pre>
#### Setting up Heroku
```shell
# To start
# Open a terminal and navigate to the master street merchant directory
# From there start this
heroku login
# Follow the steps to login
```
1. Leave that terminal up, and go to your [Heroku apps](https://dashboard.heroku.com/apps)
2. Create a new app:

![IMAGEOFAPP](https://github.com/dev-nolant/streetmerchant/blob/main/docs/assets/images/streetmerchan-herokunewapp.jpg)

3. Name it, and then click `Create App`

![IMAGEOFCREATE](https://github.com/dev-nolant/streetmerchant/blob/main/docs/assets/images/streetmerchant-herokuapp.jpg)

4. Go to `Settings` and add two buildpacks
1. `heroku/nodejs`
2. `https://github.com/jontewks/puppeteer-heroku-buildpack`

It should look like:
![IMAGEOFBUILDPACKS](https://github.com/dev-nolant/streetmerchant/blob/main/docs/assets/images/streetmerchant-herokubuildpacks.png)

#### Terminal setup
Back to the terminal that you left open.
1. Type `git init`
2. Once that finishes copy and paste: `heroku git:remote -a YOURAPPNAME` but make sure `YOURAPPNAME` is whatever you named your app on Heroku.
3. Then type `git add .`
4. Once that finishes paste `git commit -am "COMMITMESSAGE"`, replacing `COMMITMESSAGE` with whatever commit message you'd like. This doesn't matter much.
5. The last thing to do in the terminal is to push your repo to Heroku
1. Paste `git push heroku master`
1. This will take a while
#### Final steps
1. On your Heroku app, click on the tab `Resources`

You should see this:
![IMAGEOFRESOURCES](https://github.com/dev-nolant/streetmerchant/blob/main/docs/assets/images/streetmerchant-herokudynos.jpg)

2. Click the pen icon on both to edit their states.
3. Turn off `web npm start`
4. Turn on `worker npm run start:production`
5. Click confirm on both.
6. Now you're essentially done!
1. I recommend you click on the `more` dropdown and click `logs` to make sure everything is running smoothly.
2. If you set up notifications, you will be notified when you criterias are met(3060 in stock, etc.), otherwise you'll have to keep your eyes on the `logs` tab

0 comments on commit f344615

Please sign in to comment.