All posts by PF

HAProxy, Docker, Shipyard, CoreOS etc.

Some readings for today.

HAProxy as a static reverse proxy for Docker containers

You can’t have lots of containers listening on the same public port 80, so you have to have your containers listening on some random port like 4553, 4566, 4333 etc. But your site’s visitors are coming to port 80 so you need to somehow listen to port 80 and forward requests to the right Docker container on the right port.

There are several ways to do this and I started out with Nginx as a reverse proxy. This works fine but I don’t want a web server doing that. I’ve used HAProxy in the past for load balancing. And it is actually just what I need, a load balancer is made for forwarding requests.

Read more at http://oskarhane.com/haproxy-as-a-static-reverse-proxy-for-docker-containers/

rock ssd

Auto-loadbalancing with Fig, HAProxy and SERF

http://www.centurylinklabs.com/auto-loadbalancing-with-fig-haproxy-and-serf/

 

Shipyard

Management from a Single View
Shipyard gives you the ability to manage Docker resources including containers, images, hosts, and more all from a single management interface.

Multi-Host Support
Shipyard can manage multiple Docker hosts giving the flexibility to build redundant, highly available applications.

Container Metrics
Shipyard monitors and reports container metrics such as CPU and Memory utilization.

 

http://shipyard-project.com/

 

SERF, from hashicorp, the creators of Vagrant

A decentralized solution for service discovery and orchestration that is lightweight highly available, and fault tolerant.

http://www.serfdom.io/

 

CoreOS

CoreOS is a new Linux distribution that has been rearchitected to provide features needed to run modern infrastructure stacks. The strategies and architectures that influence CoreOS allow companies like Google, Facebook and Twitter to run their services at scale with high resilience. We’ve implemented them correctly so you don’t have to endure the slow, learn-as-you-go infrastructure building process.

Today we’re excited to announce that official CoreOS images are available on Google Compute Engine. This means it’s now even easier to spin up a CoreOS cluster on GCE using the API or from the command line. Adding an instance is as simple as:

Strange characters, even using meta charset=”UTF-8″

I’v deployed a work on one of my clients – a french one – server and even using charset=”UTF-8″ meta in HTML, some characters were displayed different from what they should.

cópia was showed cópia

I had to add the following line to .htaccess – forcing the Charset to be UTF-8

AddDefaultCharset UTF-8

or

AddDefaultCharset Off

disabling Default Charset! 🙂

http://httpd.apache.org/docs/2.0/mod/core.html#adddefaultcharset

Introduction to NoSQL by Martin Fowler

 

 

Know more about  Martin Fowler.
NoSQL Intro by Martin Fowler.

 

Like a blog it captures small items on many topics which are mostly read through my feed. Like a wiki, however, each entry is a wikiWord as I try to organize the bliki through named concepts. I write the entries to be things that are valid for a long time, and most bliki posts are just as valid now as when I wrote them.

The bliki, like much of the website, has grown and now has over 400 entries. The tags are probably the best way to explore it. There is also a page with all the recent bliki entries. All bliki entries are put, with full text, into my news feed.

 

NAXSI: protecting websites with Nginx

NAXSI is Nginx Anti XSS & SQL injection. In simple words, it’s a firewall for web applications (WAF) for Nginx, protecting from XSS, SQL injections, CSRF, Local & Remote file inclusions. NAXSI is known for its fast working and simple configuring. It’s a good alternative for mod_security in Apache.

What would you need NAXSI for?

It’s obvious that’s the best way of protection from attacks is correctly written code, but in some situations WAF and particularly NAXSI can help:

  • low quality of site code with no resources or possibilities of rewriting it;
  • closed source code in which fixing mistakes is impossible;
  • the quality of code is unknown and unpredictable (i.e. shared hosting).

Read more at http://howtounix.info/howto/naxsi-nginx-firewall

Got it from my friend from hexcode.org

WordPress – backup and restore!

 

Export/Backup your MySQL database to a .sql
mysqldump -u [uname] -p db_name > ~/db_backup.sql
Copy the .sql file for other server

Copy the generated file, on your user’s home to the new server with scp.

scp ~/db_backup.sql [email protected]:/home/username
Create a new database to import it into

Login into the mysql

mysql -u root -p

Create the database

create database database_name;
Import/Recover your .sql files to mysql
mysql> use database_name;
mysql> source /full/path/your_file.sql;
Create and grant privileges for your NON ROOT user
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
Grant privileges for your NON ROOT user use it.
grant all privileges on database.* to username@localhost identified by 'password';
FLUSH PRIVILEGES;