-
Notifications
You must be signed in to change notification settings - Fork 92
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
Added Procfile to repository root #402
Conversation
☑️ Voting procedure reminder:To cast a vote, post a comment containing 👍 All comments within this discussion are searched for votes, regardless of the time of posting. A decision will be made after this PR has been open for 15 minutes (plus/minus 10 percent, to avoid people timing their votes), and at least 8 votes have been made. NOTE: the PR will be closed if any new commits are added after: |
👍 |
Is there a node process manager that we can use instead of depending on Ruby? |
Just found one. https://github.com/strongloop/node-foreman. |
....damm. 'If your processes exit, Node Foreman will assume an error has ocurred and shut your application down.' |
Just tested it. node-foreman does indeed start the bot successfully. The problem of the entire app terminating when a process exits will need to be dealt with however. |
👍 |
Does it only assume it was bad if process.exit() returned a non-zero error code? We can just return 0 whenever we want to restart |
Hmm. Let me see if I can look at the code and see. |
Apparently not. See: |
What if we moved some logic into |
so essentially, make launcher.js the supervisor of main.js and launch that from the Procfile instead? |
Yes, but I don't know whether we even need the Procfile or Foreman at that point. |
You have a fair point. However, were we to add something requiring an additional (I'm going to use Redis as an example as I plan to add Redis support shortly) it'd be easier to add an additional line in the Procfile rather than ensure the service is started manually or by the system's init daemon. That would apply mostly to development but also has effects on production. |
Sounds like a good setup then. |
Should I close and reroll then? |
That'd be great. I'd say our new solution should hit all the points. |
Is the plan (1) to have a /foreman http endpoint that lists foreman processes the bot has started, state of the processes (for example "show processlist" in mysql) (2) allow the bot to start and stop services through irc? "anythingbot, start redis", "anythingbot stop mysql" (3) start, restart, and stop services by PR |
@dbpokorny I hadn't thought of that. That would obviously require the reroll of this to be merged though. Some of those might be difficult though, depending on which implementation of foreman is used (I think they might have some differences) |
@samis I don't see what choice there is to make? https://www.npmjs.com/package/foreman |
@dbpokorny Good choice. I'll go see which of your ideas might be difficult to use with that package. |
The 'restart' bit will require either using a fork, or for a pull request to get merged. also, that will either need a global install (requires root) or modifying the PATH to include the path to node-foreman. Additionally, listing processes is not inbuilt into node-foreman but could likely be achieved by parsing the output of node-foreman. |
@samis I'm not familiar with this, but I trust your judgement (like I have a choice lol :-) |
Fair enough. Closing now to reroll. |
This adds a simple Procfile to the root of the repository, allowing the tool 'foreman' to be used to stop/start the bot. Aside from providing prettier console output, it will make it easier to manage the bot if it ever becomes multi-process (e.g a Redis server or a component written in another language)