3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-22 03:49:29 +01:00

pbot-vm: add PBOTVM_ADDR env var to set address of vm-server

This commit is contained in:
Pragmatic Software 2024-03-31 17:36:36 -07:00
parent 4df50dc340
commit 09aed30893
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
6 changed files with 19 additions and 14 deletions

View File

@ -61,6 +61,9 @@ For example, to connect securely via TLS to irc.libera.chat with botnick `coolbo
docker run --name pbot -ti -v $DATA_DIR:/opt/pbot/persist-data pbot irc.botnick=coolbot irc.server=irc.libera.chat irc.port=6697 irc.tls=1 docker run --name pbot -ti -v $DATA_DIR:/opt/pbot/persist-data pbot irc.botnick=coolbot irc.server=irc.libera.chat irc.port=6697 irc.tls=1
If you are using the pbot-vm virtual machine, be sure to add (after `-ti`) `-e PBOTVM_ADDR=$ADDR` where `$ADDR` is the IP address or hostname of the machine
where `vm-server` is running. See [Virtual Machine](../doc/VirtualMachine.md) for more information.
Follow the steps in [Additional configuration](../doc/QuickStart.md#additional-configuration) in the [QuickStart guide](../doc/QuickStart.md) Follow the steps in [Additional configuration](../doc/QuickStart.md#additional-configuration) in the [QuickStart guide](../doc/QuickStart.md)
to create your bot-admin account, add channels, etc. to create your bot-admin account, add channels, etc.

View File

@ -17,12 +17,13 @@ use strict;
use IO::Socket; use IO::Socket;
use constant { use constant {
SERVER_PORT => $ENV{PBOTVM_SERVER} // 9000, SERVER_ADDR => $ENV{PBOTVM_ADDR} // '127.0.0.1',
SERVER_PORT => $ENV{PBOTVM_PORT} // 9000,
}; };
# TODO: extend to take a list of server/ports to cycle for load-balancing # TODO: extend to take a list of server/ports to cycle for load-balancing
my $sock = IO::Socket::INET->new( my $sock = IO::Socket::INET->new(
PeerAddr => '127.0.0.1', PeerAddr => SERVER_ADDR,
PeerPort => SERVER_PORT, PeerPort => SERVER_PORT,
Proto => 'tcp' Proto => 'tcp'
); );

View File

@ -24,7 +24,7 @@ use Time::HiRes qw/gettimeofday/;
use Encode; use Encode;
use constant { use constant {
SERVER_PORT => $ENV{PBOTVM_SERVER} // 9000, SERVER_PORT => $ENV{PBOTVM_PORT} // 9000,
HEARTBEAT_PORT => $ENV{PBOTVM_HEART} // 5556, HEARTBEAT_PORT => $ENV{PBOTVM_HEART} // 5556,
DOMAIN_NAME => $ENV{PBOTVM_DOMAIN} // 'pbot-vm', DOMAIN_NAME => $ENV{PBOTVM_DOMAIN} // 'pbot-vm',
COMPILE_TIMEOUT => $ENV{PBOTVM_TIMEOUT} // 10, COMPILE_TIMEOUT => $ENV{PBOTVM_TIMEOUT} // 10,

View File

@ -21,15 +21,16 @@ Many commands can be configured with environment variables. If a variable is
not defined, a sensible default value will be used. not defined, a sensible default value will be used.
Environment variable | Default value | Description Environment variable | Default value | Description
--- | --- | --- -------------------- | ------------- | -----------
PBOTVM_DOMAIN | `pbot-vm` | The libvirt domain identifier PBOTVM_DOMAIN | `pbot-vm` | The libvirt domain identifier
PBOTVM_SERVER | `9000` | `vm-server` port for incoming `vm-client` commands PBOTVM_ADDR | `127.0.0.1` | `vm-server` address for incoming `vm-client` commands
PBOTVM_SERIAL | `5555` | TCP port for serial communication PBOTVM_PORT | `9000` | `vm-server` port for incoming `vm-client` commands
PBOTVM_HEART | `5556` | TCP port for serial heartbeats PBOTVM_SERIAL | `5555` | TCP port for serial communication
PBOTVM_CID | `7` | Context ID for VM socket (if using VSOCK) PBOTVM_HEART | `5556` | TCP port for serial heartbeats
PBOTVM_VPORT | `5555` | VM socket service port (if using VSOCK) PBOTVM_CID | `7` | Context ID for VM socket (if using VSOCK)
PBOTVM_TIMEOUT | `10` | Duration before command times out (in seconds) PBOTVM_VPORT | `5555` | VM socket service port (if using VSOCK)
PBOTVM_NOREVERT | not set | If set then the VM will not revert to previous snapshot PBOTVM_TIMEOUT | `10` | Duration before command times out (in seconds)
PBOTVM_NOREVERT | not set | If set then the VM will not revert to previous snapshot
## Initial virtual machine set-up ## Initial virtual machine set-up
These steps need to be done only once during the first-time set-up. These steps need to be done only once during the first-time set-up.

View File

@ -193,7 +193,7 @@ sub cmd_usershow($self, $context) {
return "There is no user account $name."; return "There is no user account $name.";
} }
if (lc $key eq 'password') { if (defined $key && lc $key eq 'password') {
return "I don't think so."; return "I don't think so.";
} }

View File

@ -25,7 +25,7 @@ use PBot::Imports;
# These are set by the /misc/update_version script # These are set by the /misc/update_version script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 4732, BUILD_REVISION => 4733,
BUILD_DATE => "2024-03-31", BUILD_DATE => "2024-03-31",
}; };