[Docs] Mac/Windows autostart docs #2726

Closed
palmtree5 wants to merge 19 commits from V3/docs/mac_win_autostart into V3/develop
palmtree5 commented 2019-05-23 12:44:39 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

Adds in Mac/Windows autostart docs. Gonna need to have someone actually test the instructions in the mac ones though seeing as I don't have a mac and came up with that plist based on reading docs

### Type - [ ] Bugfix - [x] Enhancement - [ ] New feature ### Description of the changes Adds in Mac/Windows autostart docs. Gonna need to have someone actually test the instructions in the mac ones though seeing as I don't have a mac and came up with that plist based on reading docs
tekulvw (Migrated from github.com) reviewed 2019-05-23 12:44:39 +02:00
Twentysix26 (Migrated from github.com) reviewed 2019-05-23 12:44:39 +02:00
palmtree5 commented 2019-11-08 05:33:35 +01:00 (Migrated from github.com)

Ok, NSSM docs have been added, though so far it only covers installing NSSM via Chocolatey and then the actual setup of the service. Service setup is written to be done in Powershell, not cmd (there's four spots that use syntax for Powershell, three of them I know for sure how to get the same behavior in cmd, the fourth (which involves using the output of one command as an argument in another) I'm not sure on replicating in cmd)

Ok, NSSM docs have been added, though so far it only covers installing NSSM via Chocolatey and then the actual setup of the service. Service setup is written to be done in Powershell, not cmd (there's four spots that use syntax for Powershell, three of them I know for sure how to get the same behavior in cmd, the fourth (which involves using the output of one command as an argument in another) I'm not sure on replicating in cmd)
Jackenmen (Migrated from github.com) reviewed 2019-11-08 06:29:06 +01:00
@ -0,0 +50,4 @@
.. code-block:: none
nssm install redbot $(Get-Command redbot).Definition <instance name> --no-prompt
Jackenmen (Migrated from github.com) commented 2019-11-08 06:28:57 +01:00

For this to work correctly with venv install, we should tell the user to activate venv before running this command.

For this to work correctly with venv install, we should tell the user to activate venv before running this command.
Vexed01 (Migrated from github.com) reviewed 2019-11-08 20:50:01 +01:00
Vexed01 (Migrated from github.com) left a comment

Just spotted a few errors 😄

Just spotted a few errors 😄
@ -0,0 +1,105 @@
.. windows service guide
Vexed01 (Migrated from github.com) commented 2019-11-08 20:43:39 +01:00

missing full stop

          If not, you may install it or follow the manual instructions for getting NSSM.
missing full stop ```suggestion If not, you may install it or follow the manual instructions for getting NSSM. ```
Vexed01 (Migrated from github.com) commented 2019-11-08 20:48:43 +01:00

When sphiux-build is run, this doesn't format correctly:
image
For reference here's my .html file:
#2726 html files.zip

