Create sites vs deploy sites

What’s the difference between creating a site in a server, and actually deploying it?

Creating a site

When you create a site with Moss, it’ll do whatever is required to serve such website from your server. This may include:

  • Installing Nginx (OpenResty) and/or Apache and/or PHP-FPM or Node.js
  • Creating the appropriate config files for them
  • Installing your site certificate or telling Let’s Encrypt to issue one
  • Installing and setting up MySQL if needed
  • Updating firewall rules
  • And the like

Regarding the web server configuration, if you’re used to Nginx terminology, the step 2 above is like creating a server block in the config file. Similarly, it’s like setting up a virtual host (vhost) in Apache.

But the code of your site hasn’t been uploaded yet. If you try to browse your site at this moment you’ll get an HTTP error.

Therefore, your next step is to deploy your site in order to upload the code that comprise your application.

Deploying a site

Moss provides great support for deploying sites under git source control. Basically, you tell Moss the git repo and branch where your code is hosted and it will be deployed when you ask for it.

Deploying sites via git with Moss has many advantages:

  • Moss implements zero-downtime deployments. Your new code won’t become active until it’s been fully released. In the meantime, your old code is still being served. This avoids any disruption to your active users during the update. In addition, if the deployment fails it won’t get activated and the old release will keep working as usual.
  • Click-to-deploy. You can deploy your site with a single click.
  • Push-to-deploy. You can trigger a deployment by pushing your repo to the appropriate branch or tag.
  • Visibility and debuggability. You have real-time information about the deployments which are taking place. Once they’re done, you can check the detailed log of each one.

However, you don’t need to use git in order to deploy a site. You can upload its content by any other means:

  • Using your favorite SFTP client; or
  • copying the content via SCP; or
  • logging into your server via SSH and downloading the content from any remote location.

You may choose the way that better fits your use case.