Development Environment
Setting up your Development Environment
The HUBzero Platform is comprised of many software packages woven together into an a single system. The minimum requirements for developing HUBzero web code can be a simple Linux Apache MySQL PHP (LAMP) server matching the currently supported Linux distribution. At the time of writing, Centos 7. Although the a simple LAMP server should suffice, it should not The HUBzero maintainers try to ensure that system administrators do not have to deviate too much from the stock distribution in order to install HUBzero.
Setup Development Environment via VMware Image
The Hubzero maintainers package a VMware Image available for evaluation and development purposes available for download at https://hubzero.org/download.
Setup Development Environment via Packages
If you are confident in your Linux system administration skills, the Hub can be built via Debian and RedHat packages. Instructions can be found in our documentation under System Administrators. Once the hub is operational, you will want to clone the hubzero-cms repository for development.
See the Getting the Latest Code section for instructions on how to use git to grab the latest code.
Getting the Latest Code
In the pre-packaged development environments listed above, the hubzero-cms code is a snapshot of when the package was created. To obtain the latest code, we will use git to clone the hubzero-cms repository.
In order to get the latest code you will need:
- SSH access to the machine
- sudo privileges
- git
A couple conventions for this section, in particular:
this text
indicates an incantation to be typed in the terminal.- <something> indicates something that should be replaced with value you have set.
- [!] indicates something that should be interpreted, or have your judgment applied.
ssh <username>@<hostname>
- Log into your development server
cd /var/www
[!]- Change into the webroot directory.
- [!]: This may be /www in some configurations.
mv <hubname> <hubname>.bak
[!]- Backup the existing hubzero-cms installation.
- [!]: The name of the directory may change depending on what <hubname> is used for hzcms install. In the documentation, 'example' is used. Therefore the directory will be /var/www/example.
git clone https://github.com/hubzero/hubzero.git <hubname>
- This will clone the latest release into your webroot. The 'dev' branch is the default. You may switch to another available at this step if desired.
- This will create the shell of the application, we will need to (re)-populate it with configuration values and pull in external dependencies later on.
cp <hubname>.bak/app <hubname>/.
- This moves the configuration files back into the application. If prompted, overwrite the new app/ directory.
cd <hubname>/core
- Navigate to the core directory.
php ./bin/composer install
- Pull in external dependencies using composer.
cd ../
- Navigate back to the /var/www/<hubname> directory.
php muse migration -i -f
- Run database migrations. This helps maintain the database's schema between versions. Note: Reversing database schema changes can be extremely difficult if needed.
cd /var/www
- Navigate back to the directory containing the hub installation.
chown apache:apache <hubname> -R
[!]- Change the owner and the group of the hub installation directory.
- [!] The user may be apache OR www-data, depending on the distribution.
chmod 775 <hubname> -R
- Change the file permissions to allow the group to read and write permissions.
sudo usermod -aG apache <username>
- Add your user to the apache group.
git pull --rebase
- Pull the latest code. This should be done periodically.
- Use the rebase flag if you already have some commits that you haven't pushed yet. This puts your work on top of the changes that come downstream.
Note: [!] The permissions scheme used here is NOT production safe. It's used for development purposes. File permissions and your security scheme depend on your needs.