The Status site

DSC06474.jpeg

The Zotonic “status” site is the first thing you see once you have installed Zotonic, or if you do not have any sites configured yet.

The site is shown if the requested hostname (aka domain name) is unknown or if the server is accessed by IP address (eg. https://127.0.0.1:8443/). This is what it looks like:

Status site welcome screen
Welcome screen of the Zotonic status site.

This site is also the fallback site for Zotonic.

Since Zotonic supports virtual hosting, it uses the HTTP Host: parameter to see which site should be served at which URL. If it does not find a Host: header, or if the host header does not correspond to any known Zotonic site, it shows the zotonic_status site instead.

Logging in

Upon first visit, the site shows a friendly message, which tells visitors that the site they are looking at has probably not been configured correctly yet.

Pressing the Manage this server button will bring up the login dialog.

The username for the status site is wwwadmin. The password is automatically generated and stored in ~/.config/zotonic/config/[release]/zotonic.config, where [release] is the Zotonic release number, like 1.0.

You can see the password by executing:

bin/zotonic config

You can see the location of the config files with:

bin/zotonic configfiles

When logged in to the Zotonic status site, you can manage the running sites on the system: starting, stopping and upgrading them.

Site listing on Zotonic status site
Site listing on Zotonic status site

The “update” buttons only appear when the site (or Zotonic itself) is under Mercurial or Git revision control. These buttons do a “pull” from the repository and then rebuild the system.

Getting the global sites status

The Zotonic status site exposes an API service to check whether all Zotonic sites are running:

curl -k 'https://127.0.0.1:8443/api/model/zotonic_status/get/check'

The option -k was used because the status site is using a self-signed certificate.

If all sites are running, it returns:

{"result":"ok","status":"ok"}

If one or more sites are failing then it returns:

{"error":"fail","message":"Not all sites are running.","status":"error"}

"Running" means that a site’s status is not "retrying" or "failed"; it ignores sites that are manually stopped or disabled.

This API service can be plugged in to a service like https://www.pingdom.com/ to monitor the availability of all hosted sites at once.

Restarting sites

From the command line:

$ bin/zotonic stopsite yoursitename
Stopping site yoursitename ..ok
$ bin/zotonic startsite yoursitename
Starting site yoursitename .. ok

Alternatively, from the Zotonic shell:

z_sites_manager:restart(yoursitename).

Sites Developer Guide Controllers

Referred by

Getting Started

You have two options for running Zotonic: to get started quickly, start our Zotonic container. Or you can install…

Site configuration

This chapter describes the configuration options for your sites. There’s also global configuration.

Modules

Modules are the building blocks of Zotonic. They add functionality to your Zotonic website such as:

Docker

We offer the Docker image zotonic/zotonic-dev which contains build tools and Erlang.

Dispatch rules

Dispatch rules route incoming requests to controllers.

Directory structure

Zotonic is a set of regular OTP applications. These can be found in the repository’s apps/ directory: