Creating a development environment in Multipass
Multipass is an alternative to Vagrant+Virtual Box. Like Vagrant, it uses virtualization providers.
Multipass creates an Ubuntu-based virtual machine. VM creation is automated with VM image and software provision.
Multipass is suggested for workstations that run macOS on Apple silicon processors, because Vagrant support for this architecture is poor at the time of this writing (Nov.2023)
This method has been tested successfully on a Mac with M1 processor.
Multipass is also available for Windows and Linux.
- Operating system: Ubuntu Bionic (18.04)
- Database: MySQL 5.x
- Nodejs: 16.x (Used to install handlebars for template processing)
- Java: 11 Openjdk
- Python: 3.7.5 (with virtualenv)
- Apache Tomcat: 8.x
- Nginx: Latest available for the given ubuntu version
- CPUs: 2
- RAM: 3G
- Disk: 20GB
The VM will take the above from your normal OS resources, for its own use. These specs can be changed in the fcw-multipass.sh script.
- Suggest having all tools pre-installed (git, brew, command line tools, etc.)
- Install Multipass and run the app.
- Turn off VPN or other virtualized network layers before creating your VM. Note: Multipass can trip on known network issues (e.g., when using a VPN). Please find the troubleshooting guide here: https://multipass.run/docs/troubleshoot-networking#heading--troubleshoot-networking-on-macos
- Create a working FCW folder that will hold all FCW files. Go to that folder in the Terminal app.
- Clone the repository
git clone https://github.com/Lexxie9952/fcw.org-server.git .
SEE NOTE BELOW or, for gitlab (git clone [email protected]:fcw2/freeciv-web.git .
)
Note: In Nov.2023, the dev
branch has the current state of the freeciv-web.org server.
Note 2: Look in README for updated/current notes on the git clone step.
- Change to the directory of your source code.
- Execute the script fcw-multipass.sh
- Execute
multipass list
and make note of the IP address of thefcw
VM.
You should now have a virtual machine instance of freeciv-web with the software mentioned on the Development environment description.
- Open a terminal to multipass VM:
multipass shell fcw
~/multipass-entrypoint.sh start
to boot/prepare FCW for use.- Open
http://<ip address>/
on your browser, using the IP address from III.3.
You should see the FCW home page served by the local server running inside your fcw
multipass VM.
multipass shell fcw
Open an "ssh" terminal into the multipass VM.multipass stop fcw
Stop the multipass VMmultipass start fcw
Start the multipass VMmultipass info fcw
Get information about the VM (including it's ip address it is needed in order to connect to the application via a web browser)multipass list
List all multipass VM instances and their ip addresses.multipass delete instance
Delete the VM with the nameinstance
multipass purge
Destroy and clean up all deleted instances.
- To destroy the VM:
./fcw-multipass.sh destroy
- Stop FCW
~/multipass-entrypoint.sh stop
To externally access internal directories in the VM from within macOS, you can copy between them and work on a clone:
- Example. Make a copy of an internal dir into your main OS directory tree:
multipass transfer -r -p fcw:/var/lib/tomcat8/webapps ~/FCW/tomcat_webapps
- After making edits, copy dir back into the VM instance:
multipass transfer -r -p ~/FCW/tomcat_webapps fcw:/var/lib/tomcat8/webapps