Cloud-oriented Life

Cloud Native Technology Improves Lives

Ingress Nginx with ModSecurity

ModSecurity, sometimes called Modsec, is an open-source web application firewall (WAF). Originally designed as a module for the Apache HTTP Server, it has evolved to provide an array of Hypertext Transfer Protocol request and response filtering capabilities along with other security features across a number of different platforms including Apache HTTP Server,[1][2] Microsoft IIS and Nginx.[3] It is a free software released under the Apache license 2.0.

Read more »

amoeba

Easy cloning of active_record objects including associations and several operations under associations and attributes.

The goal was to be able to easily and quickly reproduce ActiveRecord objects including their children, for example copying a blog post maintaining its associated tags or categories.

Read more »

Use Foreign Data Wrappers in Rails

Foreign Data Wrappers is a fantastic feature of PostgreSQL that allows you to query against external data sources. The external data source is not just a different Postgres database - it could be anything as long as the appropriate extension is available for that particular data source. You can make it work with MySQL, Redis, MongoDB, and even Kafka, so the flexibility is quite impressive. Nevertheless, let’s focus on Postgres-to-Postgres integration, which is available out of the box.

Read more »

Diesel

Diesel is a Safe, Extensible ORM and Query Builder for Rust.

Diesel is the most productive way to interact with databases in Rust because of its safe and composable abstractions over queries.

For this guide, we’re going to walk through some simple examples for each of the pieces of CRUD, which stands for “Create Read Update Delete”. Each step in this guide will build on the previous, and is meant to be followed along.

Read more »

Docker FAQs

Modify container by config file

Each Docker container has a set of config files associated with it. The parameters of that container, such as Image, Port mapping, would be specified in that file.

The config file is a json file at the location /var/lib/docker/containers/<Container ID>/config.v2.json.

1
2
3
4
5
6
7
8
9
10
11
12
13
# Get container id.
$ docker ps

# Or get container id.
$ docker inspect <Container Short ID>

# Stop container
$ docker stop <Container Short ID>

$ vi /var/lib/docker/containers/<Container ID>/config.v2.json

# Start container
$ docker start <Container Short ID>

After stopping the container, the config.v2.json file can be edited to update the corresponding entry for Ports and NetworkSettings. The PortBindings entry in hostconfig.json file is also updated.

After making the changes in config files, Docker service is restarted and container is started.

See Docker - change container configuration in 4 ways - https://bobcares.com/blog/docker-change-container-configuration/ to learn more.

References

[1] Empowering App Development for Developers | Docker - https://www.docker.com/

0%