├── LICENSE ├── README.md └── Vagrantfile /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Emeric 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Setup ServerPilot with Vagrant 2 | 3 | This repository provides a sample Vagrantfile to create a Ubuntu 14.04 64-bit virtual machine. After following the installation instructions, you'll have a server managed by ServerPilot and accessible via your browser at `local.io`. 4 | Inspired from [manjoker/Vagrantfile](https://github.com/manjoker/Vagrantfile) 5 | 6 | https://serverpilot.io 7 | 8 | ## Information 9 | You will be able to setup as many sub-domain as you want. You will have phpMyAdmin running on your server and you will also be able to share your virtual machine with https://vagrantcloud.com 10 | 11 | ## Getting Started 12 | 1. Install dependencies 13 | * [Virtualbox](https://www.virtualbox.org/) 4.0 or greater. 14 | * [Vagrant](http://downloads.vagrantup.com/) 1.3.1 or greater. 15 | 2. Copy the [Vagrantfile](https://github.com/Xety/ServerPilot/blob/master/Vagrantfile) 16 | 3. Execute the following commands to setup the virtual machine : 17 | ```bash 18 | $ vagrant up 19 | $ vagrant ssh 20 | ``` 21 | 22 | ## Connecting to ServerPilot 23 | * [Log in](https://manage.serverpilot.io/#login) to ServerPilot 24 | * Go to the **Servers** page and click **+ Connect Server** 25 | * Click `Install ServerPilot manually.` at the bottom 26 | * `Name` => `local.io` 27 | * `SFTP Password` => `Choose a password` 28 | * Copy the **whole** command (and let the page open in your browser): 29 | ![fdf4c72543af0a52e47b3474b150e93b](https://cloud.githubusercontent.com/assets/8210023/11672449/e0f1da26-9e10-11e5-84f0-2b3229e75c48.png) 30 | 31 | * Paste the command in the VM terminal and wait until to get this message : 32 | ![c5d6522793686dbc0ab42d75e5be7df1](https://cloud.githubusercontent.com/assets/8210023/11672125/f12bf9ce-9e0d-11e5-8a8c-8f18ee4c799e.png) 33 | 34 | * Watch **ServerPilot** install 35 | ![55a2c4882b4e624ef61a49d5de59c32a](https://cloud.githubusercontent.com/assets/8210023/11672081/8cdad1d4-9e0d-11e5-8640-e1a7d3b744a7.png) 36 | * **Note** : The part `Testing server configuration` **may take several minutes** (more than 20 minutes for me) 37 | 38 | ## Create your Applications in ServerPilot 39 | * Go to the **Apps** page and click **+ Create App** 40 | * `Name` => `website` 41 | * `Domain` => `local.io` 42 | * `Server` => `local.io` 43 | 44 | ## Edit the `hosts` file 45 | * Edit the following file as `administrator` / `root` 46 | * Ubuntu/Mac OS X : `/etc/hosts` 47 | * Windows : `C:\WINDOWS\system32\drivers\etc\hosts` 48 | * Add the following code in this file : 49 | * `192.168.56.101 local.io` 50 | * If you plan to add sub-domains, you can add them now in the `hosts` file : 51 | ``` 52 | 192.168.56.101 local.io 53 | 192.168.56.101 subdomain1.local.io 54 | 192.168.56.101 subdomain2.local.io 55 | ``` 56 | 57 | ## Edit the `Vagrantfile` file 58 | * Now, you must edit the `Vagrantfile` and **uncomment** this line : 59 | ```ruby 60 | config.vm.synced_folder '/var/www/Sites/website', '/srv/users/serverpilot/apps/website/public', owner: "serverpilot", group: "serverpilot" 61 | ``` 62 | * Adapt it to your system. The first part, is the path on **your** system. The second part, is the path on the VM system. 63 | * **Note** : Don't remove the `owner` and `group` keys. I have got some issues with the permissions, and this configuration seems to resolve all permissions bugs. If you want to add new `synced_folder`, you must add the `owner` and `group` keys with the `serverpilot` value. 64 | * Execute the following command to reload the VM with the modified Vagranfile : 65 | ```bash 66 | vagrant@local:~$ exit 67 | $ vagrant reload 68 | ``` 69 | 70 | ## Enjoy 71 | * Go to [local.io](http://local.io) in a new tab and you should see the ServerPilot splash page **or** your application. 72 | ![6f7a24856a34bdc310657e9d92d6655c](https://cloud.githubusercontent.com/assets/8210023/11673405/d519a794-9e18-11e5-940b-a7104484b9aa.png) 73 | 74 | 75 | # More Configuration 76 | The following configuration are not required, but can be usefull if you plan to install phpMyAdmin or setup a sub-domain. 77 | 78 | ### Install `phpMyAdmin` 79 | * Create a new application on ServerPilot : 80 | * `Name` => `pma` 81 | * `Domain` => `pma.local.io` 82 | * `Server` => `local.io` 83 | * Download the latest version of `phpMyAdmin` : 84 | * http://www.phpmyadmin.net/home_page/downloads.php 85 | * Open the archive that you downloaded 86 | * Place the archive where you want on your system. For the tutorial, i have placed it in `/var/www/Sites/pma`. 87 | * Rename `config.sample.inc.php` to `config.inc.php`. 88 | * Now, open `config.inc.php` and set a random string of characters for the value of ``$cfg['blowfish_secret']`` near the top of the file. Exemple : 89 | ```php 90 | $cfg['blowfish_secret'] = 'asdof7q230984(*^3q4'; 91 | ``` 92 | 93 | * Add `192.168.56.101 pma.local.io` to your `hosts` file. 94 | * Uncomment and adapt (regarding to the path) the following line in the Vagranfile : 95 | ```ruby 96 | config.vm.synced_folder '/var/www/Sites/pma', '/srv/users/serverpilot/apps/pma/public', owner: "serverpilot", group: "serverpilot" 97 | ``` 98 | * Execute the following command to reload the VM with the modified Vagranfile : 99 | ```bash 100 | $ vagrant reload 101 | ``` 102 | * Create a database on ServerPilot : 103 | ![280552ce196fca4efcc75bb31060c1c2](https://cloud.githubusercontent.com/assets/8210023/11673299/f894f1fc-9e17-11e5-82eb-a7fe91dabd72.png) 104 | 105 | * Go to [pma.local.io](http://pma.local.io) and login with the same `username` and `password` that you used to create the database. 106 | 107 | ### Create a `sub-domain` 108 | * If you followed the phpMyAdmin installation, you already know how to setup a sub-domain. For the tutorial, I will setup a sub-domain named `xety.local.io` 109 | * Create a new application on ServerPilot : 110 | * `Name` => `xety` 111 | * `Domain` => `xety.local.io` 112 | * `Server` => `local.io` 113 | * Add `192.168.56.101 xety.local.io` to your `hosts` file. 114 | * Uncomment and adapt (regarding to your path) the following line in the Vagranfile : 115 | ```ruby 116 | config.vm.synced_folder '/var/www/Sites/xety', '/srv/users/serverpilot/apps/xety/public', owner: "serverpilot", group: "serverpilot" 117 | ``` 118 | * Execute the following command to reload the VM with the modified Vagranfile : 119 | ```bash 120 | $ vagrant reload 121 | ``` 122 | * Go to [xety.local.io](http://xety.local.io) and enjoy ! Yes, it's very simple to do. 123 | 124 | ### Connect to the `SFTP` 125 | Yes, you can connect to the server using the SFTP method ! 126 | * Use your prefered software. I will use `FileZilla`. 127 | * Login in FileZilla with the following credentials : 128 | * `Host` => `192.168.56.101` 129 | * `User` => `serverpilot` 130 | * `Password` => `The SFTP password that you provided at the beginning of this tutorial` 131 | * `Port` => `22` 132 | * You can also login with the `vagrant` user : 133 | * `Host` => `192.168.56.101` 134 | * `User` => `vagrant` 135 | * `Password` => `vagrant` 136 | * `Port` => `22` 137 | * But **i recommend** you to use the `serverpilot` user and not the `vagrant`, else you will probably have some permissions issues (i.e : https://serverpilot.io/community/articles/how-to-fix-file-permissions.html) 138 | 139 | ### Share your VM 140 | * Create an account there : https://vagrantcloud.com/account/new 141 | * It's easy with 1 command, follow the `HTTP` method there : https://vagrantcloud.com/help/vagrant/shares/create 142 | * Possible issue : 143 | * `Why the share doesn't show the good application ?` => Because ServerPilot define the default application by alphabetically order. More information : https://serverpilot.io/community/articles/how-to-set-the-default-app.html 144 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | config.vm.box = "ubuntu/trusty64" 9 | 10 | # Disable automatic box update checking. If you disable this, then 11 | # boxes will only be checked for updates when the user runs 12 | # `vagrant box outdated`. This is not recommended. 13 | # config.vm.box_check_update = false 14 | 15 | config.vm.hostname = 'local.io' 16 | 17 | # Create a forwarded port mapping which allows access to a specific port 18 | # within the machine from a port on the host machine. In the example below, 19 | # accessing "localhost:8080" will access port 80 on the guest machine. 20 | # config.vm.network :forwarded_port, guest: 443, host: 8443 21 | config.vm.network :forwarded_port, guest: 80, host: 8080 22 | 23 | # Create a private network, which allows host-only access to the machine 24 | # using a specific IP. 25 | config.vm.network "private_network", ip: "192.168.56.101" 26 | 27 | # If true, then any SSH connections made will enable agent forwarding. 28 | # Default value: false 29 | config.ssh.forward_agent = true 30 | 31 | # Share an additional folder to the guest VM. The first argument is 32 | # the path on the host to the actual folder. The second argument is 33 | # the path on the guest to mount the folder. And the optional third 34 | # argument is a set of non-required options. 35 | #config.vm.synced_folder '/var/www/Sites/website', '/srv/users/serverpilot/apps/website/public', owner: "serverpilot", group: "serverpilot" 36 | #config.vm.synced_folder '/var/www/Sites/pma', '/srv/users/serverpilot/apps/pma/public', owner: "serverpilot", group: "serverpilot" 37 | 38 | config.vm.provision "shell", inline: "apt-get update && apt-get install -y curl" 39 | end 40 | --------------------------------------------------------------------------------