Commits

Nicola Paolucci committed 5e2819e

charts.durdn.com production setup

Comments (0)

Files changed (1)

manifests/production.pp

              "tmux",
              "curl",
              "git-core",
+             "python-pip",
+             "python-virtualenv",
+             "python-dev",   #for charts.durdn.com
+             "libxml2-dev",  #for charts.durdn.com
+             "libxslt-dev",  #for charts.durdn.com
+             "lib32z1-dev",  #for charts.durdn.com
+             "redis-server", #for charts.durdn.com
              "bash"]:
     ensure => present,
     require => Exec["apt-get update", "no-host-key-checking", "nginx-server-names-bucket-size"],
      'domini-insight.com',
      'pen-loop.com',
      'evil-giraffe.com',
+     'charts.durdn.com',
      'tuttivisti.com',
      'awakeninginamsterdam.com'],
   }
+
+  # --------------------------
+  # setup for charts.durdn.com
+  # --------------------------
+  exec { 'add-pip':
+    command => '/bin/echo -e "pip==1.3.1\n" > /tmp/requirements.txt',
+    creates => "/tmp/requirements.txt",
+    before => Python::Virtualenv["/home/nick/env/musan"],
+  }
+
+  service { "redis-server":
+    ensure       => "running",
+    before       => Python::Requirements['/static/flask/musan/requirements.txt'],
+    require      => Package["redis-server"],
+  }
+
+  python::virtualenv { '/home/nick/env/musan':
+    ensure       => present,
+    version      => 'system',
+    requirements => '/tmp/requirements.txt',
+    systempkgs   => false,
+    distribute   => false,
+    owner        => 'static',
+    before       => Python::Requirements['/static/flask/musan/requirements.txt'],
+    require => Package["python-pip", "python-virtualenv"],
+  }
+
+  python::requirements { '/static/flask/musan/requirements.txt':
+    virtualenv => '/home/nick/env/musan',
+    owner => 'static',
+  }
+
+  nginx::resource::upstream { 'charts_flask_app':
+    ensure  => present,
+    members => [
+      'localhost:7847', 
+    ],
+  }
+
+  nginx::resource::vhost { 'charts.durdn.com':
+    ensure   => present,
+    proxy  => 'http://charts_flask_app',
+  }
+
+  exec { 'run-gunicorn-charts': 
+    command => "/bin/bash -c 'source /home/nick/env/musan/bin/activate && cd /static/flask/musan && /home/nick/env/musan/bin/gunicorn -w 4 -b 127.0.0.1:7847 web:app' &", 
+    unless  => "/bin/ps -aux | /usr/bin/pgrep 'musan/bin/gunicorn'", 
+    require  => Python::Requirements['/static/flask/musan/requirements.txt'],
+  }
 } 
 
 include must-have
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.