Added Quickstart with Vagrant
This commit is contained in:
		
							parent
							
								
									ef234dae67
								
							
						
					
					
						commit
						0276ca7de8
					
				
					 4 changed files with 169 additions and 10 deletions
				
			
		
							
								
								
									
										68
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										68
									
								
								README.md
									
										
									
									
									
								
							|  | @ -31,15 +31,75 @@ The main goals of this project are: | ||||||
| 
 | 
 | ||||||
| ## Prerequisites | ## Prerequisites | ||||||
| 
 | 
 | ||||||
| - A server running Ubuntu or some other Debian-based distribution and working SSH access | - A server running Ubuntu or some other Debian-based distribution and working SSH access. (To try SATT in a local virtual machine, check out the Quickstart with Vagrant below) | ||||||
| - Ansible on another computer that will send SSH commands to the target server to provision it | - Ansible on another computer that will send SSH commands to the target server to provision it | ||||||
| 
 | 
 | ||||||
| ## Quickstart: Vagrant | ## Quickstart: Vagrant <a id="#quickstartVagrant"></a> | ||||||
|  | 
 | ||||||
|  | To give SATT a quick spin, you could easily bootstrap a development VM using Vagrant on your local machine. | ||||||
|  | 
 | ||||||
|  | ### Vagrant + Ansible on Windows 10 using Windows Subsystem for Linux | ||||||
|  | 
 | ||||||
