Oscar Domingo - Software Engineer and Open Source enthusiast.Writing about computers and other hobbies./2021-07-19T21:24:19ZOscar Domingo (@minkiu)/Setting up Notea with Minio/2021/07/18/setting-up-notea-with-minio/2021-07-18T21:21:00ZIn this tutorial we’ll be setting up <strong>Notea</strong> (<a href="https://cinwell.com/notea/">https://cinwell.com/notea/</a>) with <strong>Minio</strong> (<a href="https://github.com/minio/minio">https://github.com/minio/minio</a>) for it’s storage, since the former requires a S3 compatible storage, I started with this guide over at CyberHost <a href="https://cyberhost.uk/notea/">https://cyberhost.uk/notea/</a> and changed it to my liking while updating certain bits that have changed since.<p>In this tutorial we’ll be setting up <strong>Notea</strong> (<a href="https://cinwell.com/notea/">https://cinwell.com/notea/</a>) with <strong>Minio</strong> (<a href="https://github.com/minio/minio">https://github.com/minio/minio</a>) for it’s storage, since the former requires a S3 compatible storage, I started with this guide over at CyberHost <a href="https://cyberhost.uk/notea/">https://cyberhost.uk/notea/</a> and changed it to my liking while updating certain bits that have changed since.</p>
<h2>Docker Compose</h2>
<p>We’ll use <code>docker-compose</code>, to install it head to <a href="https://docs.docker.com/compose/install/">https://docs.docker.com/compose/install/</a>, to orchestrate the two services, so let’s create a folder for our project and create a <code>docker-compose.yaml</code> file:</p>
<pre><code>mkdir notea && cd notea && touch docker-compose.yaml
</code></pre>
<p>Now with your favorite editor add the following and replace the <code><values></code> with the correct information:</p>
<pre><code>version: '3'
services:
notea:
image: cinwell/notea
container_name: notea
environment:
- STORE_ACCESS_KEY=<minio-user>
- STORE_SECRET_KEY=<minio-password>
- STORE_BUCKET=notea
- STORE_END_POINT=https://<minio.your.domain>
- STORE_FORCE_PATH_STYLE=true
- PASSWORD=<notea-password>
- COOKIE_SECURE=true
- BASE_URL=https://<notea.your.domain>
ports:
- "3000:3000"
notea-s3:
image: minio/minio
container_name: notea-s3
environment:
MINIO_ROOT_USER: <minio-user>
MINIO_ROOT_PASSWORD: <minio-password>
ports:
- "9000:9000"
volumes:
- /data/notea:/data
entrypoint: sh
command: -c 'mkdir -p /data/notea && /usr/bin/minio server /data'
</code></pre>
<p>If you don’t care where the data (the notes) lives within your host, for backing up reasons, you could use a docker named volume:</p>
<pre><code> notea-s3:
...
volumes:
- notea-volume:/data
...
</code></pre>
<div class="warn-note">
From now on, all commands will require <b>sudo</b>.
</div>
<p>Then we build <code>up</code> the containers and start them <code>-d</code>etached (in the background):</p>
<pre><code>docker-compose up -d
</code></pre>
<p>We can check that everything is nominal by:</p>
<pre><code>docker-compose ps
</code></pre>
<p>And if you want to check the logs of one of the containers you can:</p>
<pre><code>docker-compose logs <container_name>
</code></pre>
<p>If you want to stop them you can do so with:</p>
<pre><code>docker-compose stop
</code></pre>
<p>And if you want to start from scratch you can do:</p>
<div class="danger-note">
This removes all the data associated with our docker-compose, if you used a named volume, you will lose your notes.
</div>
<pre><code>docker-compose down
</code></pre><h2>Nginx (Reverse Proxy)</h2>
<p>Now we need to tell our server to return our notea and minio instance when it receives a request to certain url, for this task I use <code>nginx</code> , to install it head to <a href="https://www.nginx.com/resources/wiki/start/topics/tutorials/install/">https://www.nginx.com/resources/wiki/start/topics/tutorials/install/</a>, with your favorite editor open <code>/etc/nginx/sites-available/your.domain</code> (depending of your distro, this folder might not exist and it’s <code>/etc/nginx/sites-enabled/your.domain</code> for more <a href="https://stackoverflow.com/a/17415606/1987581">https://stackoverflow.com/a/17415606/1987581</a> ) and add:</p>
<pre><code>server {
server_name <notea.your.domain>;
location / {
proxy_pass http://0.0.0.0:3000;
}
}
server {
# Change to your URL, has to match the one in `docker-compose.yaml`
server_name <minio.your.domain>;
# Settings from: https://docs.min.io/docs/setup-nginx-proxy-with-minio.html
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m;
# to restrict file size to a specific value
client_max_body_size 0;
# To disable buffering
proxy_buffering off;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://0.0.0.0:9000;
}
}
server {
server_name <minio.your.domain>;
listen 80;
}
server {
server_name <notea.your.domain>;
listen 80;
}
</code></pre>
<p>Let’s test our config with:</p>
<pre><code>nginx -t
</code></pre>
<p>We now make sure we got SSL certificate ( <code>https</code> ) for our site with the handy <code>certbot</code> utility, to install it head to <a href="https://certbot.eff.org/instructions">https://certbot.eff.org/instructions</a> :</p>
<pre><code>certbot --nginx
</code></pre>
<p>Follow the instructions and enable it for both <code><notea.your.domain></code> and <code><minio.your.domain></code> and apply the redirections.</p>
<p>Now we need to restart the <code>nginx</code> service, in a <code>systemd</code> server:</p>
<pre><code>systemctl restart nginx
</code></pre>
<p>I like to check the status after a restart to make sure everything is fine:</p>
<pre><code>systemctl status nginx
</code></pre><h2>Notea</h2>
<p>Now when visiting <code><notea.your.domain></code> you should be greeted by a password input, use <code><notea-password></code> and you should now be good to go!</p>
<div class="info-note">
Remember to keep these <code><values></code> safe in a password manager and remove them from the file in the server, I change them to <code>redacted</code> but you can put whatever feels right.
</div>
<h2>Updates</h2>
<p>I normally subscribe to new releases on GitHub, <a href="https://github.com/QingWei-Li/notea">https://github.com/QingWei-Li/notea</a>, to know when to restart and get the latest version:</p>
<pre><code>docker-compose stop
</code></pre><pre><code>docker-compose pull
</code></pre><pre><code>docker-compose up -d
</code></pre>
<p>Don’t forget that you can report bugs, suggest features and/or contribute.</p>
<p>That’s all, happy note taking!</p>
Up and running with mynt/2021/07/18/up-and-running-with-mynt/2021-07-18T01:07:00ZSo I finally got around setting up a blog on my personal site, and I did it with <code>mynt</code> (<a href="https://mynt.uhnomoli.com/">https://mynt.uhnomoli.com/</a>), a simple, lean and to the point static site generator written in Python, you can see the code here: <github page><p>So I finally got around setting up a blog on my personal site, and I did it with <code>mynt</code> (<a href="https://mynt.uhnomoli.com/">https://mynt.uhnomoli.com/</a>), a simple, lean and to the point static site generator written in Python, you can see the code here: <github page></p>
<p>I followed the Quickstart guide (<a href="https://mynt.uhnomoli.com/docs/quickstart/">https://mynt.uhnomoli.com/docs/quickstart/</a>) and I adapted the html and CSS from my live site, into <code>mynt</code>, I changed a bit the CSS, removing crust and using a simpler CSS reset (<a href="https://piccalil.li/blog/a-modern-css-reset/">https://piccalil.li/blog/a-modern-css-reset/</a>), and implement CSS for the new pages.</p>
<p>So far the experience is good, will keep you posted.</p>
<p>To innagurate the blog with a Tutorial on Setting up Notea with docker-compose: </p>
<p>Please enjoy the site!</p>