Welcome to the ALC Network website code. It's a Wordpress Buddypress site.
We use vagrant to create virtual servers to run this code locally. If you use vagrant most of the work is done for you.
Check out Vagrant's install page to get it on your system.
On the line config.vm.synced_folder ".", "/var/www/alc-dev", nfs: true
this nfs: true
bit makes the VM much faster. Be aware that it might not work on your system
Open up a terminal shell and go to the directory where you'd like the ALC code to live, then clone it from git.
git clone [email protected]:AgileLearningCenters/alc-wordpress-core.git
This will place the core files into your computer!
All the settings for the virtual machine (VM) are in the Vagrantfile
you simply have to run vagrant up
in the terminal from the alc-wordpress-core
folder. So let's do that:
cd ~/alc-wordpress-core
vagrant up
The first time you do this it will take a while because the image of Ubuntu must be downloaded. Next it will fire up the virtual machine, finally it will "provision" it by running install.sh
. This set's up apache and other things on the VM
We configure everything up to run locally on http://alc.dev
but you'll need to update your hostfile. The server's IP address is set to be 192.168.99.99
so you'll need to add the following line(s) to your host file. List of host file locations here
# alc vagrant server
192.168.99.99 alc.dev
192.168.99.99 www.alc.dev
192.168.99.99 starterkit.alc.dev
192.168.99.99 alf.alc.dev
You'll have to add subdomain sites manually! Bummer, let me know if we can fix this.
You need a dump of the live site's database, for now you'll need to ask [email protected] for that.
Move the database dump into the Vagrant sync folder, which happens to be the alc-wordpress-core
folder. It will now show up in your VM at /var/www/alc-dev/
A database is already set up in the VM called alc_wordpress
where we will upload the database dumb. So SSH into your vagrant VM using:
vagrant ssh
Pop over to the synced folder and WP web root:
cd /var/www/alc-dev/
If you got a tar.gz, first untar it:
tar -xvf name-of-db-dump.sql.tar.gz
Then run:
mysql -uroot -proot alc_wordpress < name-of-db-dump.sql
Has this database been prepared? If not, you'll need to run some extra commands:
# grab this lovely utility for find/replacing across a wordpress database:
git clone https://github.com/interconnectit/Search-Replace-DB.git
# use it to remap the domain names from their production norms to our dev rig:
pushd Search-Replace-DB
php srdb.cli.php -h localhost -n alc_wordpress -u root -p root -s "agilelearningcenters.org" -r "alc.dev"
popd
# TODO: scrub away sensitive data
# replace all passwords with 'password'
mysql -uroot -proot -h localhost -e "UPDATE \`wp_users\` SET \`user_pass\`= MD5('password');" alc_wordpress
# Delete this wretched implement:
rm -rf Search-Replace-DB
Replace name-of-db-dump.sql with the actual name of the file
You can copy wp-config-template.php
to wp-config.php
Set the database name to alc_wordpress
and mysql user and pass are root
That should do it!