Skip to content

Latest commit

 

History

History
90 lines (57 loc) · 3.95 KB

README.md

File metadata and controls

90 lines (57 loc) · 3.95 KB

Icon Reddit Poster

Reddit JavaScript NodeJS

A bot for 🐦 auto-posting to Reddit.

🏁 Getting Started

  1. Clone the repository:

    cd some/where
    git clone https://github.com/Ambratolm/reddit-poster.git
    cd reddit-poster
  2. Install the dependencies:

    npm i
  3. Install Nodemon globally:

    npm i -g nodemon
  4. Run the bot for development:

    npm run dev

✈️ Deployment

💡 During development, the environment variables are automatically retrieved from the .env file and registred in the process.env object for access in code.
💡 Use the provided .env-tmp file as a reference to make your own personal .env file.
💡 It is advised to not push the .env file in production repository, because it contains sensible and confidential data. So, either delete it or add it to .gitignore.

To deploy the project in a node environment:

  1. Push the repository to a node production server using a service like Heroku.

    💡 For Heroku, see: Deploying Node.js Apps on Heroku.

    💡 As this is not an HTTP Web app, but more like a worker process, the service should be set to run it as worker process.
    💡 To do it in Heroku, using the Heroku CLI, run heroku ps:scale web=0 worker=1 -a app-name .
    💡 worker corresponds to the name given in the Procfile file and can be renamed to anything (Unlike web, which is reserved for the Web process only).

  2. Manually register the environment variables in the node production server.

    💡 For Heroku, see: Configuration and Config Vars.

    💡 To do it in Heroku, using the Heroku CLI, run heroku config:set VARIABLE_NAME=value -a app-name for every variable to add.
    💡 Run heroku config -a app-name to view all variables.

    💡 To do it in Heroku, using the Heroku Dashboard, go to the app's Settings / Config Vars.

  3. Install the dependencies and Start the bot for production:

    💡 In Heroku, this can be done automatically everytime after pushing the repository.

    npm i && npm start

💡 In Heroku, to browse the deployed app files and folders, using the Heroku CLI, run heroku run bash -a app-name to access a terminal on the server.
💡 In the remote terminal, you can run dir to display the current directory, cd dir-name to change the directory, and cat file-name to display the content of a text file. For more, see: Bash Shell Reference.

🚀 Development

🏭 Environment

🌑 Backend

📃 License