Class: NginxInstance
- Inherits:
-
Object
- Object
- NginxInstance
- Defined in:
- lib/nginxinator/examples/nginxinator_example.rb
Instance Method Summary collapse
-
#config_files ⇒ Object
The values below may be commonly changed to match specifics relating to a particular Docker image or setup:.
- #container_name ⇒ Object
- #docker_run_command ⇒ Object
-
#domain ⇒ Object
For a standard Ubuntu 12.04 Nginx Docker image you should only need to change the following values to get started:.
-
#external_conf_path ⇒ Object
The values below are not meant to be changed and shouldn’t need to be under the majority of circumstances:.
- #external_data_path ⇒ Object
- #external_logs_path ⇒ Object
- #external_sites_enabled_path ⇒ Object
- #external_sock_path ⇒ Object
- #image_name ⇒ Object
- #internal_conf_path ⇒ Object
- #internal_data_path ⇒ Object
- #internal_logs_path ⇒ Object
- #internal_sites_enabled_path ⇒ Object
- #internal_sock_path ⇒ Object
- #local_site_templates_path ⇒ Object
- #local_templates_path ⇒ Object
- #publish_ports ⇒ Object
- #sites_enabled ⇒ Object
- #ssh_user ⇒ Object
Instance Method Details
#config_files ⇒ Object
The values below may be commonly changed to match specifics
relating to a particular Docker image or setup:
42 43 44 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 42 def config_files ["nginx.conf", "ssl.crt", "ssl.key", "mime.types"] end |
#container_name ⇒ Object
87 88 89 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 87 def container_name "#{domain}-nginx-#{publish_ports.collect { |p| p['external'] }.join('-')}" end |
#docker_run_command ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 91 def docker_run_command = [] publish_ports.each do |port_set| += ["--publish", "0.0.0.0:#{port_set['external']}:#{port_set['internal']}"] end [ "--detach", "--tty", "--name", container_name, "--volume", "#{external_data_path}:#{internal_data_path}:rw", "--volume", "#{external_conf_path}:#{internal_conf_path}:rw", "--volume", "#{external_sock_path}:#{internal_sock_path}:rw", "--volume", "#{external_logs_path}:#{internal_logs_path}:rw", , image_name ].flatten end |
#domain ⇒ Object
For a standard Ubuntu 12.04 Nginx Docker image you should only
need to change the following values to get started:
5 6 7 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 5 def domain "client.example.com" end |
#external_conf_path ⇒ Object
The values below are not meant to be changed and shouldn’t
need to be under the majority of circumstances:
75 76 77 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 75 def external_conf_path "/#{container_name}-conf" end |
#external_data_path ⇒ Object
30 31 32 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 30 def external_data_path "/var/www/current" end |
#external_logs_path ⇒ Object
34 35 36 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 34 def external_logs_path "/var/log/nginx" end |
#external_sites_enabled_path ⇒ Object
79 80 81 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 79 def external_sites_enabled_path "#{external_conf_path}/sites-enabled" end |
#external_sock_path ⇒ Object
83 84 85 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 83 def external_sock_path "#{external_conf_path}/run" end |
#image_name ⇒ Object
26 27 28 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 26 def image_name "snarlysodboxer/nginx:0.0.0" end |
#internal_conf_path ⇒ Object
50 51 52 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 50 def internal_conf_path "/etc/nginx" end |
#internal_data_path ⇒ Object
46 47 48 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 46 def internal_data_path "/var/www/current" end |
#internal_logs_path ⇒ Object
58 59 60 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 58 def internal_logs_path "/var/log/nginx" end |
#internal_sites_enabled_path ⇒ Object
54 55 56 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 54 def internal_sites_enabled_path "/etc/nginx/sites-enabled" end |
#internal_sock_path ⇒ Object
62 63 64 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 62 def internal_sock_path "/var/run/unicorn" end |
#local_site_templates_path ⇒ Object
111 112 113 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 111 def local_site_templates_path "#{local_templates_path}/sites-enabled" end |
#local_templates_path ⇒ Object
107 108 109 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 107 def local_templates_path "templates/nginx" end |
#publish_ports ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 13 def publish_ports [ { "external" => "80", "internal" => "80" }, { "external" => "443", "internal" => "443" } ] end |
#sites_enabled ⇒ Object
9 10 11 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 9 def sites_enabled ['client-app'] end |
#ssh_user ⇒ Object
66 67 68 |
# File 'lib/nginxinator/examples/nginxinator_example.rb', line 66 def ssh_user ENV["USER"] end |