https://github.com/xety/serverpilot
Setup ServerPilot with Vagrant
https://github.com/xety/serverpilot
local serverpilot tutorial
Last synced: 10 months ago
JSON representation
Setup ServerPilot with Vagrant
- Host: GitHub
- URL: https://github.com/xety/serverpilot
- Owner: Xety
- License: mit
- Created: 2015-12-08T23:24:37.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-11T13:25:10.000Z (almost 8 years ago)
- Last Synced: 2025-03-18T04:37:38.599Z (10 months ago)
- Topics: local, serverpilot, tutorial
- Size: 5.86 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Setup ServerPilot with Vagrant
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`.
Inspired from [manjoker/Vagrantfile](https://github.com/manjoker/Vagrantfile)
https://serverpilot.io
## Information
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
## Getting Started
1. Install dependencies
* [Virtualbox](https://www.virtualbox.org/) 4.0 or greater.
* [Vagrant](http://downloads.vagrantup.com/) 1.3.1 or greater.
2. Copy the [Vagrantfile](https://github.com/Xety/ServerPilot/blob/master/Vagrantfile)
3. Execute the following commands to setup the virtual machine :
```bash
$ vagrant up
$ vagrant ssh
```
## Connecting to ServerPilot
* [Log in](https://manage.serverpilot.io/#login) to ServerPilot
* Go to the **Servers** page and click **+ Connect Server**
* Click `Install ServerPilot manually.` at the bottom
* `Name` => `local.io`
* `SFTP Password` => `Choose a password`
* Copy the **whole** command (and let the page open in your browser):

* Paste the command in the VM terminal and wait until to get this message :

* Watch **ServerPilot** install

* **Note** : The part `Testing server configuration` **may take several minutes** (more than 20 minutes for me)
## Create your Applications in ServerPilot
* Go to the **Apps** page and click **+ Create App**
* `Name` => `website`
* `Domain` => `local.io`
* `Server` => `local.io`
## Edit the `hosts` file
* Edit the following file as `administrator` / `root`
* Ubuntu/Mac OS X : `/etc/hosts`
* Windows : `C:\WINDOWS\system32\drivers\etc\hosts`
* Add the following code in this file :
* `192.168.56.101 local.io`
* If you plan to add sub-domains, you can add them now in the `hosts` file :
```
192.168.56.101 local.io
192.168.56.101 subdomain1.local.io
192.168.56.101 subdomain2.local.io
```
## Edit the `Vagrantfile` file
* Now, you must edit the `Vagrantfile` and **uncomment** this line :
```ruby
config.vm.synced_folder '/var/www/Sites/website', '/srv/users/serverpilot/apps/website/public', owner: "serverpilot", group: "serverpilot"
```
* Adapt it to your system. The first part, is the path on **your** system. The second part, is the path on the VM system.
* **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.
* Execute the following command to reload the VM with the modified Vagranfile :
```bash
vagrant@local:~$ exit
$ vagrant reload
```
## Enjoy
* Go to [local.io](http://local.io) in a new tab and you should see the ServerPilot splash page **or** your application.

# More Configuration
The following configuration are not required, but can be usefull if you plan to install phpMyAdmin or setup a sub-domain.
### Install `phpMyAdmin`
* Create a new application on ServerPilot :
* `Name` => `pma`
* `Domain` => `pma.local.io`
* `Server` => `local.io`
* Download the latest version of `phpMyAdmin` :
* http://www.phpmyadmin.net/home_page/downloads.php
* Open the archive that you downloaded
* Place the archive where you want on your system. For the tutorial, i have placed it in `/var/www/Sites/pma`.
* Rename `config.sample.inc.php` to `config.inc.php`.
* 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 :
```php
$cfg['blowfish_secret'] = 'asdof7q230984(*^3q4';
```
* Add `192.168.56.101 pma.local.io` to your `hosts` file.
* Uncomment and adapt (regarding to the path) the following line in the Vagranfile :
```ruby
config.vm.synced_folder '/var/www/Sites/pma', '/srv/users/serverpilot/apps/pma/public', owner: "serverpilot", group: "serverpilot"
```
* Execute the following command to reload the VM with the modified Vagranfile :
```bash
$ vagrant reload
```
* Create a database on ServerPilot :

* Go to [pma.local.io](http://pma.local.io) and login with the same `username` and `password` that you used to create the database.
### Create a `sub-domain`
* 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`
* Create a new application on ServerPilot :
* `Name` => `xety`
* `Domain` => `xety.local.io`
* `Server` => `local.io`
* Add `192.168.56.101 xety.local.io` to your `hosts` file.
* Uncomment and adapt (regarding to your path) the following line in the Vagranfile :
```ruby
config.vm.synced_folder '/var/www/Sites/xety', '/srv/users/serverpilot/apps/xety/public', owner: "serverpilot", group: "serverpilot"
```
* Execute the following command to reload the VM with the modified Vagranfile :
```bash
$ vagrant reload
```
* Go to [xety.local.io](http://xety.local.io) and enjoy ! Yes, it's very simple to do.
### Connect to the `SFTP`
Yes, you can connect to the server using the SFTP method !
* Use your prefered software. I will use `FileZilla`.
* Login in FileZilla with the following credentials :
* `Host` => `192.168.56.101`
* `User` => `serverpilot`
* `Password` => `The SFTP password that you provided at the beginning of this tutorial`
* `Port` => `22`
* You can also login with the `vagrant` user :
* `Host` => `192.168.56.101`
* `User` => `vagrant`
* `Password` => `vagrant`
* `Port` => `22`
* 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)
### Share your VM
* Create an account there : https://vagrantcloud.com/account/new
* It's easy with 1 command, follow the `HTTP` method there : https://vagrantcloud.com/help/vagrant/shares/create
* Possible issue :
* `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