Note: There are known issues with running VirtualBox on Apple Silicon. Use the Docker option instead.
The application may be installed within a Vagrant VM that is running on Scientific Linux 7. The VM is provisioned using the same Ansible playbook used in production.
- Install VirtualBox.
- Clone the repository.
git clone https://github.com/ucb-rit/coldfront.git cd coldfront
- Prevent Git from detecting changes to file permissions.
git config core.fileMode false
- Checkout the desired branch (probably
develop
). - Install vagrant-vbguest.
vagrant plugin install vagrant-vbguest
- Create a
main.yml
file in the top-level of the repository. This is a file of variables used by Ansible to configure the system.cp bootstrap/ansible/main.copyme main.yml
- Generate a key to be used as the
SECRET_KEY
for Django.# This produces two lines: condense them into one. openssl rand -base64 64
- Customize
main.yml
. In particular, uncomment everything under thedev_settings
section, and fill in the below variables. Note that quotes need not be provided, except in the list variable.django_secret_key: secret_key_from_previous_step db_admin_passwd: password_here redis_passwd: password_here from_email: [email protected] admin_email: [email protected] email_admin_list: ["[email protected]"] request_approval_cc_list: ["[email protected]"]
- Provision the VM. This should run the Ansible playbook. Expect this to take a few minutes on the first run.
vagrant up
- SSH into the VM.
vagrant ssh
- On the host machine, navigate to
http://localhost:8880
, where the application should be served. - (Optional) Load data from a database dump file.
# Clear the Django database to avoid conflicts. python manage.py sqlflush | python manage.py dbshell # Load from the dump file (use the -k option if the command errors because database is being accessed). sh bootstrap/development/load_database_backup.sh [-k] DB_NAME /absolute/path/to/dump.file # Set user passwords. python manage.py set_passwords --password <password>
-
Once the VM has been provisioned the first time, starting and accessing it can be done with:
vagrant up vagrant ssh
-
To stop the VM, run:
vagrant halt
-
To re-provision the VM, run:
vagrant provision
-
The application is served via Apache, so any changes to the application (excluding changes to templates) are not applied until Apache is restarted, which can be done with:
sudo systemctl restart httpd
-
The Ansible playbook can be run manually as follows.
cd /vagrant/coldfront_app/coldfront # Assert that there is a properly-configured main.yml in the current directory. ansible-playbook bootstrap/ansible/playbook.yml
- Note that to skip initial provisioning tasks you can use the
--tags common
or--skip-tags provisioning
arguments toansible-playbook
. - Alternatively, you can set
provisioning_tasks
toFalse
inmain.yml
- Note that to skip initial provisioning tasks you can use the
-
Any custom Django settings can be applied by modifying
dev_settings.py
. Note that running the Ansible playbook will overwrite these.
- By default, emails are configured to be sent via SMTP on port 1025. If no such server is running on that port, many operations will fail. To start a server, start a separate SSH session (
vagrant ssh
), and run the below. All emails will be outputted here for inspection.python -m smtpd -n -c DebuggingServer localhost:1025