Sabtu, 28 Mei 2022

Standard Notes Server Without Docker

 

Standard Notes Server Without Docker

YOU CAN DEPLOY StandardNotes SERVER WITHOUT ANY DOCKER NONSENSE!

On production use like SN public server, containerization is good, that sweet sweet horizontal scaling! -- but for selfhoster/monolithic system, in some circumstances, problem might be arise if you cannot use docker for some obvious reason: * using OpenVZ VPS * on limited resource SBCs like Raspberry Pi * you just in love/hate relationship with docker :| * or you want to install SN on shared hosting env like cPanel (Yes, you can! this is what I do)

...and its a bit problematic if your system is limited on storage - as working code base of all SN service + the respective node_modules use up to >800MB (we'll tackle this soon!)

Let's get started!

Intro : Standard Notes is open source (consider donate/buy their pro subs ;) ) so everything you need to selfhost is on their repos

"Dockerize" SN server instance is consist of 3 (three) important services: 1. auth server 2. syncing server 3. api gateway server 4. Plus, you need mysql and redis

these services are normally run on dockerize env. api-gateway as the name suggest, is the service that proxied auth and syncing request, also API call chore request from SN client.

Standard Notes is written in Typescript, It's just Javascript with turbocharger attached. So it's not a big deal as long your intended system can install node.

As I emphisize this before, I got an idea to install SN on my shared hosting with only 1 GB disk and 256 MB allocated RAM. I'm confident this is possible on limited compute resource as I assume notes saving/syncing server is not that resource and logic intensive. Also, nowadays shared hosting with cpanel can make use of javascript/node app instead of php -- this feature may vary depending on your host provider. For you that want to make use of these cheap SBCs can also achieve what I done here easily!

What I do

After identifying what is needed to run SN, I clone these repos (auth,syncing, and api-gateway) to one folder for easily organize things. For each services, you want to checkout to latest version suggested by devs or just checkout to branch main (see standalone/docker-compose.yml)

Before compiling, install each repo dependency with npm install

For starters, you cannot directly execute Typescript code with node, you must compile it first. For this, you need tsc to compile Typescript to JS. If you using official VS Code, tsc is provided out of the box, for others you need to install it first using either npm install --save-dev typescript or globally npm install -g typescript (recommended)

To compile, just run tsc -p tsconfig.json on each repo, or again if you using VS Code, use CTRL+SHIFT+B and select relevant build option. Every successive compile will result with no errors/some warning is okay, and populated dist/* folder.

On this step, you actually can move every services dist folder with their node_modules and .env file to another folder, ship it to any device you want, and call it a day. But, if you see, these 3 services with their node_modules ate almost >800 MB on disk. This is not okay in my case of very limited disk space.

Bundler to the rescue

Yes, we playing with JS and so we can benefit from all goodness of JS. JS bundler is one of them. https://github.com/evanw/esbuild/

NODE_OPTIONS --max-old-space-size

https://blog.ximple.ga/2022/03/my-cool-firefox-theme-greeny


Related

https://blog.ximple.ga/2022/05/wireless-airtime-exhaustion/

Selasa, 18 Oktober 2016

Mudah Instalasi Server Squid


Didalam kita melakukan browsing, sering kali kita mendapati bahwa website yang kita tuju dialihkan ke sebuah website lain yang biasanya bertuliskan “Website yang anda tuju tidak sesuai dengan peraturan perundang-undangan yang berlaku” ataupun juga bila kita salah menuliskan nama domain dari website tersebut maka kita akan dikirim ke suatu portal. Beberapa ISP kerap melakukan hal ini, dan dibalik dari ini semua membutuhkan sebuah server yang disebut server proxy.

Rabu, 18 Mei 2016

Web Mail Server Dengan Postfix dan Squirrelmail

Teknologi jaman sekarang memang pesat dan maju. Dulu, jauh sebelum internet merajalela, orang jika ingin berkomunikasi dengan instan harus bertatap mata, tidak bisa berkomunikasi dengan mudah dan cepat melewati batasan jarak dan waktu. Seseorang harus menunggu berminggu-minggu sampai berbulan-bulan untuk mengirim surat ke tempat lain yang jauh. 

Jumat, 18 Maret 2016

Setting Samba Server Debian

 



Kali ini kita akan membahas tentang package yang sangat berguna untuk sebuah server di jaringan. Samba merupakan aplikasi yang menggunakan protokol SMB/CIFS(Server Message Block / Common Internet FIle System) yang digunakan dalam sistem operasi Windows untuk berbagi file dalam jaringan. Samba menyediakan juga service-service jaringan Windows, seperti Active Directory, Domain Controller, dan NT Domain.

Kamis, 21 Januari 2016

Setting DHCP ( Dynamic Host Configuration Protocol ) Dengan Server Debian

Debian memiliki banyak fungsinya untuk menjadi sebuah server yang siap melayani segala sesuatu hal yang diperlukan untuk jaringan, seperti salah satunya adalah penggunaan protokol DHCP yang sangat membantu Pengelola Jaringan agar mudah mengatur alamat IP setiap clientnya.

DHCP merupakan kepanjangan dari Dynamic Host Configuration Protocol. Ya, sesuai namanya, protokol yang satu ini memberikan segala hal tentang setting yang diperlukan client untuk tersambung dengan jaringan, seperti alamat IP, Alamat DNS, Alamat Default Router, dan lain-lain.

Penggunaan DHCP sangatlah mudah, Client tidak perlu bersusah-susah memikirkan "Berapa ya alamat IP saya?" atau "Saya harus hafal alamat IP DNS Server?".