Switching dev VMs over to development web server

admin's picture

All Devopera VMs come ready-to-run, which means that any service you need to run an application will be started automatically when the machine boots. These services are managed using initd.

If however you want to take your development to the next level, you may want to run a development web server, as opposed to a production web server (Apache). Development web servers typically have some if not all of these sort of advantages, depending on what language they're compiling/interpretting into HTML:

  • No need to restart the server to pick-up changes made to the files (e.g. Python .py files)
  • More debugging information by default
  • Integration with IDEs an runtime debuggers
  • Console access, typically without daemon mode

Stopping Apache

Running a development web server can interfere with the production version if they're both trying to serve web pages on the same port, so it's generally worth stopping that, either temporarily (until reboot):

sudo service httpd stop (CentOS)
sudo service apache2 stop (Ubuntu)

or permanently (after reboot):

chkconfig httpd off (CentOS)
chkconfig apache2 off (Ubuntu)

To clarify whether you actually need to stop Apache, you can see what ports are being served against using the message of the day (MoTD) when you log-in.

Stopping Apache

If you're using a node.js based stack, you'll need to stop forever. We setup custom initd scripts for each of the demo apps we install, so to stop the service you just need to know the name of the app, which is on the app's folder in your home directory or /var/www/node/:

sudo service mean-demo stop

Starting a development server

This is largely specific to the language you're programming in, but generally change into the app directory you're working with (e.g. cd mean-demo) then:

grunt (Node.js, as Node is the N in the MEAN stack)
python manage.py runserver (Python/Django)

Recent Articles

published 3 years 1 month ago

Site

Follow Us

Twitter icon
Facebook icon
LinkedIn icon
SlideShare icon
YouTube icon
RSS icon