When `sphiux-build` is run, this doesn't format correctly: ![image](https://user-images.githubusercontent.com/51716387/68506106-bf6e1500-0260-11ea-897a-c9cfe0e1a90f.png) For reference here's my `.html` file: [#2726 html files.zip](https://github.com/Cog-Creators/Red-DiscordBot/files/3827095/2726.html.files.zip)
Jackenmen (Migrated from github.com) reviewed 2019-12-17 16:49:23 +01:00
@ -0,0 +62,4 @@
nssm set redbot AppStopMethodConsole 10000
nssm set redbot AppRestartDelay 15000
nssm set redbot AppStdout $Env:USERPROFILE\red-stdout.log
nssm set redbot AppStderr $Env:USERPROFILE\red-stderr.log
Jackenmen (Migrated from github.com) commented 2019-12-17 16:49:23 +01:00

I think it would be better to use one log file for both stdout and stderr (nssm support that), it's easier to read like this.

I think it would be better to use one log file for both stdout and stderr (nssm support that), it's easier to read like this.
Jackenmen (Migrated from github.com) requested changes 2019-12-17 17:14:59 +01:00
@ -0,0 +24,4 @@
Manually installing NSSM
------------------------
Go to `<https://nssm.cc/download>`_ and download the latest release. Once the download
Jackenmen (Migrated from github.com) commented 2019-12-17 17:02:20 +01:00

It might be good to point at latest pre release (or at least pre-release build 2.2.4-101) as otherwise users may have problems with starting service on Windows 10 1703+. Technically we avoid this issue with AppNoConsole=1 but choco already installs that build anyway and this build also comes with handy nssm dump command that may help make certain things easier for Support Squad.
Update: From only 2 support cases, I already found nssm dump very valuable debug command that allows me to help people with nssm.

It might be good to point at latest **pre** release (or at least pre-release build 2.2.4-101) as otherwise users may have problems with starting service on Windows 10 1703+. Technically we avoid this issue with `AppNoConsole=1` but choco already installs that build anyway and this build also comes with handy `nssm dump` command that may help make certain things easier for Support Squad. Update: From only 2 support cases, I already found `nssm dump` very valuable debug command that allows me to help people with nssm.
@ -0,0 +81,4 @@
.. code-block:: none
nssm set redbot ObjectName $Env:COMPUTERNAME\$Env:USERNAME <password>
Jackenmen (Migrated from github.com) commented 2019-12-17 16:53:58 +01:00

I personally wouldn't want to put my password in cmd/powershell as part of a command (one of the reason being it saving in command history), I think there should at least be mentioned an alternative way to set that password through services.msc.

Another issue user may run into is having no password on the account - he won't be able to run service on an account with a blank password as it could be considered a security issue, see: https://stackoverflow.com/a/1048691
While we probably shouldn't provide solution for it, it might be worth mentioning in the document.

I personally wouldn't want to put my password in cmd/powershell as part of a command (one of the reason being it saving in command history), I think there should at least be mentioned an alternative way to set that password through `services.msc`. Another issue user may run into is having no password on the account - he won't be able to run service on an account with a blank password as it could be considered a security issue, see: <https://stackoverflow.com/a/1048691> While we probably shouldn't provide solution for it, it might be worth mentioning in the document.
Jackenmen commented 2019-12-17 17:24:15 +01:00 (Migrated from github.com)

One more thing about log files - I want to mention that there's also an option in nssm to rotate log files which might be worth enabling to avoid getting one very big log file, but I'm leaving that to reviewer of this PR.
I haven't looked closely at file rotation settings, so I'm not sure if there's an option to set max amount of those files before the old ones get removed.

One more thing about log files - I want to mention that there's also an option in nssm to rotate log files which might be worth enabling to avoid getting one very big log file, but I'm leaving that to reviewer of this PR. I haven't looked closely at file rotation settings, so I'm not sure if there's an option to set max amount of those files before the old ones get removed.
Jackenmen (Migrated from github.com) reviewed 2019-12-30 22:40:17 +01:00
@ -0,0 +81,4 @@
.. code-block:: none
nssm set redbot ObjectName $Env:COMPUTERNAME\$Env:USERNAME <password>
Jackenmen (Migrated from github.com) commented 2019-12-30 22:40:16 +01:00

A follow up on this, both powershell and cmd have certain characters that have to be escaped, currently provided solution assumes that user's password won't contain such characters. I think that a better solution here would be using something that will prompt for password, e.g:
nssm set redbot ObjectName $Env:COMPUTERNAME\$Env:USERNAME $(Read-Host "Password")

This one would still keep the password visible (as input("Password: ") does in Python), but it would at least always get the password right.

There is an option to replace password characters with asterixes in Read-Host by using -AsSecureString but it would result in this awfully wrong command (or at least I couldn't find a way to make this shorter in powershell):
nssm set redbot ObjectName $Env:COMPUTERNAME\$Env:USERNAME $([System.Net.NetworkCredential]::new("", $(Read-Host -AsSecureString "Password")).Password)

A follow up on this, both powershell and cmd have certain characters that have to be escaped, currently provided solution assumes that user's password won't contain such characters. I think that a better solution here would be using something that will prompt for password, e.g: `nssm set redbot ObjectName $Env:COMPUTERNAME\$Env:USERNAME $(Read-Host "Password")` This one would still keep the password visible (as `input("Password: ")` does in Python), but it would at least always get the password right. There is an option to replace password characters with asterixes in `Read-Host` by using `-AsSecureString` but it would result in this awfully wrong command (or at least I couldn't find a way to make this shorter in powershell): `nssm set redbot ObjectName $Env:COMPUTERNAME\$Env:USERNAME $([System.Net.NetworkCredential]::new("", $(Read-Host -AsSecureString "Password")).Password)`
palmtree5 (Migrated from github.com) reviewed 2019-12-31 04:27:45 +01:00
@ -0,0 +81,4 @@
.. code-block:: none
nssm set redbot ObjectName $Env:COMPUTERNAME\$Env:USERNAME <password>
palmtree5 (Migrated from github.com) commented 2019-12-31 04:27:44 +01:00

yeah, probably gonna take some testing on this one

yeah, probably gonna take some testing on this one
mikeshardmind commented 2020-01-08 01:53:02 +01:00 (Migrated from github.com)

This is being deferred until further work with making this user-friendly.

This is being deferred until further work with making this user-friendly.
Drapersniper commented 2020-01-19 23:09:05 +01:00 (Migrated from github.com)

We should also update this to use python -O -m redbot instead of just redbot (to go in line with the rest of the docs)

We should also update this to use `python -O -m redbot` instead of just `redbot` (to go in line with the rest of the docs)
aikaterna commented 2020-06-26 15:14:15 +02:00 (Migrated from github.com)

If we have any other Mac users willing to test the plist file I would appreciate feedback as well. When I used it back when originally testing this, I recieved Error 2's while trying to have it autostart (usually representative of "file not found", but could also be something else, even though I pointed it at the correct redbot executable). The only other testing I have seen related to this in the Red server was a user in support at https://discord.com/channels/133049272517001216/387398816317440000/668614855397212170 who recieved a permissions error while trying to run the sudo command - not sure if it was a password issue or a true perms issue. Iirc I didn't run into permissions trouble when I tried this in Dec 19 and again in Februrary but it's something to be aware of.

If we have any other Mac users willing to test the plist file I would appreciate feedback as well. When I used it back when originally testing this, I recieved Error 2's while trying to have it autostart (usually representative of "file not found", but could also be something else, even though I pointed it at the correct redbot executable). The only other testing I have seen related to this in the Red server was a user in support at https://discord.com/channels/133049272517001216/387398816317440000/668614855397212170 who recieved a permissions error while trying to run the sudo command - not sure if it was a password issue or a true perms issue. Iirc I didn't run into permissions trouble when I tried this in Dec 19 and again in Februrary but it's something to be aware of.
palmtree5 commented 2020-07-18 06:38:44 +02:00 (Migrated from github.com)

Superseded by #4081 and #4082 (splitting the OSes up)

Superseded by #4081 and #4082 (splitting the OSes up)

Pull request closed

Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!2726
No description provided.