Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dsiaw+kaiserdocs committed Jul 16, 2024
1 parent 80b8d75 commit 3f57659
Show file tree
Hide file tree
Showing 768 changed files with 233,016 additions and 0 deletions.
289 changes: 289 additions & 0 deletions branches/fix-dns-in-docker/0110-getting_started/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
<!DOCTYPE html>
<html>
<!-- Generated using weaver: https://github.com/davidsiaw/weaver -->
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Kaiser Docs - Getting Started</title>

<link href="../css/bootstrap.min.css" rel="stylesheet">
<link href="../font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="../css/plugins/iCheck/custom.css" rel="stylesheet">

<link href="../css/style.css" rel="stylesheet">


<link href="../css/animate.css" rel="stylesheet">

<link href="../css/main.css" rel="stylesheet">




</head>

<body class=' fixed-sidebar'>

<div id="background" style="z-index: -999; position:absolute; left:0px; right:0px; width:100%; height:100%">

</div>

<div id="content" style="z-index: 0">

<div id="wrapper">

<nav class="navbar-default navbar-static-side" role="navigation">
<div class="sidebar-collapse">
<ul class="nav" id="side-menu">


<li>
<a href="https://tech.degica.com/kaiser/branches/fix-dns-in-docker/"><i class="fa fa-home"></i> <span class="nav-label">Kaiser Docs</span> <span class="label label-primary pull-right"></span></a>
</li>

<li ><a href="https://tech.degica.com/kaiser/branches/fix-dns-in-docker/0110-getting_started/"><i class="fa fa-file"></i><span class="nav-label">Getting Started</span></a></li><li ><a href="https://tech.degica.com/kaiser/branches/fix-dns-in-docker/0115-command-reference/"><i class="fa fa-file"></i><span class="nav-label">Command Reference</span></a></li><li ><a href="https://tech.degica.com/kaiser/branches/fix-dns-in-docker/0120-the-kaiserfile/"><i class="fa fa-file"></i><span class="nav-label">The Kaiserfile</span></a></li><li ><a href="https://tech.degica.com/kaiser/branches/fix-dns-in-docker/0130-databases/"><i class="fa fa-file"></i><span class="nav-label">Databases</span></a></li><li ><a href="https://tech.degica.com/kaiser/branches/fix-dns-in-docker/0140-suffixes/"><i class="fa fa-file"></i><span class="nav-label">Suffixes</span></a></li><li ><a href="https://tech.degica.com/kaiser/branches/fix-dns-in-docker/0510-plugins/"><i class="fa fa-file"></i><span class="nav-label">Plugins</span></a></li>

</ul>
</div>
</nav>
<div id="page-wrapper" class="gray-bg">
<div class="row border-bottom">
<nav class="navbar navbar-static-top " role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
</div>
<ul class="nav navbar-top-links navbar-right">
<!-- NAV RIGHT -->
</ul>
</nav>
</div>
<div class="row wrapper border-bottom white-bg page-heading" style="">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<h2>Kaiser Documentation</h2><ol class="breadcrumb"><li>Getting Started</li></ol>
</div>

</div>
<div class="row " style="">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<br /><div class="ibox float-e-margins"><div class="ibox-content" style="min-height: px"><h1>Prerequisites</h1>

<p>You will need docker to be installed on your machine.</p>
</div><br><div class="ibox-content" style="min-height: px">
<h1>Getting Started with Kaiser</h1>

<p>Kaiser is a Ruby Gem. You can install it using</p>
<div class="CodeRay">
<div class="code"><pre>gem install kaiser
</pre></div>
</div>

<p>We don&#39;t recommend adding it to your bundle files, because Kaiser is more useful as an environment handler than a gem that your program can use.</p>
</div><br><div class="ibox-content" style="min-height: px">
<h1>A Minimal Example</h1>

<blockquote>
<p>Do this tutorial to learn Kaiser!</p>
</blockquote>

<p>Since Kaiser is meant to be used to improve the dev process of a web app, it makes no sense to go into all the different ways it can be used, so this section is written like a <em>tutorial</em> with a simple example to demonstrate its usage.</p>

<p>This tutorial will show you 3 simple steps to illustrate how to get started with Kaiser. At the end of this tutorial you will be directed to where you can find more detailed topics about how to use Kaiser</p>

<h2>1. Start with a folder</h2>

<p>First of all, create a directory called <code>hello</code></p>
<div class="CodeRay">
<div class="code"><pre>mkdir hello
</pre></div>
</div>

<p>And enter it</p>
<div class="CodeRay">
<div class="code"><pre>cd hello
</pre></div>
</div>

<h2>2. Make a simple app</h2>

<p>In order to use this you need a Kaiserfile and a Dockerfile at the very least. </p>

<p>For this very simple example lets make an extremely simple application that serves <code>Hello Kaiser</code>. In order to do this, we just have to create a Dockerfile containing the following:</p>
<div class="CodeRay">
<div class="code"><pre>touch Dockerfile
</pre></div>
</div>
<div class="CodeRay">
<div class="code"><pre># Dockerfile
FROM public.ecr.aws/degica/barcelona-hello

RUN echo 'Hello Kaiser' &gt; /var/www/static/index.html
</pre></div>
</div>

<p>The <code>public.ecr.aws/degica/barcelona-hello</code> image is a simple image that contains just an nginx server and a fileserver that serves out of <code>/var/www/static/</code> in the container. You can find its source code here: https://github.com/degica/barcelona-hello</p>

<p>And then we create a Kaiserfile</p>
<div class="CodeRay">
<div class="code"><pre>touch Kaiserfile
</pre></div>
</div>
<div class="CodeRay">
<div class="code"><pre># Kaiserfile
dockerfile 'Dockerfile'

expose '8080'
</pre></div>
</div>

<h2>3. Start up the App</h2>

<p>Now we initialize Kaiser. We do this with the <code>kaiser init</code> command. This command takes one parameter called the environment name, and it is stored in a configuration file in <code>$HOME/.kaiser/config.yml</code> so it is global to your user.</p>

<p>This allows Kaiser to set up some data required to start your environment. This only needs to be done once. If you want to throw this environment away, you can call <code>kaiser deinit</code></p>
<div class="CodeRay">
<div class="code"><pre>kaiser init hello
</pre></div>
</div>

<p>In this case, we call our environment <code>hello</code>. This is also important as it will be the prefix for the DNS name that will be used for this. In this case by default, setting the environment name to <code>hello</code> makes the URL for the app <code>http://hello.lvm.me</code></p>

<p>Having done that, we can start up the program using:</p>
<div class="CodeRay">
<div class="code"><pre>kaiser up -av
</pre></div>
</div>

<p>And you should be able to go to <code>http://hello.lvm.me</code> and find a page that displays the text <code>Hello Kaiser</code></p>

<h2>That&#39;s all, folks!</h2>

<p>Congratulations for getting to the end of the tutorial for Kaiser! Obviously you would want to find out more!</p>

<p>To find out about how you would provide this application with a database, check out <a href="/0130-databases">Databases</a>.</p>

<p>To find out how to set up HTTPS on your server, go to <a href="/0140-suffixes">Suffixes</a>.</p>

<p>To find out more about setting up environment variables, and other features, go to <a href="/0120-the-kaiserfile">Kaiserfile</a></p>
</div><br><div class="ibox-content" style="min-height: px">
<h2>Useful Commands</h2>

<h3>Run stuff in the container</h3>

<p>You can run stuff inside your container by going</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser login sh
</pre></div>
</div>

<p>And you can do anything inside the container.</p>

<p>If you need root,</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser root sh
</pre></div>
</div>

<h3>Attach to the container</h3>

<p>If you want to run with the container in the foreground simply go</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser attach
</pre></div>
</div>

<p>This is similar to <code>kaiser login</code> but it terminates the running container, whereas <code>kaiser login</code> will simply run you in the same container as the running container.</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser attach nano /etc/hosts
</pre></div>
</div>

<h3>Save database state</h3>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser db_save customer_setup
</pre></div>
</div>

<p>You can also save your database state to a file in your current dir:</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser db_save ./my_setup.dbimage
</pre></div>
</div>

<h3>Load database state</h3>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser db_load customer_setup
</pre></div>
</div>

<p>You can load a previously saved database file that you have</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser db_load ./my_setup.dbimage
</pre></div>
</div>

<h3>Get ports</h3>

<p>Kaiser decides what ports to use on the host. To know them simply go</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser show ports
</pre></div>
</div>

<h3>Curious?</h3>

<p>You can see what Kaiser is doing under the hood with the <code>-v</code> flag:</p>
<div class="CodeRay">
<div class="code"><pre>bundle exec kaiser -v db_reset
</pre></div>
</div>
</div></div>
</div>

</div>

</div>
</div>

</div>

<!-- Mainly scripts -->
<script src="../js/jquery-3.1.1.min.js"></script>
<script src="../js/jquery-ui-1.10.4.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="../js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
asciimath2jax: {
delimiters: [['$$$MATH$$$','$$$ENDMATH$$$']]
}
});
</script>
<script src="../js/MathJax/MathJax.js?config=AM_HTMLorMML-full" async></script>




<!-- Custom and plugin javascript -->
<script src="../js/weaver.js"></script>
<script src='../js/plugins/pace/pace.min.js'></script>

<script>



$( document ).ready(function() {



});
</script>



</body>

</html>

Loading

0 comments on commit 3f57659

Please sign in to comment.