zola/documentation/deployment/flyio/index.html
2024-12-10 12:16:49 +00:00

292 lines
15 KiB
HTML

<!DOCTYPE html>
<html lang="en-gb">
<head>
<meta charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Everything you need to make a static site engine in one binary.">
<meta name="author" content="Vincent Prouillet">
<title>Fly.io | Zola </title>
<link rel="stylesheet" href="https://www.getzola.org/site.css">
<link rel="icon" href="https://www.getzola.org/favicon.ico">
</head>
<body>
<header>
<a class="header__logo white" href="https:&#x2F;&#x2F;www.getzola.org&#x2F;">Zola</a>
<nav>
<ul>
<li><a class="white" href="https://www.getzola.org/documentation/" class="nav-link">Docs</a></li>
<li><a class="white" href="https://www.getzola.org/themes/" class="nav-link">Themes</a></li>
<li><a class="white" href="https://zola.discourse.group/" class="nav-link">Forum</a></li>
<li><a class="white" href="https://github.com/getzola/zola" class="nav-link">GitHub</a></li>
</ul>
<div class="search-container">
<input id="search" type="search" placeholder="🔎 Search the docs">
<div class="search-results">
<div class="search-results__items"></div>
</div>
</div>
</nav>
</header>
<div class="content content--reversed">
<div class="documentation">
<aside class="documentation__sidebar">
<ul>
<li>
<span class="documentation__sidebar__title">Getting Started</span>
<ul>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;getting-started&#x2F;overview&#x2F;">Overview</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;getting-started&#x2F;installation&#x2F;">Installation</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;getting-started&#x2F;cli-usage&#x2F;">CLI usage</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;getting-started&#x2F;directory-structure&#x2F;">Directory structure</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;getting-started&#x2F;configuration&#x2F;">Configuration</a>
</li>
</ul>
</li>
<li>
<span class="documentation__sidebar__title">Content</span>
<ul>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;overview&#x2F;">Overview</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;section&#x2F;">Section</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;page&#x2F;">Page</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;shortcodes&#x2F;">Shortcodes</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;linking&#x2F;">Internal links &amp; deep linking</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;table-of-contents&#x2F;">Table of Contents</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;syntax-highlighting&#x2F;">Syntax Highlighting</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;taxonomies&#x2F;">Taxonomies</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;search&#x2F;">Search</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;sass&#x2F;">Sass</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;image-processing&#x2F;">Image processing</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;content&#x2F;multilingual&#x2F;">Multilingual sites</a>
</li>
</ul>
</li>
<li>
<span class="documentation__sidebar__title">Templates</span>
<ul>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;overview&#x2F;">Overview</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;pages-sections&#x2F;">Sections and Pages</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;pagination&#x2F;">Pagination</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;taxonomies&#x2F;">Taxonomies</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;feeds&#x2F;">Feeds</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;sitemap&#x2F;">Sitemap</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;robots&#x2F;">Robots.txt</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;404&#x2F;">404 error page</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;templates&#x2F;archive&#x2F;">Archive</a>
</li>
</ul>
</li>
<li>
<span class="documentation__sidebar__title">Themes</span>
<ul>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;themes&#x2F;overview&#x2F;">Overview</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;themes&#x2F;installing-and-using-themes&#x2F;">Installing &amp; using themes</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;themes&#x2F;creating-a-theme&#x2F;">Creating a theme</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;themes&#x2F;extending-a-theme&#x2F;">Customizing a theme</a>
</li>
</ul>
</li>
<li>
<span class="documentation__sidebar__title">Deployment</span>
<ul>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;overview&#x2F;">Overview</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;sourcehut&#x2F;">Sourcehut Pages</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;netlify&#x2F;">Netlify</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;github-pages&#x2F;">GitHub Pages</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;gitlab-pages&#x2F;">GitLab Pages</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;codeberg-pages&#x2F;">Codeberg Pages</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;edgio&#x2F;">Edgio</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;vercel&#x2F;">Vercel</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;zeabur&#x2F;">Zeabur</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;cloudflare-pages&#x2F;">Cloudflare Pages</a>
</li>
<li class="active">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;flyio&#x2F;">Fly.io</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;aws-s3&#x2F;">AWS S3 Bucket</a>
</li>
<li class="">
<a href="https:&#x2F;&#x2F;www.getzola.org&#x2F;documentation&#x2F;deployment&#x2F;docker-image&#x2F;">Docker image</a>
</li>
</ul>
</li>
</ul>
</aside>
<div class="documentation__content">
<h1>Fly.io</h1>
<p>If you don't have an account with fly.io, you can sign up <a href="https://fly.io/app/sign-up">here</a>.</p>
<p>Then install the <code>flyctl</code> tool following the instructions <a href="https://fly.io/docs/hands-on/install-flyctl/">here</a>.</p>
<p>Create a <code>Dockerfile</code>:</p>
<pre data-lang="Dockerfile" style="background-color:#383838;color:#e6e1dc;" class="language-Dockerfile "><code class="language-Dockerfile" data-lang="Dockerfile"><span style="color:#cc7833;">FROM</span><span> ghcr.io/getzola/zola:v0.17.2 </span><span style="color:#cc7833;">AS </span><span>builder
</span><span>
</span><span style="color:#cc7833;">WORKDIR </span><span>/app
</span><span style="color:#cc7833;">COPY</span><span> . .
</span><span style="color:#cc7833;">RUN </span><span>[</span><span style="color:#c1be91;">&quot;zola&quot;</span><span>, </span><span style="color:#c1be91;">&quot;build&quot;</span><span>]
</span><span>
</span><span style="color:#cc7833;">FROM</span><span> joseluisq/static-web-server:2
</span><span style="color:#cc7833;">COPY</span><span> --from=builder /app/public /public
</span><span style="color:#cc7833;">ENV </span><span>SERVER_PORT 8080
</span></code></pre>
<p>You can now run <code>fly launch</code>. It will detect the <code>Dockerfile</code> and mostly auto-configure everything. Fill out the necessary information, but say &quot;no&quot; to (1) launching any databases and (2) deploying immediately.</p>
<p>Take note of the hostname assigned to your app.</p>
<p>If you already have a Zola site you must now ensure that <code>base_url</code> in <code>config.toml</code> is set correctly using the hostname from your app (or whatever domain you have pointing to the app):</p>
<pre style="background-color:#383838;color:#e6e1dc;"><code><span>base_url = &quot;https://white-snow-9922.fly.dev&quot;
</span></code></pre>
<p>If you don't have an existing site, initialize one with <code>zola init -f</code> and remember to set the correct <code>base_url</code>.</p>
<p>You're now ready to launch your site! Run <code>flyctl deploy</code> and have fun!</p>
<p>Finally, to set up continuous deployment of your site from GitHub, follow <a href="https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/">this</a> guide, steps 4-8. Any changes to your site will now be pushed automatically.</p>
</div>
</div>
</div>
<footer>
©2017-2024 — <a class="white" href="https://www.vincentprouillet.com">Vincent Prouillet</a> and <a class="white" href="https://github.com/getzola/zola/graphs/contributors">contributors</a>
</footer>
<script type="text/javascript" src="https://www.getzola.org/elasticlunr.min.js"></script>
<script type="text/javascript" src="https://www.getzola.org/search.js"></script>
</body>
</html>