tomo's blog

How to remotely connect to MySQL database running on a Vagrant box

While it's common to run PhpMyadmin on servers to manage MySQL databases on them, doing so can open up security holes and so many folks choose not to. But running mysql client from the command line can be painful for heavy use - although a quick "drush sql-cli" to connect to a Drupal database comes in handy. So let's say you are using Vagrant to create and provision your servers, whether local or in the cloud, and you want to use GUI tools to run queries on the database. Instead of opening up access to your mysql server to all Internet hosts and thus being vulnerable to...

Ansible in a nutshell and Ansible terms defined

Ansible is a Python script that sshes to your servers (requiring no daemon listening on the servers) and configures them according to "idempotence". Idempotency basically means you describe what state you want, Ansible figures out how to get to that state, versus you specifying what is run and how it is run. Thus you can "run" Ansible plays over and over and it does the "right thing" instead of repeating your commands. Ansible is really useful for repeatedly setting up servers which need to be set up the same way, a better approach than "ad hoc" configuring them over ssh in a shell with no...

Quickly start using Vim (and MacVim)

You've decided learning vi/vim is a good idea. You've heard it can be intimidating at first. But you know often times tools with steep learning curves are worth learning. You probably already have vim installed but if you're on Mac you should get MacVim as well: https://github.com/macvim-dev/macvim

Start vim (I mean just type 'vim' or 'vim <filename>' in a terminal. 

1. Don't start typing yet. Press 'i' to go into insert mode where you can just type and text appears like any normal text editor. Just stay in this

...

Quick MySQL cache tuning tips using Mysqltuner and Mysqladmin

MySQL is the default relational database for web today as part of the ubiquitous LAMP stack. Postgres has a reputation for better data integrity (whereas MySQL has a reputation for losing data) where MySQL runs faster at the cost of data robustness. But when you're running a few "heavy" websites, especially running Drupal or other CMS sites, then you'll be depending on your database server to perform a lot of queries quickly.

1. You want to see just how busy your database server is. Use...

Migrating from VPS or Cloud servers to OpenShift PaaS

Hackability means never having to say "it can't be done".

Amazon currently dominates the cloud computing industry it created by allowing for easily scalable and granularly billed computing time. Microsoft's Azure platform and Google's Cloud Engine (not their App Engine) are welcome competition. But then there is RedHat, a server giant which has been merely lurking, and is now trying to attract people to their own platform (or platform offerings), like the PaaS they host called OpenShift Online.

OpenShift itself is free software (which is at openshift....

Ansible tips and tricks

I wonder how many people in Vietnam know DevOps. Not everyone even agrees on what the term DevOps even means. There's no Vietnamese ops or devops community and very few people talking about it. But DevOps is something any full stack web developer needs to master nowadays, and it goes beyond being able to set up and sysadmin a Linux server.  Here I'll take devops to mean the procedures for setting up the servers which will run your organizations (web) applications, mostly in the cloud.

Ansible, Puppet, Chef: server orchestration tools using Ruby, except Ansible which...

Set up free hosting for Drupal 7 on OpenShift Online

If you're reading this, it means OpenShift is working. It means Drupal is set up using a free tier "gear" on RedHat's OpenShift PaaS. It's actually not completely easy for those of you used to a real VPS for hosting, and it's not any easier for those who are used to FTP-only shared hosting either. But you won't have to bother installing an OS, or installing Apache, PHP, and MySQL. On the other hand, you won't have much control over which version of those you run unless you code your own OpenShift "cartridges" which is much more work than simply installing packages on a server. ...