Notes on Devbox

Notes on Devbox

  1. First download with aria2c With metalinks. May be it will be satisfiable for changes…

  2. Update files with zsync

Command:

vagrant dbase setlocal

vagrant up / provision / anything
It will show download progress and inform about the status of a download...

Later:
vagrant dbase sync
The database data files are synced with remote with zsync.

SSH to the machine where Git repositories are stored:

ssh firstbeatmedia

And clone a repository with:

git clone --recursive firstbeatmedia:/home/git-repo/dating.git
git checkout develop
  • vagrant status will list all the relevant virtual machines and their status (running, poweroff, not created)

Totally kill the main VM and recreate it again

# to start the main vm
vagrant up main

# to stop it
vagrant halt main

# to rebuild it
vagrant destroy --force main && vagrant up main

c

Turn Windows features on or off

Simple monitoring tools

There are couple of small utilities that you could use to clear opcode cache, to flush memcached, etc.

<ip>/phpinfo.php
<ip>/apc.php
<ip>/memcached.php
<ip>/memcached/index.php
<ip>:4401 (Mailcatcher)

Local MySQL database

MySQL database will be downloaded to local disk in the background, with minimal interfering with your normal work-flow.

Synchronizing (downloading) can be enabled or disabled. Look for these commands above.

Downloading the whole database at once

There is a possibility, if you want the data right now, to download the whole image of virtual external storage storage.hdd. It contains the whole database, already imported.

Archive file can be downloaded from dropbox, and for obvious reasons, this archive will require a password to be unpacked - FirstBeatMedia_DevBox_Storage

You must be aware of the fact that our databases usually occupy more than 170GB of HDD space. It’s not more than 20GB of archive, but HDD space is huge!

7z format is selected because it’s equally supported on all the platforms, and doesn’t have file-size limits like Zip.

Deploy a storage HDD

Download that image file. Then you must shutdown Devbox, if it’s running. Move somewhere your existing storage.hdd file. Then unpack the new one at it’s place, in a root DevBox directory.

Now you can fire up your Vagrant environment. You have our databases, localy.


Putty Users

Convert putty key files to OpenSSH format: ssh-keygen -i -f <puttygen_key> > “%HOMEDRIVE%\%HOMEPATH%\.ssh\id_rsa”

If you must use Putty

This plugin allows you to use putty to ssh into VMs. It has been tested on Windows and should also work on Linux. Multi-vm environments are supported.

  • You need to have putty in path. Simply check with where putty

  • Vagrant key must be in Putty format, that is not the same as SSH’s format, but it can be easily converted.

Installation

Putty Binary

Download: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

Download the putty executable for your platform and place it’s location on your PATH variable. Seek your operating system manual for instructions on how to modify your PATH variable.

Convert Vagrant’s insecure private key to Putty format

Putty uses a custom format for keys and it does not support OpenSSL keys directly. Using PuTTYgen tool (download), we will convert the private key shipped with Vagrant wich is in OpenSSH format to Putty’s format.

Windows puttygen version doesn’t have much of a command line parameters. So we must convert keys semi-automatic.

puttygen “%HOMEDRIVE%\%HOMEPATH%\.vagrant.d\insecure_private_key”

This will load Vagrant’s private key. You have to export it manually by clicking Save private key. Save the new key right along side the insecure key, with the name insecure_private_key.ppk. Answer yes when prompted to save without a password.

Vagrant will look-up for it’s private key needed for Putty in the same directory as for OpenSSH, only with changed extension to .ppk.


Devbox will git clone projects, but only if there is no existing directory there. You can use this fact to skip pulling repository by simply creating empty directory for project.


You can forbid writing to a hosts file simply by setting read-only attribute on a file. In this way, Devbox will not be able to overwrite hosts file content.


To reread domain list from master SQL server, you can delete /srv/etc/domains_dump.sql file.


a jel moze paralelno [18:17:25] Jelena Tadin: da mi radi i jedno i drugo [18:17:35] Jelena Tadin: mislim, ovaj devbox pravi novi repo? [18:17:57] Colovic Vladan: Tacno. U kome se nalaze ostali. Odnosno, u koje mozes da pomeris ostale kasnije… [18:18:08] Colovic Vladan: Fuck. Upravo sam shvatio da i to moram da objasnim

