Compare commits
2 commits
63e8be257b
...
0c0c32bb7e
Author | SHA1 | Date | |
---|---|---|---|
|
0c0c32bb7e | ||
|
2a22d854d6 |
8 changed files with 67 additions and 5 deletions
|
@ -4,6 +4,7 @@ nginx:
|
||||||
https:
|
https:
|
||||||
port: 8080
|
port: 8080
|
||||||
prot: http
|
prot: http
|
||||||
|
wildcard: true
|
||||||
|
|
||||||
portal:
|
portal:
|
||||||
Dev:
|
Dev:
|
||||||
|
@ -11,3 +12,4 @@ portal:
|
||||||
name: Clark Family Genealogy
|
name: Clark Family Genealogy
|
||||||
summary: Clark Family Genealogy Dev Site
|
summary: Clark Family Genealogy Dev Site
|
||||||
public: false
|
public: false
|
||||||
|
wildcard: true
|
||||||
|
|
37
states/roles/maintain/laradev/branch.conf
Normal file
37
states/roles/maintain/laradev/branch.conf
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name -branch-.-server-.actcur.com;
|
||||||
|
root /sites/-server-/-branch-/public;
|
||||||
|
|
||||||
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
rewrite_log on;
|
||||||
|
|
||||||
|
location @laravel {
|
||||||
|
rewrite ^(/[^/]+/[^/]+)/(.*)$ $1/index.php?$2 last;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ @laravel;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /favicon.ico { access_log off; log_not_found off; }
|
||||||
|
location = /robots.txt { access_log off; log_not_found off; }
|
||||||
|
|
||||||
|
error_page 404 /index.php;
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.(?!well-known).* {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
error_log /var/log/nginx/ra_error.log notice;
|
||||||
|
access_log /var/log/nginx/ra_access.log;
|
||||||
|
}
|
|
@ -8,6 +8,8 @@ branches=`git ls-remote {{repo}} | grep -o -P "(?<=refs/heads/).*"`
|
||||||
echo "Branches:<br/>" > /sites/{{project}}/index.php
|
echo "Branches:<br/>" > /sites/{{project}}/index.php
|
||||||
for branch in $branches; do
|
for branch in $branches; do
|
||||||
echo " <a href='$branch/public/'>$branch<br/>" >> /sites/{{project}}/index.php
|
echo " <a href='$branch/public/'>$branch<br/>" >> /sites/{{project}}/index.php
|
||||||
|
#create/update nginx conf file
|
||||||
|
sed -e "s/-branch-/$branch/" -e "s/-server-/{{project}}/" /root/scripts/laradev-branch-nginx.template > /etc/nginx/conf.d/laradev-{{project}}-$branch.conf
|
||||||
#clone new branch if necessary
|
#clone new branch if necessary
|
||||||
if [ ! -d "$branch" ];then
|
if [ ! -d "$branch" ];then
|
||||||
git clone -b $branch {{repo}} "$branch"
|
git clone -b $branch {{repo}} "$branch"
|
||||||
|
@ -41,4 +43,5 @@ echo " <a href='$branch/public/'>$branch<br/>" >> /sites/{{project}}/index.php
|
||||||
done
|
done
|
||||||
chown http:http "/sites/{{project}}" -R
|
chown http:http "/sites/{{project}}" -R
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
systemctl restart nginx
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -101,6 +101,13 @@ laradev-nginx-conf:
|
||||||
- template: jinja
|
- template: jinja
|
||||||
password: "{%- include 'secure/passwords/laradev_db_password.txt' -%}"
|
password: "{%- include 'secure/passwords/laradev_db_password.txt' -%}"
|
||||||
|
|
||||||
|
/root/scripts/laradev-branch-nginx.template:
|
||||||
|
file.managed:
|
||||||
|
- source: salt://roles/maintain/laradev/branch.conf
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: 644
|
||||||
|
|
||||||
"/lib/systemd/system/git_branches.service":
|
"/lib/systemd/system/git_branches.service":
|
||||||
file.managed:
|
file.managed:
|
||||||
- source: salt://roles/maintain/laradev/git_branches.service
|
- source: salt://roles/maintain/laradev/git_branches.service
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
server {
|
server {
|
||||||
listen 8080;
|
listen 8080;
|
||||||
server_name {{server}};
|
server_name {{server}}.actcur.com;
|
||||||
root /sites/{{server}};
|
root /sites/{{server}}/prod/public;
|
||||||
|
|
||||||
index index.html index.htm index.php;
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{%- set default = "yes" -%}
|
{%- set default = "yes" -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
{%- set wildcard = "" -%}
|
||||||
|
{%- if pillar['nginx'][server]['wildcard'] is defined -%}
|
||||||
|
{%- if pillar['nginx'][server]['wildcard'] -%}
|
||||||
|
{%- set wildcard = "*." ~ server ~ ".actcur.com" -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
{%- if pillar['nginx'][server]['https'] is defined -%}
|
{%- if pillar['nginx'][server]['https'] is defined -%}
|
||||||
{%- if pillar['nginx'][server]['https']['port'] is defined-%}
|
{%- if pillar['nginx'][server]['https']['port'] is defined-%}
|
||||||
{%- set port = pillar['nginx'][server]['https']['port'] -%}
|
{%- set port = pillar['nginx'][server]['https']['port'] -%}
|
||||||
|
@ -14,10 +20,10 @@
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
server {
|
server {
|
||||||
listen 443;
|
listen 443;
|
||||||
server_name {{server}}.actcur.com;
|
server_name {{server}}.actcur.com {{wildcard}};
|
||||||
|
|
||||||
resolver {{ resolver }};
|
resolver {{ resolver }};
|
||||||
set $backend "{{prot}}://{{server}}.actcur.com{%- if port is defined -%}:{{port}}{%- endif -%}";
|
set $backend "{{prot}}://$server_name{%- if port is defined -%}:{{port}}{%- endif -%}";
|
||||||
|
|
||||||
ssl on;
|
ssl on;
|
||||||
ssl_certificate /etc/nginx/certs/{{server}}.actcur.com/fullchain.pem;
|
ssl_certificate /etc/nginx/certs/{{server}}.actcur.com/fullchain.pem;
|
||||||
|
|
|
@ -15,6 +15,7 @@ events {
|
||||||
|
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
server_names_hash_bucket_size 64;
|
||||||
include mime.types;
|
include mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,16 @@
|
||||||
{%- set auth = pillar['nginx'][server]['auth'] -%}
|
{%- set auth = pillar['nginx'][server]['auth'] -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
{%- set wildcard = "" -%}
|
||||||
|
{%- if pillar['nginx'][server]['wildcard'] is defined -%}
|
||||||
|
{%- if pillar['nginx'][server]['wildcard'] -%}
|
||||||
|
{%- set wildcard = "*." ~ server ~ ".actcur.com" -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443;
|
listen 443;
|
||||||
server_name {{server}}.actcur.com;
|
server_name {{server}}.actcur.com {{wildcard}};
|
||||||
|
|
||||||
resolver {{resolver}};
|
resolver {{resolver}};
|
||||||
set $backend "https://{{server}}.actcur.com";
|
set $backend "https://{{server}}.actcur.com";
|
||||||
|
|
Loading…
Add table
Reference in a new issue