- Go 1.16 or higher
- Vagrant
- VirtualBox
- Git
-
Clone the repository:
git clone git@github.com:ralfyang/vagrant_docker_cluster.git cd vagrant_docker_cluster
$ ./ctl.sh
===========================================================
What do you want ?
===========================================================
[0] Install the Virtualbox & Vagrant <--- HERE!
[1] Start VM & login
[2] Login to VM
[3] Stop VM
[4] Reload VM
[5] Reboot VM
[RM] Remove VM
===========================================================
Please insert a key as you need
===========================================================
vagrant up docker01.dev
or
vagrant up docker0{1..9}.dev
ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/ralfyang/.ssh/id_rsa):
Created directory '/Users/ralfyang/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/ralfyang/.ssh/id_rsa.
Your public key has been saved in /Users/ralfyang/.ssh/id_rsa.pub.
The key fingerprint is:
vagrant ssh docker01.dev
- setup the
.env
file as below
## Please make sure the Network information as below
Public_IP=111.111.111.2
Private_IP=192.168.100.13
PASSWORD=your_password_for_webconsole_login
- Running the webconsole for test
nohup go run ./main.go > output.log 2>&1 &
This project provides a web console for managing Vagrant VMs. The console allows you to start, stop, reload, reboot, and remove VMs, as well as view the current status of all VMs.
-
Build the
vvmanager
executable:go build -o vvmanager main.go
The webconsole.sh
script is used to manage the web console server. It supports start
, stop
, restart
, and run
commands.
start
: Starts the web console server in the background and rotates logs daily.stop
: Stops the running web console server.restart
: Restarts the web console server.run
: Runs the web console server in the foreground.
To use the script, run the following commands:
-
Make the script executable:
chmod +x webconsole.sh
-
Start the web console server:
./webconsole.sh start
-
Stop the web console server:
./webconsole.sh stop
-
Restart the web console server:
./webconsole.sh restart
-
Run the web console server in the foreground:
./webconsole.sh run
The webconsole.sh
script handles log rotation and maintains a PID file to manage the server process. Logs are rotated daily, with a maximum of 4 log files retained (history.log
, history.log.1
, history.log.2
, and history.log.3
).
Here is an example session using the webconsole.sh
script:
-
Start the server:
./webconsole.sh start
-
Access the web console by navigating to
http://<your_server_ip>:8080
in your web browser. -
Stop the server:
./webconsole.sh stop
-
Restart the server:
./webconsole.sh restart
- Ensure all dependencies are installed and properly configured.
- Check the log files (
history.log
) for any errors or warnings. - If the server does not start, verify that no other process is using port 8080.
This project is licensed under the MIT License. See the LICENSE file for details.