Fork me on GitHub

First steps with Veracrypt

Why Vercrypt?

It's :

Download

Create a container based on keyfile authentication

In this example, my container is called animals and has been created from Veracrypt GUI. This container has no password, it based on key system. The key has been generated from Veracrypt GUI.

  • The container is called animals
  • The key is called animals-key

Add files to container

    cd veracrypt
    veracrypt animals --keyfiles=animals-key --password=''
    tar -cvzf animals.tgz /home/ben/Images/animals-wallpapers
    cp animals.tgz /media/veracrypt1/
    veracrypt -d

Let's backup it on a friend RPI!

    rsync -avzh ben@XXX.XXX.XXX.XXX:/home/ben/veracrypt /home/ben/veracrypt        

Moodle migration procedure

In this post is described how to export you moodle app and import it on another environment.

Export from the source database

     sudo -u postgres pg_dump moodle > /vagrant/shared/dump/moodle-database-exported.sql

Migrate database

Here I sustitute the string 'moodle-dev' by 'moodle-deploy' from 'moodle-database-exported.sql' and write it to 'database-to-import.sql':

     sed 's/moodle-dev/moodle-deploy/g' moodle-database-exported.sql > database-to-import.sql

Let's tar db and filesystem

    tar -cvzf moodle-to-import.tgz database-to-import.sql moodle moodledata/
    exit
    mv ~/vagrant/vagrant-moodle/shared/moodle-to-import.tgz ~/vagrant/vagrant-moodle-deploy/shared/

Cleanup the target machine

Connect on the target machine. here target database is also named 'moodle':

     cd /vagrant/shared
     rm -rf moodle moodledata/
     sudo -u postgres psql -c "DROP DATABASE moodle"
     sudo -u postgres psql -c "CREATE DATABASE moodle"

Import db and filesystem on the target database

    sudo tar -xzf moodle-to-import.tgz
    sudo -u postgres psql --set ON_ERROR_STOP=on moodle < database-to-import.sql

Migrate the config.php file

    sed -i 's/moodle-dev/moodle-deploy/g' moodle/config.php

Configure xdebug with phpstorm with a vagrant box

After loosing a few hours reconfiguring xdebug, phpstorm and vagrant, I found this great ressource. Here are my notes about it:

phpstorm is installed on the hostmachine and the app is running in a vagrant box.

Vagrant guest machine setup

sudo apt-get install php5-xdebug

Edit /etc/php5/mods-available/xdebug.ini :

xdebug.remote_enable=true
xdebug.remote_connect_back=true
xdebug.idekey=MY_AWESOME_KEY

Phpstorm setup

Setup 'php remote debug' configuration

screenshot

Setup 'server' configuration

screenshot

Browser plugin

Enjoy!

  • Puts breakpoints
  • Enable cookie using web browser extension or bookmarklet screenshot
  • Click on the bug icon called 'debug mode'
  • You can now enjoy the debugger (inspect variables, control the execution flow) screenshot