amazon web services - Puppet apache configuration file on ubuntu ec2 -
i using puppet provision aws ami using packer , launch ami. puppet configuration , package installations upon baking ami includes installing , configuring apache , wsgi. time launch ami application (a flask application) have been downloaded , configured puppet apache configuration file @ /etc/apache2/sites-available/xxxx.conf . make use of puppet template configure apache configuration file , such ruby template (xxxx.conf.erb) ,the apache configuration template file looks :
<virtualhost *:<%= @port -%>> servername <%= @servername %> serveradmin admin@example.com wsgiscriptalias / /var/www/porfolio/xxxxx.wsgi <directory /var/www/porfolio/> order allow,deny allow </directory> alias /static /var/www/porfolio/static <directory /var/www/porfolio/static/> order allow,deny allow </directory> errorlog ${apache_log_dir}/error.log loglevel warn customlog ${apache_log_dir}/access.log combined </virtualhost>
i have set variable servername = $::hostname (using facter) , port = 80 when launch ami , access public ip address of server of ec2 instance, takes me default ubuntu webpage instead of web flask application. have ssh server , change apache configuration file @ /etc/apache2/sites-available/xxxx.conf become :
<virtualhost *:<%= @port -%>> servername 52.91.143.90 serveradmin admin@example.com wsgiscriptalias / /var/www/porfolio/culturely.wsgi <directory /var/www/porfolio/> order allow,deny allow </directory> alias /static /var/www/porfolio/static <directory /var/www/porfolio/static/> order allow,deny allow </directory> errorlog ${apache_log_dir}/error.log loglevel warn customlog ${apache_log_dir}/access.log combined </virtualhost>
this means have manually type in public ip address of ec2instance in order flask web page display when public ip address accessed on browser. ofcourse defeats level of automation trying achieve. public ip address becomes available after launch ami, there way can re-configure apache configuration file make automatically goto web application instead of default ubuntu web page ? without having me ssh server , manually change after launched
there fact ec2_public_ipv4
, use set address
Comments
Post a Comment