{"result":{"depiction_url":null,"edges":{"references":{"objects":[{"created":"2020-05-30T05:48:00Z","object_id":{"id":1547,"is_a":["text","documentation","reference"],"name":"doc_reference_cli_index","title":"Command-line","uri":"https:\/\/zotonic.com\/id\/1547"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}}},"id":2085,"is_a":["text","documentation","reference"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2085"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_reference_cli_cli_addsite","page_url":{"en":"https:\/\/zotonic.com\/docs\/2085\/the-addsite-command","x-default":"https:\/\/zotonic.com\/docs\/2085\/the-addsite-command"},"preview_url":null,"resource":{"body":"<div>\n            \n  <div class=\"section\">\n\n<p>Adding a site to Zotonic is done through the <a class=\"reference internal\" href=\"\/id\/doc_reference_cli_index#ref-cli\"><span class=\"std std-ref\">zotonic<\/span><\/a> shell command. It syntax is like this:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"n\">zotonic<\/span> <span class=\"n\">addsite<\/span> <span class=\"p\">[<\/span><span class=\"n\">options<\/span><span class=\"p\">]<\/span> <span class=\"o\">&lt;<\/span><span class=\"n\">site_name<\/span><span class=\"o\">&gt;<\/span>\n<\/pre><\/div>\n<\/div>\n<p>This command creates a new site with [site_name] as the site’s\nname. This new site will be based on a so-called <cite>skeleton\nsite<\/cite>. Currently there are four skeletons: ‘blog’, ‘empty’\nand ‘nodb’. ‘blog’ is the default.<\/p>\n<p>The addsite command is highly configurable and takes the following options:<\/p>\n\n<p><div class=\"table-wrapper\"><table class=\"docutils option-list\">\n<col class=\"option\"><\/col>\n<col class=\"description\"><\/col>\n<tbody valign=\"top\">\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-s <var>&lt;skel&gt;<\/var><\/span><\/kbd><\/td>\n<td>Skeleton site (one of ‘blog’, ‘empty’, ‘nodb’; default: blog)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-H <var>&lt;host&gt;<\/var><\/span><\/kbd><\/td>\n<td>Site’s hostname (default: &lt;site_name&gt;.test)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-L<\/span><\/kbd><\/td>\n<td>Create the site in the current directory and symlink it into the zotonic user directory<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-g <var>&lt;remote&gt;<\/var><\/span><\/kbd><\/td>\n<td>Create a git repository in the site and push it to the given remote<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-h <var>&lt;host&gt;<\/var><\/span><\/kbd><\/td>\n<td>Database host (default: localhost)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-p <var>&lt;port&gt;<\/var><\/span><\/kbd><\/td>\n<td>Database port (default: 5432)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-u <var>&lt;user&gt;<\/var><\/span><\/kbd><\/td>\n<td>Database user (default: zotonic)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-P <var>&lt;pass&gt;<\/var><\/span><\/kbd><\/td>\n<td>Database password (default: zotonic)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-d <var>&lt;name&gt;<\/var><\/span><\/kbd><\/td>\n<td>Database name (default: zotonic)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-n <var>&lt;schema&gt;<\/var><\/span><\/kbd><\/td>\n<td>Database schema (default: &lt;site_name&gt;)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-a <var>&lt;pass&gt;<\/var><\/span><\/kbd><\/td>\n<td>Admin password (default: admin)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-A <var>&lt;app&gt;<\/var><\/span><\/kbd><\/td>\n<td>If true, initializes a site app and a root supervisor when the site starts (default: false)<\/td><\/tr>\n<tr><td class=\"option-group\">\n<kbd><span class=\"option\">-U <var>&lt;umbrella&gt;<\/var><\/span><\/kbd><\/td>\n<td>If true, the site dir becomes a multi-app structure (default: false)<\/td><\/tr>\n<\/tbody>\n<\/table><\/div>\n<\/p>\n<div class=\"section\">\n<h2>Adding a site<\/h2>\n<p>When adding a site, the site will be created in the Zotonic user\ndirectory. When <code class=\"docutils literal notranslate\"><span class=\"pre\">-L<\/span><\/code> is used, the site will be created in the\ncurrent directory (from which the <code class=\"docutils literal notranslate\"><span class=\"pre\">addsite<\/span><\/code> command is ran), and a\nsymlink into the Zotonic user directory will be made.<\/p>\n<p>Before adding the site, the command will print out an\noverview of what it will do before continuing.<\/p>\n<p>For instance, consider the following addsite command:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"n\">zotonic<\/span> <span class=\"n\">addsite<\/span> <span class=\"o\">-<\/span><span class=\"n\">s<\/span> <span class=\"n\">blog<\/span> <span class=\"n\">myfirstblog<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Will print out the following:<\/p>\n<div class=\"highlight-none notranslate\"><div class=\"highlight\"><pre><span><\/span>************\nWarning!\n************\nSite: &#39;myfirstblog.test&#39; cannot be reached.\nCommand &#39;host myfirstblog.test&#39; must resolve to an IP address,\notherwise you won&#39;t be able to reach it after installing the site.\nYou can fix that by adding the following line to \/etc\/hosts:\n\n127.0.0.1         myfirstblog.test\n\n\n==== Add site ====\n\nSite name: myfirstblog\nSite URL: http:\/\/myfirstblog.test:8000\/\n\nSkeleton site: blog\nSite directory: \/home\/user\/zotonic\/apps_user\/myfirstblog\nAdmin password: admin\n\nDatabase host: 127.0.0.1\nDatabase port: 5432\nDatabase user: zotonic\nDatabase password: zotonic\nDatabase name: zotonic\nDatabase schema: myfirstblog\n\n&gt;&gt;&gt; Hit return to proceed...\n<\/pre><\/div>\n<\/div>\n<p>First, it will warn you that the hostname that this site (initially)\nwill have, is not yet resolvable. Add the hostname to your local hosts\nfile to be able to see the site when it has finished installing.<\/p>\n<p>After this warning, the <cite>addsite<\/cite> command will print out an overview\nof what it will do. It will show the site name, the URL the site will\nbe reachable on, in which directory the site will be installed, et\ncetera. An overview of the database credentials and the admin password\nwill also be printed. After hitting return, the site will be created\nand built for the first time. This will take a few moments, after\nwhich you will be able to visit the site’s URL in your browser.<\/p>\n<\/div>\n<div class=\"section\">\n<h2>Default values to <cite>zotonic addsite<\/cite><\/h2>\n<p>The “addsite” subcommand checks a file called\n<code class=\"docutils literal notranslate\"><span class=\"pre\">$HOME\/.zotonic-defaults<\/span><\/code> for the default values to these\noptions. This file is a file in bash-syntax which can define the\nfollowing variables: <code class=\"docutils literal notranslate\"><span class=\"pre\">SKEL<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">DBHOST<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">DBPORT<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">DBUSER<\/span><\/code>,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">DBPASSWORD<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">DBDATABASE<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">DBSCHEMA<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">ADMINPASSWORD<\/span><\/code>,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">SITEHOSTNAME<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">DO_LINK<\/span><\/code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">TARGETDIR<\/span><\/code>.<\/p>\n<p>For instance, if you want all new Zotonic sites to be created in\n\/var\/www and have hostnames like <cite>www.mysite.intra<\/cite>,\n<cite>www.anothersite.intra<\/cite>, add the following to your\n<code class=\"docutils literal notranslate\"><span class=\"pre\">$HOME\/.zotonic-defaults<\/span><\/code> file:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"n\">export<\/span> <span class=\"nv\">SITEHOSTNAME<\/span><span class=\"o\">=<\/span><span class=\"s\">&quot;www.%%SITE%%.intra&quot;<\/span>\n<span class=\"n\">export<\/span> <span class=\"nv\">TARGETDIR<\/span><span class=\"o\">=\/<\/span><span class=\"n\">var<\/span><span class=\"o\">\/<\/span><span class=\"n\">www<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h2>Available skeleton sites<\/h2>\n<p>Zotonic comes with four different skeletons to base your site on.<\/p>\n<dl class=\"docutils\">\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">blog<\/span><\/code><\/dt>\n<dd>As a full example of a Zotonic website, it installs a front page\nwith a listing of recent articles. As default example data, three\nexample articles and a couple of images are also installed.<\/dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">empty<\/span><\/code><\/dt>\n<dd>An empty skeleton. No templates or dispatch rules whatsoever are\ncreated. You can use this skeleton to create a new site based on\nyour own base templates, a custom CSS framework, etc.<\/dd>\n<dt><code class=\"docutils literal notranslate\"><span class=\"pre\">nodb<\/span><\/code><\/dt>\n<dd>Like the <cite>empty<\/cite> template, but this skeleton does not require a\ndatabase connection. As such, the admin and content management\ninterface is disabled, as those modules all require a database\nconnection.<\/dd>\n<\/dl>\n<\/div>\n<\/div>\n\n\n           <\/div>","category_id":{"id":319,"is_a":["meta","category"],"name":"reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/reference"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2020-05-30T05:47:58Z","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/ref\/cli\/cli-addsite.rst","is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2023-06-24T08:18:01Z","modifier_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"name":"doc_reference_cli_cli_addsite","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2023-06-24T08:18:01Z","slug":"the-addsite-command","title":"The addsite command","title_slug":"the-addsite-command","tz":"UTC","uri":null,"version":3934,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/2085","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2085"}},"status":"ok"}