Skip to content

Latest commit

 

History

History
163 lines (123 loc) · 4.59 KB

readme.md

File metadata and controls

163 lines (123 loc) · 4.59 KB

Introduction

This vagrant development setup for os2display is built with ansible.

This vagrant provides the setup for a local version of the os2display server setup.

  • Runs Ubuntu.
  • It installs nginx, php, mysql, symfony, nodejs, redis, etc.
  • It installs a database "os2display" for the symfony backend.
  • Creates the user admin:admin for the backend.
  • Afterwards it starts up the search and middleware nodejs apps.

Vagrant setup

To enable one vagrant to have more than one alias (domain) you need to install the plugin below.

vagrant plugin install vagrant-hostsupdater

Installation

You should use the install.sh script to create the htdocs folder which clones the repositories from http://github.com/os2display.

NOTE: It's important that you have clone the repositories into the htdocs folder before trying to boot the vagrant, as it uses configuration files located in the repositories during setup.

install.sh

Start the vagrant.

vagrant up

Run scripts/site_setup.sh script inde fra vagranten:

vagrant ssh
/vagrant/scripts/site_setup.sh

Activate the search indexes:

/vagrant/scripts/search_activate.sh

Initialize the search indexes:

/vagrant/scripts/search_initialize.sh

Initialize the shared search indexes:

/vagrant/scripts/shared_search_initialize.sh

Fake certificate errors in browser

Since we use self-signed certificated in this vagrant setup, you will need to accept the certificates in the browser, by visiting:

  • screen.os2display.vm
  • admin.os2display.vm
  • search.os2display.vm
  • middleware.os2display.vm

And accepting the certificates.

Development version

If you want to run in development mode, do the following:

Modify scripts/dev_setup.sh to clone your forks of the bundles, instead of the main bundles. All changes should be made on forks, and sent back to os2display as pull requests.

Run the following scripts.

./scripts/dev_setup.sh
./scripts/dev_config.sh

This last script will result in the following error, if run outside the vagrant:

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
handling the post-update-cmd event terminated with an exception

This error can be ignored.

Make sure to run the same php version outside as inside the vagrant.

The first script gets the bundles to the packages/ folder. The second script creates a copy of composer.json from the admin project and replaces the paths with symlinks to the bundles in packages/. This results in the composer-dev.json and composer-dev.lock files. This should be ignored by git, and not committed to the repository.

Afterwards, make sure assets are correctly installed. If not:

vagrant ssh
cd /vagrant/htdocs/admin
app/console assets:install --symlink --relative

Troubleshooting

Search - no mappings

If you get the following error in the admin:

Search error.
Cause: No Living connections

Make sure elasticsearch is running.

ps -ef | grep elasticsearch

Make sure the /var/run/elasticsearch directory is created with the correct permissions:

sudo mkdir -p /var/run/elasticsearch
sudo chown elasticsearch /var/run/elasticsearch

Start it with:

sudo service elasticsearch start
sudo service supervisor restart

Or use the script scripts/fix_elasticsearch.sh from inside the vagrant.

Setup search

If the indexes are not activated by the scripts/search_activate.sh script, do the following:

When the vagrant is done bootstrapping the VM you need to activate the search index by logging into http://search.os2display.vm and click the indexes tab. Then click the activate links foreach index.

Search errors in admin

If the indexes are not initialized by the scripts/search_initialize.sh script, do the following:

Until content has been saved in the admin, the given search index will not have been created. This will result in "SearchPhaseExecutionException" error. Create one of each type of content (channel,slide,screen,media) to fix this error.

MySQL access

If you need to access the database from outside the VM with e.g. Sequel Pro or any other SQL client that can connect via SSH the following can be used.

Name: os2display
MySQL Host: 127.0.0.1
Username: root
Password: 
SSH Host: admin.os2display.vm
SSH User: vagrant
SSH Key: ~/.vagrant.d/insecure_private_key

Logs

  • The middleware and search node have logs in their logs folders /vagrant/htdocs/search_node/logs and /vagrant/htdocs/middleware/logs
  • Nginx have logs in /var/log/nginx
  • Supervisor logs in /var/log/supervisor