|  | 1. [Download](https://www.virtualbox.org/wiki/Downloads) and install Virtualbox ([Documentation](https://www.virtualbox.org/wiki/End-user_documentation)) | ||||||
|  | 
 | ||||||
|  | 1. Follow the [guide to install the Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10), we recommend to choose Ubuntu 18.04 LTS or later as a distribution. | ||||||
|  | 
 | ||||||
|  | 1. Open Ubuntu through the Windows Start Menu | ||||||
|  | 
 | ||||||
|  | 1. Inside the Ubuntu Terminal, continue the setup by following the next section. | ||||||
|  | 
 | ||||||
|  | ### Vagrant + Ansible on Linux | ||||||
|  | 
 | ||||||
|  | 1. Obtain Vagrant by [downloading the corresponding package](https://www.vagrantup.com/downloads.html) for your distribution, assuming Ubuntu in the next steps. | ||||||
|  | 
 | ||||||
|  | 2. Install the package by opening a Terminal and run: | ||||||
|  |      | ||||||
|  |     ```bash | ||||||
|  |     user@vmhost: ~$ sudo dpkg install <vagrant-package-name>.deb | ||||||
|  |     ``` | ||||||
|  | 
 | ||||||
|  | 3. To check whether Vagrant was installed successfully, try running `vagrant --version` which must not return an error. | ||||||
|  | 
 | ||||||
|  | 4. Recommended: Install the [Vagrant::Hostsupdate](https://github.com/cogitatio/vagrant-hostsupdater) plugin that will automatically add the hostname of the virtual machine to the list of static hosts on your local machine (VM host). This allows you to later open e.g. `nextcloud.satt.local` in a browser from your local machine. Updates to the hosts file will require entering a sudo password: | ||||||
|  | 
 | ||||||
|  |     ```bash | ||||||
|  |     user@vmhost: ~$ vagrant plugin install vagrant-hostsupdater | ||||||
|  |     ``` | ||||||
|  | 
 | ||||||
|  |     **Note for VM host Windows 10 with WSL:** This host update will currently have no effect outside of WSL, as the updated hosts file is only used within the WSL context, not Windows itself. | ||||||
|  | 
 | ||||||
|  | 5. Install Ansible: | ||||||
|  | 
 | ||||||
|  |     ```bash | ||||||
|  |     user@vmhost: ~$ sudo apt update && sudo apt upgrade | ||||||
|  |     user@vmhost: ~$ sudo apt install python3 python3-pip | ||||||
|  |     user@vmhost: ~$ pip3 install --user ansible | ||||||
|  |     ``` | ||||||
|  | 
 | ||||||
|  | 6. Test ansible by running `ansible --version` | ||||||
|  | 
 | ||||||
|  | 7. Clone the SATT repo: | ||||||
|  | 
 | ||||||
|  |     ```bash | ||||||
|  |     user@vmhost: ~$ git clone https://git.jotbe.io/jotbe/ansible-selfhosted-services.git | ||||||
|  |     ``` | ||||||
|  | 
 | ||||||
|  | 8. Change to the local copy and try bootstrapping the VM (this will take a while and you might be asked for a sudo password): | ||||||
|  | 
 | ||||||
|  |     ```bash | ||||||
|  |     user@vmhost: ~$ cd ansible-selfhosted-services | ||||||
|  |     user@vmhost: ~/ansible-selfhosted-services$ vagrant up | ||||||
|  |     ``` | ||||||
|  | 
 | ||||||
|  | 9. If everything went fine, you should be able to SSH into the machine by running `vagrant ssh` from within the same directory and services should be up and running. | ||||||
|  | 
 | ||||||
|  | 10. If you installed the Vagrant::Hostsupdate plugin in step (4) and didn't change the configuration, you should be able to open some services in a browser: | ||||||
|  |      | ||||||
|  |     * Nextcloud: [https://nextcloud.satt.local](https://nextcloud.satt.local) | ||||||
|  |     * Jitsi: [https://jitsi.satt.local](https://jitsi.satt.local) | ||||||
| 
 | 
 | ||||||
| By default, a `vagrant` user will be provisioned (if not already available) and used throughout the provisioning. | By default, a `vagrant` user will be provisioned (if not already available) and used throughout the provisioning. | ||||||
| 
 | 
 | ||||||
| **TODO: Provide Vagrantfile and further documentation!** |  | ||||||
| 
 |  | ||||||
| ## Quickstart: Regular server/VM | ## Quickstart: Regular server/VM | ||||||
| 
 | 
 | ||||||
| - Clone this repo | - Clone this repo | ||||||
|  |  | ||||||
							
								
								
									
										62
									
								
								Vagrantfile
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								Vagrantfile
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,62 @@ | ||||||
|  | # This guide is optimized for Vagrant 1.8 and above. | ||||||
|  | # Older versions of Vagrant put less info in the inventory they generate. | ||||||
|  | Vagrant.require_version ">= 1.8.0" | ||||||
|  | 
 | ||||||
|  | require 'etc' | ||||||
|  | 
 | ||||||
|  | Vagrant.configure(2) do |config| | ||||||
|  | 
 | ||||||
|  |   config.vm.box = "hashicorp/bionic64" | ||||||
|  | 
 | ||||||
|  |   # The currently only supported provider is Virtualbox | ||||||
|  |   # You will have to install Virtualbox from https://www.virtualbox.org | ||||||
|  |   # Manual for the following settings: https://www.virtualbox.org/manual/ch03.html | ||||||
|  |   config.vm.provider :virtualbox do |vbox, override| | ||||||
|  |     vbox.customize ["modifyvm", :id, "--name", "Self-host All The Things! - Dev VM"] | ||||||
|  |     # Amount of virtual memory | ||||||
|  |     vbox.customize ["modifyvm", :id, "--memory", 8192] | ||||||
|  |     # Amount of virtual CPUs, by default it uses half ot the physical CPUs | ||||||
|  |     vbox.customize ["modifyvm", :id, "--cpus", Etc.nprocessors/2] | ||||||
|  |     # The amount of graphics memory | ||||||
|  |     vbox.customize ["modifyvm", :id, "--vram", 128] | ||||||
|  |     # If you want to use the 3D graphic acceleration in the VM, turn it on | ||||||
|  |     vbox.customize ["modifyvm", :id, "--accelerate3d", "off"] | ||||||
|  |     # Required. Allows to use more than 16 IRQs, important esp. for 64-bit guests and if more than 1 virtual CPU is used | ||||||
|  |     vbox.customize ["modifyvm", :id, "--ioapic", "on"] | ||||||
|  |     # Enable copy & paste between the VM and the host | ||||||
|  |     vbox.customize ["modifyvm", :id, "--clipboard-mode", "bidirectional"] | ||||||
|  |     # Disable serial ports (COM) if not needed | ||||||
|  |     vbox.customize ["modifyvm", :id, "--uartmode1", "disconnected"] | ||||||
|  |     # If your local network uses the same subnet as the default Virtualbox one (10.0.2.0/24), set a different one here | ||||||
|  |     vbox.customize ["modifyvm", :id, "--natnet1", "10.0.50.0/24"] | ||||||
|  |     # Attach a virtual DVD drive to be able to easily install the Virtualbox Guest Additions | ||||||
|  |     vbox.customize ["storageattach", :id, "--storagectl", "IDE Controller", "--port", "0", "--device", "0", "--type", "dvddrive", "--medium", "emptydrive"] | ||||||
|  |     #vbox.customize ["storagectl", :id, "--name", "SATA Controller", "--hostiocache", "on"] | ||||||
|  |     # Default: The VM is hosted on an SSD. | ||||||
|  |     # Set to "off" if it is hosted on an HDD to enable performance optimizations for rotational drives (e.g. defragmentation): | ||||||
|  |     #vbox.customize ["storageattach", :id, "--storagectl", "SCSI", "--port", 0, "--nonrotational", "on"] | ||||||
|  |     #vbox.customize ["storageattach", :id, "--storagectl", "SCSI", "--port", 1, "--nonrotational", "on"] | ||||||
|  | 
 | ||||||
|  |     # Set to true, if you intent to use a GUI | ||||||
|  |     vbox.gui = false | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  |   config.vm.define "satt" do |dev| | ||||||
|  |     dev.vm.hostname = "satt.local" | ||||||
|  |     dev.hostsupdater.aliases = ["nextcloud.satt.local", "jitsi.satt.local"] | ||||||
|  |     # An additional IP that allows you to access the VM and its services from the VM host. | ||||||
|  |     # If you change this IP, you will have to modify the `ansible_host` in the inventory file correspondingly. | ||||||
|  |     # More information about the various network modes: | ||||||
|  |     # https://www.virtualbox.org/manual/ch06.html#network_nat_service | ||||||
|  |     dev.vm.network :private_network, ip: "192.168.23.42" | ||||||
|  | 
 | ||||||
|  |     dev.vm.provision :ansible do |ansible| | ||||||
|  |       #ansible.verbose = "vvv" | ||||||
|  |       ansible.compatibility_mode = "2.0" | ||||||
|  |       ansible.playbook = "./site.yml" | ||||||
|  |       ansible.inventory_path = "./inventory.ini.sample" | ||||||
|  |       ansible.become = true | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  | end | ||||||
							
								
								
									
										34
									
								
								group_vars/vagrant.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								group_vars/vagrant.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | ||||||
|  | ansible_user: vagrant | ||||||
|  | users: | ||||||
|  |   - deploy | ||||||
|  | sudoers: [] | ||||||
|  | mariadb_root_password: password | ||||||
|  | nextcloud_mariadb_user: nextcloud | ||||||
|  | nextcloud_mariadb_password: password | ||||||
|  | nextcloud_admin_user: admin | ||||||
|  | nextcloud_admin_password: password | ||||||
|  | nextcloud_trusted_domains: satt.local | ||||||
|  | nextcloud_overwrite_cli_url: https://nextcloud.satt.local | ||||||
|  | nextcloud_overwrite_host: nextcloud.satt.local | ||||||
|  | nextcloud_overwrite_protocol: https | ||||||
|  | nextcloud_enable_restic_compose_backup: False | ||||||
|  | nextcloud_virtual_host: nextcloud.satt.local | ||||||
|  | collabora_virtual_host: collabora.satt.local | ||||||
|  | collabora_domain_regex_pattern: nextcloud\.satt\.local | ||||||
|  | collabora_admin_user: admin | ||||||
|  | collabora_admin_password: password | ||||||
|  | jitsi_public_url: https://jitsi.satt.local | ||||||
|  | jitsi_docker_host_address: "{{ ansible_host }}" | ||||||
|  | jitsi_exposed_http_port: 8000 | ||||||
|  | jitsi_exposed_https_port: 8443 | ||||||
|  | jitsi_timezone: Europe/Amsterdam | ||||||
|  | jitsi_enable_letsencrypt: False | ||||||
|  | jitsi_virtual_host: jitsi.satt.local | ||||||
|  | docker_user: deploy | ||||||
|  | traefik: | ||||||
|  |   expose_internally: True | ||||||
|  |   expose_externally: False | ||||||
|  |   enable_acme: False | ||||||
|  |   use_acme_staging: False | ||||||
|  |   dns_challenge_provider: False | ||||||
|  | 
 | ||||||
|  | @ -1,20 +1,23 @@ | ||||||
| # All hosts | # All hosts | ||||||
| vagrant ansible_user=vagrant | satt ansible_user=vagrant ansible_host=192.168.23.42 | ||||||
|  | 
 | ||||||
|  | [vagrant] | ||||||
|  | satt | ||||||
| 
 | 
 | ||||||
| [docker] | [docker] | ||||||
| vagrant | satt | ||||||
| 
 | 
 | ||||||
| [ubuntu] | [ubuntu] | ||||||
| vagrant | satt | ||||||
| 
 | 
 | ||||||
| [debian:children] | [debian:children] | ||||||
| ubuntu | ubuntu | ||||||
| 
 | 
 | ||||||
| [nextcloud] | [nextcloud] | ||||||
| vagrant | satt | ||||||
| 
 | 
 | ||||||
| [jitsi_docker] | [jitsi_docker] | ||||||
| vagrant | satt | ||||||
| 
 | 
 | ||||||
| [collabora] | [collabora] | ||||||
| vagrant | satt | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue