<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>docker compose on Andrew Beaton</title>
    <link>https://andrewbeaton.net/tags/docker-compose/</link>
    <description>Recent content in docker compose on Andrew Beaton</description>
    <image>
      <title>Andrew Beaton</title>
      <url>https://andrewbeaton.net/me.jpeg</url>
      <link>https://andrewbeaton.net/me.jpeg</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Thu, 01 Jun 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://andrewbeaton.net/tags/docker-compose/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Creating an Ackee Container with Docker Compose</title>
      <link>https://andrewbeaton.net/posts/2023/06/docker-compose-ackee/</link>
      <pubDate>Thu, 01 Jun 2023 00:00:00 +0000</pubDate>
      
      <guid>https://andrewbeaton.net/posts/2023/06/docker-compose-ackee/</guid>
      <description>Creating an Ackee Container with Docker Compose</description>
      <content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p><a href="https://ackee.electerious.com/">Ackee</a> is a self-hosted, open-source, privacy focused, analytics platform that provides useful insights into your website&rsquo;s traffic.</p>
<p>By running Ackee in a <a href="https://www.docker.com/">Docker</a> container, you can easily deploy and manage it on your own server.</p>
<p>In this guide, I&rsquo;ll talk you through the process of creating an Ackee Docker container and setting it up using <a href="https://docs.docker.com/compose/">Docker Compose</a>.</p>
<h2 id="prerequisites">Prerequisites</h2>
<p>Before you start, ensure you have the following:</p>
<ul>
<li>
<p>Docker installed on your server.</p>
</li>
<li>
<p>Docker Compose installed on your server.</p>
</li>
<li>
<p>Basic knowledge of working with Docker and Docker Compose.</p>
</li>
</ul>
<h2 id="create-a-docker-compose-file">Create a Docker Compose File</h2>
<p>Open your text editor and create a new file named docker-compose.yml.</p>
<p>In this file, we define the configuration for the Ackee Docker container.</p>
<h2 id="define-the-docker-compose-configuration">Define the Docker Compose Configuration</h2>
<p>Copy and paste the following configuration into your docker-compose.yml file:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">version</span>: <span style="color:#e6db74">&#39;3&#39;</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">services</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">ackee</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">electerious/ackee</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">container_name</span>: <span style="color:#ae81ff">ackee</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">restart</span>: <span style="color:#ae81ff">always</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">ports</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#e6db74">&#34;3000:3000&#34;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">environment</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">WAIT_HOSTS=mongodb:27017</span>
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">DATABASE_URI=mongodb://mongo:27017/ackee</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">depends_on</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">mongo</span>
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">mongo</span>:
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">image</span>: <span style="color:#ae81ff">mongo</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">container_name</span>: <span style="color:#ae81ff">mongo</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">restart</span>: <span style="color:#ae81ff">always</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">ports</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#e6db74">&#39;27017:27017&#39;</span>
</span></span><span style="display:flex;"><span>    <span style="color:#f92672">volumes</span>:
</span></span><span style="display:flex;"><span>      - <span style="color:#ae81ff">ackee-mongo:/data/db</span>
</span></span><span style="display:flex;"><span><span style="color:#f92672">volumes</span>:
</span></span><span style="display:flex;"><span>  <span style="color:#f92672">ackee-mongo</span>:
</span></span></code></pre></div><p>This configuration defines two services: ackee and mongo.</p>
<p>The ackee service uses the electerious/ackee Docker image, exposes port 3000, sets the DATABASE_URI environment variable to connect to the MongoDB instance, and depends on the mongo service.</p>
<p>The mongo service uses the mongo Docker image and mounts a volume to persist MongoDB data.</p>
<h2 id="save-the-docker-compose-file">Save the Docker Compose File</h2>
<p>Save the docker-compose.yml file in your desired directory on your server. Make sure you remember the location as we&rsquo;ll use it in the next step.</p>
<h2 id="start-the-ackee-docker-container">Start the Ackee Docker Container</h2>
<p>Open a terminal or command prompt and navigate to the directory where you saved the docker-compose.yml file.</p>
<p>Run the following command to start the Ackee Docker container:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>docker-compose up -d
</span></span></code></pre></div><p>Docker Compose will download the necessary Docker images and start the Ackee and MongoDB containers in detached mode.</p>
<h2 id="access-ackee-in-your-web-browser">Access Ackee in your Web Browser</h2>
<p>Open your web browser and enter the following URL:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-arduino" data-lang="arduino"><span style="display:flex;"><span>http:<span style="color:#75715e">//localhost:3000
</span></span></span></code></pre></div><p>You should now see the Ackee login page.</p>
<p>Create a new user account and log in to the Ackee dashboard.</p>
<p>You have now successfully created an Ackee Docker container and set it up using Docker Compose. You can now start analyzing your website&rsquo;s traffic using Ackee&rsquo;s powerful analytics features.</p>
<h2 id="additional-configuration-options">Additional Configuration Options</h2>
<p>If you want to use a different port for Ackee, you can modify the ports section in the docker-compose.yml file:</p>
<pre tabindex="0"><code>ports:
    - &#34;3000:3000&#34;
</code></pre><p>To allow your domains to connect to Ackee, you can set the ACKEE_ALLOW_ORIGIN environment variable and list your domains:</p>
<pre tabindex="0"><code>ACKEE_ALLOW_ORIGIN=https://domain1.com,https://domain2.com
</code></pre><p>You can specify your username and password in the docker-compose.yml file with the environment variables:</p>
<pre tabindex="0"><code>- ACKEE_USERNAME=username
- ACKEE_PASSWORD=password 
</code></pre><p>Remember to regularly update the docker-compose.yml file to use the latest version of Ackee and MongoDB images to benefit from the latest features and security patches.</p>
<h2 id="summary">Summary</h2>
<p>With Docker Compose, managing your Ackee deployment becomes seamless, allowing you to focus on gaining valuable insights from your website&rsquo;s analytics data.</p>
<p>If you want to look further in to any of the above tools, do take a look at my previous posts and read the official documentation from the following sites:</p>
<p><a href="https://ackee.electerious.com/">Ackee</a><br>
<a href="https://www.docker.com/">Docker</a>
<a href="https://docs.docker.com/compose/">Docker Compose</a></p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
