Requirements of shared hosting for Staging/Production with Trellis

Hello again! I’ve asked my question on GitHub issues of Trellis repository already where I was pointed to Roots’s Discourse as a more appropriate place.

So! I am trying to wrap my head around ansible-playbook -i hosts/production server.yml command. If I understand the purpose of this correctly, it should provision my remote environment (shared hosting in my case) with Ansible roles before deploying of my project.

The command fails with the following error:

| => ansible-playbook -i hosts/production server.yml

PLAY [Determine Remote User] ************************************************** 

TASK: [remote-user | Determine whether to connect as root or admin_user] ****** 
ok: [ ->]

TASK: [remote-user | Set remote user for each host] *************************** 
ok: []

PLAY [WordPress Server - Install LEMP Stack with PHP 5.6 and MariaDB MySQL] *** 

GATHERING FACTS *************************************************************** 
ok: []

TASK: [common | Validate Ansible version] ************************************* 
ok: []

TASK: [common | Update Apt] *************************************************** 
failed: [] => {"cmd": "apt-get update '&&' apt-get install python-apt -y -q", "failed": true, "rc": 127}
stderr: /bin/sh: apt-get: command not found

msg: /bin/sh: apt-get: command not found

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/Users/Cibulka/server.retry          : ok=4    changed=0    unreachable=0    failed=1   

And yes, after SSHing into /usr/bin directory of my host, there does not seem to be any aptitude package.

Is there any way around this? And more importantly, is there any list of requirements that the hosting should meet, if I want to use Trellis for staging and deployment?

Sorry again for my general lack of knowledge when it comes to provisioning/deployments - it was today when i bought the awesome Roots Capistrano screencast and started pretty much from there. :smile:

Thank you.

You can’t provision a shared host.

Trellis REAMDE says:

For remote servers you’ll need to have a base Ubuntu 14.04 server already created.

Trellis’ provisioning feature (server.yml playbook) is for installing software on a stock/blank Ubuntu server. The entire purpose of shared hosting is that this is already done for you. Not only would you not want to run server.yml on shared hosting but it would probably break it or just not work (as you saw).

If you want to deploy with Capistrano then don’t use Trellis at all on your remote hosts. If you want to deploy with Trellis then don’t use Capistrano. They are orthogonal to each other.

Howdy, @cibulka! As @ben said, you can’t provision a shared host. The reason for this is they don’t grant you any of the permissions you need in order to provision the server (namely, root access).

Also, with it being shared hosting, everything has already been provisioned for you, so Trellis isn’t really a good fit for that sort of thing. It’s designed to be used with hosts that allow you to spin up Virtual Machines, such as Digital Ocean, Linode, or AWS. Shared hosting is designed to be a one-size-fits-all service, so what they have is what they give you and you’re not able to change it because then you’d change it for everyone else!

1 Like

Thanks a lot for clearing up my confusion! Now it makes a lot more sense. :smile:

So, in my case, I would use Trellis for my local development only (to avoid MAMP-like sollutions). For deployment, I just add more configuration to Bedrock by following a guide like this:

Correct? Thanks again for your patience!

Eactly :smile:

However, I’d advise to modify trellis to provision hosts that matches Your production environment (shared hosting in this case) so You’ll know what will work and what won’t without even needing to hit staging!

OK! Let’s get to it than. :slight_smile: