+ sample configs for nginx-proxy lxc instance
+ site_name as general option for different lxc_host and site_name (personally used for vps deployment) + vps deploy script + node version manager install + php version setup vars moved into separate vars-file + ansible.cfg that helps to use local inventory and group_vars files + root account playbook
This commit is contained in:
@ -3,7 +3,7 @@ server {
|
||||
server_name domain;
|
||||
client_max_body_size 0;
|
||||
location / {
|
||||
proxy_pass http://lxc_host;
|
||||
proxy_pass http://site_name;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
@ -5,7 +5,7 @@ server {
|
||||
client_max_body_size 0;
|
||||
proxy_buffering off;
|
||||
location / {
|
||||
proxy_pass http://lxc_host:9000;
|
||||
proxy_pass http://site_name:9000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
@ -2,7 +2,7 @@ server {
|
||||
listen 80;
|
||||
server_name domain;
|
||||
location / {
|
||||
proxy_pass https://lxc_host;
|
||||
proxy_pass https://site_name;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
@ -2,7 +2,7 @@ server {
|
||||
listen 80;
|
||||
server_name domain;
|
||||
location / {
|
||||
proxy_pass http://lxc_host:8080;
|
||||
proxy_pass http://site_name:8080;
|
||||
access_log off;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
@ -13,7 +13,7 @@ server {
|
||||
proxy_http_version 1.1;
|
||||
}
|
||||
location /api/eventSourceBus {
|
||||
proxy_pass http://lxc_host:8080;
|
||||
proxy_pass http://site_name:8080;
|
||||
access_log off;
|
||||
proxy_cache off;
|
||||
proxy_buffering off;
|
||||
|
@ -24,11 +24,11 @@
|
||||
nginx_ocsp: False
|
||||
nginx_worker_processes: auto
|
||||
nginx__servers:
|
||||
- name: '{{ lxc_host }}'
|
||||
- name: '{{ site_name }}'
|
||||
|
||||
type: php
|
||||
|
||||
root: '/var/www/{{ lxc_host }}'
|
||||
root: '/var/www/{{ site_name }}'
|
||||
|
||||
public_dir_name: ''
|
||||
|
||||
@ -38,10 +38,12 @@
|
||||
|
||||
location_list:
|
||||
- pattern: '/'
|
||||
options: rewrite ^/.*$ /index.php last;
|
||||
locations:
|
||||
- pattern: '~ ^/*.-backend/'
|
||||
options: set $upstream unix:/run/php7.4-fpm-backend.sock;
|
||||
options: try_files /index.html @october;
|
||||
- pattern: '@october'
|
||||
options: rewrite ^/.*$ /index.php last;
|
||||
- pattern: '~* ^(?!/index).*\.php$'
|
||||
options: return 403;
|
||||
|
||||
@ -74,17 +76,17 @@
|
||||
post_tasks:
|
||||
- name: Default index.html
|
||||
template:
|
||||
src: var/www/lxc_host/index.html.j2
|
||||
dest: '/var/www/{{ lxc_host }}/index.html'
|
||||
src: var/www/site_name/index.html.j2
|
||||
dest: '/var/www/{{ site_name }}/index.html'
|
||||
mode: 0644
|
||||
owner: '{{ lxc_host }}'
|
||||
owner: '{{ site_name }}'
|
||||
|
||||
- name: Copy normalized.css
|
||||
template:
|
||||
src: var/www/lxc_host/normalize.css
|
||||
dest: '/var/www/{{ lxc_host }}/'
|
||||
src: var/www/site_name/normalize.css
|
||||
dest: '/var/www/{{ site_name }}/'
|
||||
mode: 0644
|
||||
owner: '{{ lxc_host }}'
|
||||
owner: '{{ site_name }}'
|
||||
|
||||
roles:
|
||||
|
||||
|
@ -10,10 +10,8 @@
|
||||
| combine(inventory__group_environment | d({}))
|
||||
| combine(inventory__host_environment | d({})) }}'
|
||||
|
||||
|
||||
vars:
|
||||
php__version_preference: [ 'php7.4' ]
|
||||
php__sury: '{{ ansible_local.php.sury
|
||||
|d(ansible_distribution_release in [ "buster" ]) | bool }}'
|
||||
php__sury_apt_key_id: '{{ php__sury_apt_key_id_map[ansible_distribution] }}'
|
||||
php__sury_apt_repo: '{{ php__sury_apt_repo_map[ansible_distribution] }}'
|
||||
php__sury_apt_key_id_map:
|
||||
@ -36,7 +34,6 @@
|
||||
# mbstring требует только некоторые пакеты в laravel
|
||||
# bcmath - нужно для работы парсера Excel файлов на одном из проектов
|
||||
# Laravel/OctoberCMS: intl, redis
|
||||
php__packages: [ 'curl', 'xml', 'gd', 'zip', 'mbstring', 'mysql', 'bcmath', 'intl', 'redis' ]
|
||||
php__composer_upstream_enabled: '{{ True
|
||||
if (ansible_distribution_release in
|
||||
[ "buster" ])
|
||||
@ -58,6 +55,9 @@
|
||||
pm: static
|
||||
pm_max_children: 3
|
||||
|
||||
vars_files:
|
||||
- ./../vars/php.yml
|
||||
|
||||
pre_tasks:
|
||||
|
||||
- name: Apply keyring configuration for php environment
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
post_tasks:
|
||||
- name: Change starship character to dollar sign
|
||||
shell: "sed -i 's/#/\\\\$/g' /home/{{ lxc_host }}/.config/starship.toml"
|
||||
shell: "sed -i 's/#/\\\\$/g' /home/{{ site_name }}/.config/starship.toml"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
|
||||
|
Reference in New Issue
Block a user