back arrow Back to the blog PyHost from Start to Finish cover image

PyHost from Start to Finish

By Angus Allman

Angus Allman profile image

Intro

Welcome to PyHost! A simple server provisioning and deployment tool made to speed things up for Django developers like yourself. So you've signed up to get going, but now what?

Firstly, you need to make sure that you either have a DigitalOcean account or a virtual private server (VPS) on another service with a fresh install of Debian 10 on it. Got that? good, let's get going.

For the Walk-Through jump to The Method

The Fundamentals

PyHost is made up of servers and sites, both of which you can create through the system's interface.

Servers

One server in PyHost = one VPS on Digital Ocean (or elsewhere) and creating the server through PyHost allows you to run common tasks on your VPS from our system. With your new server you can:

  • Create and deploy a site
  • Create environment variables (accessible to all sites)
  • Start or stop a Redis instance (for your queued jobs)
  • Add and remove SSH Keys from your server.

You can find information on each action in PyHost Documentation

Sites

To create a site you need a domain name (either your own custom one or a subdomain of pyhost.io you want to use), a Git Repository hosted on a git provider, and that's about it.

Then on your site page, you can:

  • Run your initial deployment
  • Enable automatic deployments
  • Add a one-click SSL (for custom domain names only)
  • Create site-level environment variables
  • view your deployment history

The Method

You've signed up to PyHost... Awesome!

Step 1 - Connecting DigitalOcean

When you log in you'll see the base server page. You can't do much from here yet but you can add your credentials for DigitalOcean or link an existing server. It'll look something like this:

Pyhost Base Server Page

Click on that 'Add Credentials' button to be taken to a form where you can add your credentials. There's a link here that will take you to the DigitalOcean account page to create an API key so you can link your account to PyHost.

DigitalOcean Connect Form

Once that's filled in you will see the real server page.

Step 2 - Creating a Server

Fill in the form to create your server. You'll see small question mark icons which you can hover over to get a little more information about what the field does and how it affects your server. To create a server you need to fill out this form and it will then start the creation and setup process.

You'll be taken to a new page while your server is being set up where you can see your server's passwords.

PyHost Server Page pre-setup

N.b This can take up to 10 minutes to complete so feel free to go and do other things while this happens. You'll get an email when it's done and can take the next steps from there.

Step 3 - Connecting your Git Repository

Sweet! The server set up is done. Next, you'll want to connect your git host account (e.g Github, Bitbucket, Gitlab) to your server.

Git Host connection page

Click on the icon that you want to connect to, sign in to that service and you'll be golden. You'll then be faced with the site creation form.

Step 4 - Creating a Site

Now, you'll see that there's a new form where those big red buttons were before. It'll look a lot like this

Site Creation Form

There are more little questions marks for you to get more information on the fields. This should help to guide you through the site creation process. When you've submitted this form, assuming that everything is valid, then you'll be taken to your brand new site page.

Next, If you click on the 'Initialize' button, then PyHost will deploy your site for you. It'll do all the boring bits that you never really enjoy doing like configuring Nginx and starting Gunicorn. If for some reason, it doesn't work first try, you can click on the 3 red lines, which show it failed and get a full read-out of the logs from your deployment. One reason it may not work is that you haven't configured your environment variables correctly yet and your settings file is looking for them. If this happens, just set the environment variables at the server or site level and give it another run.

You can always click on the 3 red lines when you run any action to get more information on what happened.

If you have any trouble with this at all, then all feel free to email [email protected] with any questions.

I hope you have a blast using PyHost and that it makes your life even the tiniest bit simpler.

Follow @pyhost on twitter for regular updates and new content!