Skip to content

Commit

Permalink
Updated documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tblock79 committed Mar 29, 2024
1 parent 0e8f7cb commit b34efe4
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 1 deletion.
92 changes: 92 additions & 0 deletions addons/vagrant/systemd_m1/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'getoptlong'

orthanc=''
branch='--branch latest-stable'
use_default_disk=false

opts = GetoptLong.new(
[ '--orthanc', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--dev', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--smaller-disk', GetoptLong::OPTIONAL_ARGUMENT ]
)
opts.each do |opt, arg|
case opt
when '--orthanc'
orthanc='yes'
when '--dev'
branch=''
when '--smaller-disk'
use_default_disk=true
end
end
if !use_default_disk then
# Install vagrant-disksize to allow resizing the vagrant box disk.
unless Vagrant.has_plugin?("vagrant-disksize")
raise Vagrant::Errors::VagrantError.new, "vagrant-disksize plugin is missing. Either use --smaller-disk, or install it using 'vagrant plugin install vagrant-disksize' and rerun 'vagrant up'"
end
end

$script = <<-SCRIPT
echo "#### mercure installation in systemd mode"
echo Cloning mercure and calling install script...
cd ~
git clone --depth 1 #{branch} https://github.com/mercure-imaging/mercure.git
cd mercure
./install.sh -y systemd
SCRIPT

$script_orthanc = <<-SCRIPT
echo "#### mercure installation in systemd mode with Orthanc"
echo Cloning mercure and calling install script...
cd ~
git clone --depth 1 #{branch} https://github.com/mercure-imaging/mercure.git
cd mercure
./install.sh -y systemd
cd addons/orthanc
docker network create mercure_default
docker-compose up -d
SCRIPT

Vagrant.configure(2) do |config|
config.vm.box = "generic/ubuntu2004" # 20.04 LTS
config.vm.network "forwarded_port", guest: 8000, host: 8000, auto_correct: true, host_ip: "127.0.0.1"
config.vm.network "forwarded_port", guest: 11112, host: 11112, auto_correct: true, host_ip: "127.0.0.1"

if use_default_disk == false then
config.disksize.size = "70GB"
end
if orthanc == "yes" then
config.vm.network "forwarded_port", guest: 8008, host: 8008, auto_correct: true, host_ip: "127.0.0.1"
config.vm.network "forwarded_port", guest: 8042, host: 8042, auto_correct: true, host_ip: "127.0.0.1"
config.vm.network "forwarded_port", guest: 4242, host: 4242, auto_correct: true, host_ip: "127.0.0.1"
config.vm.provision "shell", inline: $script_orthanc
else
config.vm.provision "shell", inline: $script
end

# Increase memory for Parallels Desktop
config.vm.provider "qemu" do |qe|
qe.memory = "4096"
end

config.vm.provider "qemu" do |qe|
qe.arch = "x86_64"
qe.machine = "q35"
qe.cpu = "qemu64"
qe.net_device = "virtio-net-pci"
end

# Increase memory for Virtualbox
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
end

# Increase memory for VMware
["vmware_fusion", "vmware_workstation"].each do |p|
config.vm.provider p do |v|
v.vmx["memsize"] = "4096"
end
end
end
52 changes: 52 additions & 0 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,55 @@ Afterwards, the .service files of the scaled service modules need to be duplicat
sudo systemctl start mercure_dispatcher2.service

As last step, it is necessary to authorize the mercure system user to control the duplicated services. This is done by editing the file **/etc/sudoers.d/mercure** (using a user account with sudo permission) and adding a line for each duplicated service (according to the name specified above). When copying an existing line from the file, make sure to change every occurrence of the service name in the line.


Installation on Apple Macs with ARM processors
----------------------------------------------

Because the modern Apple Mac computers with M1/M2/M3 processors use a different architecture (ARM) than the older Intel-based Macs, it is not possible to directly run virtual machines with x86 architecture. Therefore, the installation instructions described in the Quickstart section do not work. It is still possible to run mercure on these Macs by using a software-based virtualization software called QEMU. However, this is VERY slow and may only be useful for initial testing purposes.

The following steps describe how to install and run mercure on a Mac with an Mx processor:

* Download and install `VirtualBox <https://virtualbox.org/>`_. **Note:** The latest version currently does not support ARM Macs. Go to download page, go to older builds, Version 7.0.8 supports ARM Mac (Developer Preview)

* Make sure that Homebrew is installed

* Run the following commands to install Qemu and Vagrant

::

brew install qemu
brew install --cask vagrant
vagrant plugin install vagrant-qemu

* Make sure that rosetta is installed:

::

sudo softwareupdate --install-rosetta

* Clone the mercure repository and navigate to the vagrant folder for Macs:

::

/addons/vagrant/systemd_m1

* Start the mercure VM as usual with:

::
vagrant --orthanc up

* To increase speed, try the following provider setup in the Vagrantfile:

::
config.vm.provider "qemu" do |qe|
qe.arch = "x86_64"
qe.machine = "q35"
qe.cpu = "max"
qe.smp = "cpus=2,sockets=1,cores=2,threads=1"
qe.net_device = "virtio-net-pci"
qe.extra_qemu_args = %w(-accel tcg,thread=multi,tb-size=512)
qe.qemu_dir = "/usr/local/share/qemu"
end
5 changes: 4 additions & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Quick Start
===========

If you want to try out mercure or setup a development environment, you can easily install mercure on your computer via Vagrant, which is an open-source tool for automatically creating and provisioning virtual machines. First, install `VirtualBox <https://virtualbox.org/>`_ on your computer. Afterwards, download `Vagrant <https://vagrantup.com/>`_ and install it. This should work on Windows, Mac, and Linux systems.
If you want to try out mercure or setup a development environment, you can easily install mercure on your computer via Vagrant, which is an open-source tool for automatically creating and provisioning virtual machines. First, install `VirtualBox <https://virtualbox.org/>`_ on your computer. Afterwards, download `Vagrant <https://vagrantup.com/>`_ and install it. This should work on Windows, Intel-based Mac, and Linux systems.

.. important:: This way of installing mercure is only suited for testing or development purpose. If you want to install mercure for production use, follow the instructions in the Installation section.

.. note:: These instructions work for Apple Mac computers with Intel CPUs, but not for the newer Macs with M1/M2/M3 (ARM) processors. The :doc:`Advanced Topics <../advanced>` section contains instructions for running mercure on ARM-based Macs.


Open a terminal shell and checkout the mercure repository by calling
::

Expand Down

0 comments on commit b34efe4

Please sign in to comment.