Go to page content

Production Pre-Launch Checklist

Some steps that should be taken in configuring Zotonic prior to opening a server's sites for general consumption.

Why

This guide exists to provide some advice on customizing Zotonic's setup and bringing a Zotonic server to production usage.

Assumptions

Readers are assumed to have built and tested a Zotonic site locally.  To benefit from this guide you should know how to configure the firewall to redirect port 80 and 443 to Zotonic's ports or know how to configure a system like authbind to allow Zotonic to bind directly to those conventional ports.

How

  1. The zotonic addsite has been extended so it can use one of the skeleton sites that have been provided. One skeleton ("blog") is a simple blogging system, just like the default site used to be. The other skeleton ("empty") is just an empty site without any dispatch rules, templates or custom functionality.

    zotonic-addsite [options] <site_name>
        -s <skel>    Skeleton site ('blog' or 'empty'; default: blog)
        -h <host>    Database host (default: 127.0.0.1)
        -p <port>    Database port (default: 5432)
        -u <user>    Database user (default: zotonic)
        -P <pass>    Database password (default: zotonic)
        -d <name>    Database name (default: zotonic)
        -n <schema>  Database schema (default: public)

    Example: (Thanks to Dmitrii Dmandt)

    NOTE: In all below, mysite is a generic stand-in for your specific site name.

    bin/zotonic addsite mysite
  2. Zotonic will create a new site in priv/sites/mysite using the blog skeleton as default. That is, -s option is not necessary, it defaults to "-s blog", which is fine for quite a lot of websites, because it already gives you stuff to play with

  3. Unless you specify options like -h and others, Zotonic will create a priv/sites/mysite/config file with default values:

    % Hostname on which this site runs
    {hostname, "mysite:8000"}, 
    % Aliases which should redirect to the primary hostname 
    %{hostalias, "www.example.com"}, 
    %{hostalias, "example.com"}, 
    % PostgreSQL database connection 
    {dbhost, "127.0.0.1"}, 
    {dbport, 5432}, 
    {dbuser, "zotonic"}, 
    {dbpassword, "zotonic"}, 
    {dbdatabase, "zotonic"}, 
    {dbschema, "public"}, 
    % Password for the 'admin' user. 
    {admin_password, "admin"},
  4. If you provided options on the command line, these will be set accordingly in the file. If you didn't:

    • {hostname, "mysite:8000"}: change the port to reflect your actual setup

    • VERY IMPORTANT: {db*.... options: change them to reflect your actual setup. If you run several sites from a single database, don't forget to change the dbschema option as well

    • set a different admin password

    • Configure /etc/hosts

      If you are running a local version of Zotonic, add the following to your /etc/hosts file:

      127.0.0.1 mysite

      Run "bin/zotonic debug" or "bin/zotonic start", navigate to your site with:

      http://mysite:8000/ where **mysite** is the name of your site.

      http://localhost:8000/ should bring you to the Zotonic server management page.

  5. For production release of your new Zotonic site you need to:

    • Change {hostname, "mysite:8000"} to {hostname, "mysite"} in ../priv/sites/mysite/config

    • configure DNS to point to your new site.

Troubleshooting

There are no known troubleshooting steps for this guide at this time, but please feel free to provide them in the comments below.

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.