Skip to content

zosyk/The-Venus-Project-website

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The-Venus-Project-website

Github repository for The Venus Project's website

Vagrant

Vagrant allows you to run a virtual machine (vm) on your computer and do your development work within the vm. It can automate the installation and configuration of an operating system in the vm, including the installation and configuration of any software packages you want. It also can keep folders in sync between your host OS and your guest OS (on the vm).

In the vagrant directory here are included configuration files and shell scripts for an automated creation of a full LAMP stack with all needed configurations and software packages for running the TVP website.

To get started with Vagrant:

  1. Install the Vagrant package
  2. Install VirtualBox - this provides the vm functionality
  3. Go through the Vagrant Getting Started Guide (this is only for learning)
  4. Place the Vagrantfile, bootstrap.sh and startup.sh files in the root Vagrant directory on your host OS
    • Vagrantfile contains general setup instructions for your vagrant box
    • bootstrap.sh instructions get executed when provisioning the vagrant box (i.e. installing or reinstalling the guest OS)
    • startup.sh instructions get executed each time you start the guest OS (i.e. on vagrant up)
  5. Create on your host OS the directories that will be synced between host and guest OS:
    • Create var_log inside the root Vagrant directory on your host OS.
    • Create sites-available inside the root Vagrant directory on your host OS.
    • Put the 000-default.conf file inside sites-available. This is Ubuntu's file for virtual hosts.
  6. Add newtvp.example.com to your hosts file on your host OS, map it to 127.0.0.1 (instructions)
  7. Create newtvp directory inside the root Vagrant directory on your host OS.

Troubleshooting

  • If you get the error Errno::EADDRNOTAVAIL when doing vagrant up, see this comment.

Debugging:

Path mappings:
Q: In phpstorm, I have to set up path mappings. does this mean that I have to keep two repositories - one in my host OS and one in the guest OS? even though the one in the guest OS is shared between the two?
A: Vagrant shares the folders, so you only maintain one repo, but for the remote debugging to work, it needs to know where to map them to inside of vagrant

Docker

If you choose to use Docker for your working environment you'll need first to install Docker in your machine: https://docs.docker.com/engine/installation/

Afterwards you should follow these steps for using Docker in your The Venus Project development site:

  • Copy .env.dist file to .env and fill in missing values which you can find in your original wp-config.php.
  • Copy your original wp-content directory from server or backup to docker/www/wp-content/ directory.
  • Run $ docker-compose up. You should see that wordpress container has been started successfully: NOTICE: ready to handle connections.
  • Import DB backups as follows (order matters, because dumps overlap on civicrm_* tables):
    • docker-compose run --rm -v /full/path/to/_wordpressdb.sql:/dump.sql db sh -c 'mysql -hdb -uroot -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" < /dump.sql'
    • docker-compose run --rm -v /full/path/to/_civicrmdb.sql:/dump.sql db sh -c 'mysql -hdb -uroot -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" < /dump.sql'
  • Run $ docker-compose run --rm wordpress php tools/init.php.
  • Run $ docker-compose run --rm wordpress php tools/update-site-domain.php localhost:8080.
  • Grant write permissions to the web-server, e.g.:
    • HTTPDUSER=www-data
    • sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX docker/www
    • sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX docker/www

Now you have several endpoints to work with:

  • http://localhost:8080/ - The Venus Project development website.
  • http://localhost:8081/ - Adminer DB interface to make DB administration easier.
  • http://localhost:8082/ - MailHog, mail debugger. All emails from WordPress and CiviCRM are redirected to MailHog SMTP server (see mail container) and are displayed on this nice web interface.

To setup your admin password go to My Account -> Lost password and restore password for the user thevenusproject. Check your inbox in MailHog and follow the instructions.

More info in these tutorials:

Automation scripts

The file tvp-auto.php automates the creation of the TVP website from filesystem and database backups.

The file ngrok-auto.php automates the changing of the TVP website's domain (on your local environment). This becomes useful when you need to often change the local domain that the site runs on, for example when you are using a tool like ngrok (since ngrok runs on a new domain every time you start it). ngrok comes quite handy when you are testing webhooks (e.g. from Stripe and Paypal) and you need to expose the local website to the Internet in order for the webhooks to reach it. For more information on ngrok, see their docs.

If you use docker, you can run ngrok from a docker image:

  • Run $ docker run --rm -it --net=host wernight/ngrok ngrok http localhost:8080
  • Run $ docker-compose run --rm wordpress php tools/update-site-domain.php yourtempdomain.ngrok.io
  • ngrok web interface is accessible by visiting http://localhost:4040
  • When you are done using ngrok, restore your site URL to localhost: $ docker-compose run --rm wordpress php tools/update-site-domain.php localhost:8080

Automated acceptance tests

The tests.zip file contains a backup of the git repository that we have on Bitbucket. It contains our automated acceptance tests.

About

Github repository for The Venus Project's website

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 79.1%
  • Ruby 11.4%
  • Shell 9.5%