Development

/Development

Instructions for adding a user to a mongo database for mongo_orm

You don’t want your web application to access the database using your database admin user. Additionally you want it to access only one specific database – maybe you have additional databases running in your mongo instance. Prerequisites:mongo_orm expects the database configuration as environment variables or as a file config/database.yml in your project.The config/database.yml file looks [...]

By | Februar 9th, 2019|Crystal Language|Kommentare deaktiviert für Instructions for adding a user to a mongo database for mongo_orm

Building a persistent in-line editing experience with Crystal, MongoDB (datanoise / sam0x17)

As documentation is still sparse, I would like to add some.This is what I am building currently:The individual fields are going to be editable with an inline editor, which will automatically save to the backend – no need for reloading the whole page.The point of the whole is a backend for my company, to be [...]

By | Februar 5th, 2019|Crystal Language|Kommentare deaktiviert für Building a persistent in-line editing experience with Crystal, MongoDB (datanoise / sam0x17)

Using nuitka compiler for python3 on Alpine Linux ARMHF (musl)

Motivationpidoctor is written in Python (as there was no easy way to get Crystal to work on ARMHF / musl). This means a dependency on Python – which adds overhead. I suspect that this overhead is the reason that pidoctor will not run on 256 MB Raspberry Pi’s – because the RAM is exhausted by [...]

By | Januar 31st, 2019|Alpine Linux, Development|Kommentare deaktiviert für Using nuitka compiler for python3 on Alpine Linux ARMHF (musl)

kemal-session does not persist data

https://github.com/kemalcr/kemal-sessionAnalyse what is happening with your session cookie. In my case, the session cookie was reset everytime I went to login. I realized, that my idea of cleaning up the old session as a first statement after successful login, before setting up the new session is not a good idea. I suspect, that the browser [...]

By | Januar 22nd, 2019|Crystal Language|Kommentare deaktiviert für kemal-session does not persist data

Using modules in crystal

As your application grows, you would like to move from one big .cr file to separating your code into smaller files.You can use require from your main .cr file to add code from other files:require "./tools/*"This statement will add code from the tools directory, relative to your main .cr file.This will help to separate your [...]

By | Januar 22nd, 2019|Crystal Language|Kommentare deaktiviert für Using modules in crystal

The scope of ecr within crystal: or how do I pass in variables and Objects into ECR templates?

As a beginner in the Crystal language I still struggle to get my head around some of the concepts in it, and develop a feel for coding in Crystal.When I come across difficult problems, which I solve or start to understand, I blog about them, so others can benefit – as lack of documentation is [...]

By | Januar 21st, 2019|Crystal Language|Kommentare deaktiviert für The scope of ecr within crystal: or how do I pass in variables and Objects into ECR templates?

Route & Redirect with envoy

An example envoy.yaml showing how to route & redirect.There are different options, see herehttps://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/route/route.proto#route-redirectactionThis envoy.yaml routes /taxgod and /taxgod/ (the second could probably be omitted because the first one should also match it, I think) to a new port and a different protocol. /picockpit is simply redirected to /and then finally / is routed to [...]

By | Januar 17th, 2019|Development|Kommentare deaktiviert für Route & Redirect with envoy

Envoy routing and rewriting snippet

It is possible to rewrite URLs with Envoy for the backend. Please note that the HTML output needs to have the proper routes! (That is why I am not going to investigate further in this direction).REF: https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/route/route.proto#route-route Also note that the string is going to be rendered literally for direct_response –> body –> inline_string, even if [...]

By | Januar 17th, 2019|Development|Kommentare deaktiviert für Envoy routing and rewriting snippet

envoy as http 2 front proxy – enabling http 2 for envoy (aka h2)

Out of the box envoy is not configured to set up connections with clients connecting to it with the new HTTP/2.HTTP/2 is optimized for the modern web, with binary headers, etc. – higher speed. Since envoy is capable of speaking HTTP/2 to clients, it is a no-brainer to set it up.And the setup is really [...]

By | Januar 17th, 2019|Development|Kommentare deaktiviert für envoy as http 2 front proxy – enabling http 2 for envoy (aka h2)

envoy force SSL example envoy.yaml

static_resources:   listeners:   - address:       socket_address:         address: 0.0.0.0         port_value: 80     filter_chains:     - filters:       - name: envoy.http_connection_manager         config:           codec_type: auto           stat_prefix: ingress_http           route_config:             virtual_hosts:             - name: backend               domains: ["*"]               routes:               - match: { prefix: "/" }                 redirect:                   path_redirect: "/"                   https_redirect: true           http_filters:           - name: envoy.router             config: {}   - address:       socket_address:         address: 0.0.0.0         port_value: 443     filter_chains:     - tls_context:         [...]

By | Januar 17th, 2019|Development|Kommentare deaktiviert für envoy force SSL example envoy.yaml