Developing using Arch Linux on Parallels on Apple Silicon with a systemd-nspawn container

/docs/developers/setup/parallels/

Summary of the setup

Note

This setup is for Parallels users on Apple Silicon, such as the newer Macs. It does not work on x86_64 Macs or PCs.

In brief:

  • Download a virtual machine and run it in Parallels. It has all the tools you are going to need pre-installed – build tools, git, IDE etc.
  • In the virtual machine, run a single script, and you will have a UBOS Mesh site running that’s even pre-configured for debugging.

Easy, right?

Steps in detail

  1. Download the this virtual appliance file: http://depot.ubos.net/ubosdev/ubosdev-aarch64-20221123.pvmp (1.5GB)

  2. Open the file with Parallels. A ubosdev VM will show up in the Parallels Control Center.

  3. Double-click the VM icon. This will unpack the file into the format that Parallels needs to run it.

  4. Start the VM.

  5. Logon as ubosdev, there is no password. root does not have a password either: we assume that’s safe enough on your computer. If you don’t think so, set one :-)

  6. Pick a better screen resolution:

    • In “Search”, type “Settings” and run it.
    • If there’s an error message saying “Oops, something has gone wrong” about Network settings: ignore it, we are not running Network manager.
    • Select “Displays” and pick a resolution that makes sense for your computer setup.
    • Close the settings app.
  7. In “Search”, type “Console” and run it (you get the “Search” by selecting “Activities” in the menu bar).

  8. Fix the permissions on the home directory (current bug in the setup):

    % sudo chmod 755 ~ubosdev
    
  9. Set up the UBOS development environment by running:

    % ubosdev-container setup --channel red --flavor mesh
    

    Use --flavor mesh if you plan to do UBOS Mesh development or you aren’t certain.

    Note the argument specifying the red release channel; the yellow default one does not work yet.

    This might take 5-30 min, depending on your network, computer and disk speed.

  10. Once this command is complete, you can shutdown the VM any time if you like.

Ongoing development work

  1. Run your Development VM.

  2. Determine which UBOS Linux container to run:

    % ubosdev-container list
    
  3. Run your UBOS Linux container:

    % ubosdev-container run --name <name>
    

    where <name> is one of the names from the list, e.g. ubos-mesh-red.

    This gives you console access to the container. You can shut it down with ^].

  4. Access any deployed web app there from your development VM with the name of the container, e.g. http://ubos-mesh-red/. Firefox is pre-installed on the VM.

  5. To edit your code, IDEs geany is pre-installed on your development VM. NetBeans isn’t currently in the Arch Linux ARM repos; to install, “Download from mirror” here and then sudo pacman -U netbeans*.pkg*.

  6. To open up a shell inside your development container, open a new terminal and execute:

    % sudo machinectl shell ubosdev@ubos-mesh-red
    

    if ubos-mesh-red is the name of your container.

  7. To build your UBOS Mesh code, run the UBOS Mesh tools inside your development container:

    % mesh-clean
    % mesh-build
    % mesh-test
    
  8. To debug your UBOS Mesh code, connect with the Netbeans debugger:

    This requires that the Java VM was started with the default debugging flag. This flag is set by default in the default Site JSON that’s deployed when you create a container with --flavor mesh.

    • Run NetBeans
    • Menu “Debug” / “Attach Debugger”
    • Select Debugger: “Java Debugger (JPDA)”
    • Select Connector: “Socket Attach (Attaches by socket to other VMs)”
    • Host: name of your container, e.g. ubos-mesh-develop-red
    • Port: 7777
  9. To shut down your container, in the terminal where you run it, hit ^] three times in quick succession.