Set up your web app

To create your static web application head to the 'Add site' form and follow the steps below:

  • If you haven't done it yet, choose the server of your workspace that will host your web app.
  • Choose 'Static (HTML/CSS/JS)' as the programming language.
  • Provide the name of the site on the server. The base path to the site on your server is /home/<site-user>/sites/<name>.
  • Provide the root domain of your website (e.g. your-site.com). Note that you must either own such domain or use one based on your server's IP address.
  • Choose the git repository that contains your application code. You may select whichever repo available from GitHub, GitLab, Bitbucket, or any other provider. You can also leave this field as 'None' and manage the deployment of your app on your own by means of any other mechanism, but we don't recommend that.
  • Provide the server user that will run your website. Moss proposes one based on the name of your site, but you may create a different user or choose an existing one. If you have multiples websites on a same server, you can isolate them from each other by running them as different users.
  • Choose the SSL certificate that you'll employ for your site. You may tell Moss to generate a free Let's Encrypt certificate or provide your own. If you leave 'None' as certificate, your web won't be reachable through the HTTPS protocol.
  • Check the redirect www to root domain box if you want www.your-site.com to redirect to your-site.com.
  • Check the allow wildcard subdomains box if your website is served from subdomains like abc.your-site.com, def.your-site.com, etc. This option isn't compatible with Let's Encrypt certificates, so you'll have to own a certificate that allows wildcard subdomains or just get rid of HTTPS (something we don't recommend at all).
  • Check the push to deploy box if you want Moss to deploy your app whenever you perform a git push on the repo and branch/tag you've provided.
  • Check the monitoring box if you want Moss to periodically check the health of your website and send you an alert whenever it's down. Usually you'll want to monitor your websites, unless they're for testing or similar environments.

In the 'Advanced' section you may edit the following configs:

  • Choose the web server stack for your site. We recommend that you use Nginx as a standalone web server, but you may use it as a reverse proxy to Apache instead.
  • Provide the root dir within your git repo that contains your website's public content (e.g. index.html). E.g. if these files are within a public/ subdirectory, Moss will set up your web server to serve your site from /home/<site-user>/sites/<name>/current/public.

Once you're done with the previous configuration, click the 'Add' button and wait until Moss finishes the process.

Moss shows the last completed step at any moment so that you can track the progress of the process.

Deploy your web app

Good, Moss has set up your web server to serve your application from the root domain you specified. Now you just need to deploy your app on the server to make it available to the world 😉 

Moss supports zero-downtime deployments by allowing you to specify both pre-activation and post-activation scripts. Whatever you include within the pre-activation script will be run before your new release activates. During that time your previous release is the one being served by the web server. Once this script ends successfully, the new release activates and becomes available to your users. Please edit your deployment flow to provide appropriate pre-activation and post-activation scripts for your site.

If want to manually deploy your app now, click the 'Deploy' button and Moss will start to work.

Alternatively, you may check the 'Push to deploy' option and force deployment by running a git push  against the repo of your web application.

At any moment you can check the output of your latest deployment in /home/<site-user>/sites/<name>/logs/deploy/pre-activation.log and /home/<site-user>/sites/<name>/logs/deploy/post-activation.log.

Check your website is ok

Now it's time to open a browser and visit your site. If you cannot update DNS records at this very moment, you can add a domain alias to browse your website leveraging your server's IP address.

Otherwise, let's update your DNS records. Head to the 'Domain' tab and Moss will show you the records you must set up in your DNS provider. Such records make the canonical domain of your web point to the external IP address of your server.

Once DNS records have been propagated, and provided you're monitoring this website (only if your plan allows it), after a few minutes you can check that your site is globally reachable by heading to the 'Health' tab.

What's next?

Congratulations! Moss set up, deployed, and is monitoring your new web application 😃 . You can keep adding more servers and websites with Moss.

Did this answer your question?