A nema veze gde cu da podesim u koji dir, recimo dating je meni sad (posto koristim wamp) u C:/wamp/www/git/dating..a ovo ne mora unutar wamp-a biti? [18:47:33] Jelena Tadin: MOzda sad pitam gluposti


Windows speed problems:

Very slow in VirtualBox Virtualbox 4.0.4 Shared Folder Update by Paul Serby

Interesting:

Connection priority! https://www.virtualbox.org/ticket/3851#comment:1

VirtualBox shared folders tragedy:

Disk write

dd if=/dev/zero of=bigfile bs=1024 count=1024000

Normal folder:

1.0 GB copied, 12.6937 s, 82.6 MB/s

Shared folder:

cd /vagrant
1.0 GB copied, 554.069 s, 1.9 MB/s

Disk read

dd if=bigfile of=/dev/null bs=1024 count=1024000

Normal folder:

1.0 GB copied, 3.03461 s, 346 MB/s

Shared folder:

cd /vagrant
1.0 GB copied, 459.669 s, 2.3 MB/s

Difference of 150x times! Woow! Tragedy! Why!

Or git status: time git s (opimized with gitconfig) on vboxsf: 2m 24sec on cifs:


vagrant ssh This command requires a specific VM name to target in a multi-VM environment.

c:\projects\devbox>vagrant ssh main



Vagrant plugins

Install them easily. Search for more plugins on a RubyGems site.

vagrant plugin install vagrant-vbguest

Absolutely a must on Windows, to speed up Ruby:

gem install faster_require

You are noticing that Vagrant has installed embedded Ruby environment, and RubyGems with it. You shouldn’t use it directly, but you can through Vagrant subcommands.


U uputstvu za Devbox: Explain how to acces localhost:redirected port, or host:normal port…

Checking PHP installation

Create a phpinfo file:

echo "<?php phpinfo(); ?>" >/srv/http/phpinfo.php

Get it from browser:

http://10.0.3.10/phpinfo.php

Look for errors in:

tail -n0 -f /var/log/lighttpd/error.log

APC

apt-get install php-apc cp /usr/share/doc/php-apc/apc.php /srv/http/apc.php

user: devbox, pass: devbox

Memcache

Simple Memcache monitor:

http://10.0.3.10/memcache.php

Very advanced Memcache management (phpMemcachedAdmin)

http://10.0.3.10/memcache/index.php

Make sure that Apache has rw right in the temp file folder (default : Temp/) and the entire config directory (Config/)

To do

http://local.dev/phpmyadmin http://local.dev/webgrind

Needed for work

Optionally (present on production server):

  • XDebug

Xdebug http://walkah.net/blog/debugging-php-with-vagrant/ :: PHP Xdebug with Vagrant | walkah vagrant : how to get hostonly ip adress from within chef recipe? - Stack Overflow chef-repo/site-cookbooks/drupal/templates/default/xdebug.ini.erb at master · walkah/chef-repo · GitHub

Start page for tools

johnattebury/Eight-Firefox-Start-Page · GitHub Estacado start page by *Gocom on deviantART

startpage.rwrt upd8 2011.04.18 by ~k3ttc4r on deviantART

lightmanx5/My-Start-Page · GitHub

mczolton/StartPage · GitHub develup/start · GitHub skulbuny/newnewtabpage · GitHub tie-rack/internet-start-page · GitHub


Find out IP from domain: dig +short A utpc-office.dyndns-server.com


Comet

To start node.js comet server, type on main:

cd /srv/projects/dating-node/comet

Dating-node project requires Node.js + node modules (Faye, Memcached):

npm install

Run everytime, to start Comet server:

node comet.js development.json \
  /srv/projects/dating/resources/vhosts/ssl/datingvip.dev.key \
  /srv/projects/dating/resources/vhosts/ssl/datingvip.dev.crt

Or better yet using Forever or Supervisor: nodejitsu/forever · GitHub

Nodemon, Supervisor, Forever

Nodemon vs Supervisor

supervisor is used to restart programs when they crash. It can also be used to restart programs when a *.js file changes. It’s like nodemon and forever together, in one.

npm install supervisor -g

And the alternative would be:

forever nodemon app.js
or: forever start -c nodemon app.coffee
date 01. Jan 0001 | modified 28. May 2021
filename: Notes.Devbox