Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
public-items
ansible-sc_pack-public
Commits
e0f923b2
Commit
e0f923b2
authored
Apr 01, 2021
by
Carlos Torres
Browse files
Improving files load speed.
parent
2f422104
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
group_vars/edges.yml
View file @
e0f923b2
...
...
@@ -24,6 +24,10 @@ backup_config_secret: <your_backup_config_secret>
deployment_tags
:
"
<a
comma
separated
string
e.g
demo-example,domain2>"
haproxy_auth_pass
:
"
<your
haproxy
pass>"
haproxyconfig_option
:
"
option-2"
# option-1 or option-2, or option-3, or option-4
installers_dir
:
/srv/installers
prometheus_node_exporter_port
:
9112
haproxy_exporter_port
:
9101
grok_exporter_port
:
9113
deployments
:
instance_1
:
...
...
@@ -62,7 +66,3 @@ deployments:
google_recaptcha_site_key
:
<your_google_recaptcha_site_key>
google_recaptcha_site_secret
:
<your_google_recaptcha_site_secret>
transit_encryption_key
:
<your_transit_encryption_key>
installers_dir
:
/srv/installers
prometheus_node_exporter_port
:
9112
haproxy_exporter_port
:
9101
grok_exporter_port
:
9113
roles/create_deploy_type_cdn/files/create_deploy.sh
View file @
e0f923b2
...
...
@@ -11,41 +11,51 @@ HTTPPORT=$4
HTTPSPORT
=
$5
HUMANITYVALIDATORPORT
=
$6
APIACCESSSTOKEN
=
$7
DEPLOYMENTSITELONGNAME
=
$8
DEPLOYMENTSITELONGNAMESECRET
=
$9
DOMAINS
=
$8
SERVICE_NAME
=
$1
SC_PACK_CONFIG
=
"/srv/inventory/
$DEPLOY
"
DEPLOY_CONFIG
=
"/srv/inventory/
$DEPLOY
/config"
DOMAINS_COMMA
=
${
DOMAINS
// /,
}
chown
shimmercat:shimmercat /srv
# TODO all inside try catch, error -> echo "FAILED: error.." and exit 0
sc_pack create
-f
$SC_PACK_CONFIG
"/sc_pack.conf.yaml"
cp
-r
$DEPLOY_CONFIG
/
*
$INSTALL_DIR
mkdir
-p
$INSTALL_DIR
/supervisor
mkdir
-p
$INSTALL_DIR
/www
for
DOMAIN
in
$DOMAINS
do
mkdir
-p
$INSTALL_DIR
/shimmercat-scratch-folder/sni-certs/
$DOMAIN
cp
-r
$INSTALL_DIR
/views-dir
$INSTALL_DIR
/views-dir-
$DOMAIN
done
systemctl
link
$INSTALL_DIR
"/.sc_pack-rkt/sc-"
$SERVICE_NAME
".service"
systemctl
enable
"sc-"
$SERVICE_NAME
".service"
#
systemctl daemon-reload
systemctl restart
"sc-"
$SERVICE_NAME
".service"
sleep
2
while
[
!
-f
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
]
do
sleep
2
# or less like 0.2
sleep
2
done
yq
-yi
.hapsSettings.enabled
=
"true"
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
yq
-yi
.hapsSettings.webpOverTheFold
=
"true"
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
yq
-yi
.security.enableLARSI
=
"true"
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
sleep
2
cd
$INSTALL_DIR
sc_pack update
--latest
chown
-R
shimmercat:shimmercat /srv/haproxy
chown
-R
shimmercat:shimmercat
$INSTALL_DIR
sc_pack update
--latest
systemctl daemon-reload
systemctl restart
"sc-"
$SERVICE_NAME
".service"
systemctl restart haproxy.service
# create inventory
...
...
roles/create_deploy_type_cdn/tasks/main.yml
View file @
e0f923b2
...
...
@@ -47,7 +47,7 @@
-
name
:
Creates directory to save primary deployments sc_pack.conf.yaml
file
:
path
:
"
/srv/inventory/{{item.value.deployment_name}}"
path
:
"
/srv/inventory/{{item.value.deployment_name}}
/config
"
mode
:
0775
recurse
:
yes
with_dict
:
"
{{
deployments
}}"
...
...
@@ -59,120 +59,41 @@
owner
:
shimmercat
with_dict
:
"
{{
deployments
}}"
-
name
:
Create credentials
include_tasks
:
"
{{
role_path
}}/tasks/credentials.yml"
with_dict
:
"
{{
deployments
}}"
-
name
:
Create deployments
script
:
"
{{
role_path
}}/files/create_deploy.sh
{{
item.value.deployment_name
|
replace('.',
'_')
}}
{{installers_dir}}
{{item.value.install_dir}}
{{item.value.http_port}}
{{item.value.https_port}}
{{item.value.humanity_validator_port}}
{{
api_access_token
}}"
with_dict
:
"
{{
deployments
}}"
register
:
create_deploy
-
fail
:
msg
:
"
{{item.stdout}}"
when
:
"
'FAILED'
in
item.stdout"
with_items
:
"
{{
create_deploy.results
}}"
-
name
:
Create supervisor folder
file
:
path
:
"
{{
item
}}/supervisor"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_list
:
"
{{deployments_dirs}}"
-
name
:
Upload devlove.yaml
template
:
src
:
"
{{
role_path
}}/templates/config/devlove/devlove.yaml.jinja2"
dest
:
"
{{item.value.install_dir}}
/devlove.yaml"
dest
:
"
/srv/inventory/{{item.value.deployment_name}}/config
/devlove.yaml"
owner
:
shimmercat
group
:
shimmercat
with_dict
:
"
{{
deployments
}}"
-
name
:
Create views-dir folder
file
:
path
:
"
{{
item
}}/views-dir"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_list
:
"
{{deployments_dirs}}"
-
name
:
Create www folder
file
:
path
:
"
{{
item
}}/www"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_list
:
"
{{deployments_dirs}}"
-
name
:
Create views-dir folders
file
:
path
:
"
{{item[0]}}/views-dir-{{item[1]}}"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
-
name
:
Copy views-dir to remote server
copy
:
src
:
"
{{
role_path
}}/templates/config/views-dir"
dest
:
"
{{item}}"
owner
:
shimmercat
group
:
shimmercat
with_items
:
-
"
{{
deployments_dirs
}}"
-
name
:
Upload index.html
template
:
src
:
"
{{
role_path
}}/templates/config/views-dir/index.html.jinja2"
dest
:
"
{{item.value.install_dir}}/views-dir/index.html"
owner
:
shimmercat
group
:
shimmercat
synchronize
:
src="{{ role_path }}/templates/config/views-dir/" dest="/srv/inventory/{{item.value.deployment_name}}/config/views-dir"
with_dict
:
"
{{
deployments
}}"
-
name
:
Copy domains views-dir to remote server
copy
:
src
:
"
{{
role_path
}}/templates/config/views-dir/"
dest
:
"
{{item[0]}}/views-dir-{{item[1]}}"
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
-
name
:
Upload index.html
-
name
:
Upload index.html views-dir to remote server
template
:
src
:
"
{{
role_path
}}/templates/config/views-dir/index.html.jinja2"
dest
:
"
{{item[0]}}/views-dir-{{item[1]}}
/index.html"
dest
:
"
/srv/inventory/{{item.value.deployment_name}}/config/views-dir
/index.html"
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
with_dict
:
"
{{
deployments
}}"
-
name
:
Create sni-certs folders
file
:
path
:
"
{{item[0]}}/shimmercat-scratch-folder/sni-certs/{{item[1]}}"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
-
name
:
Create credentials
include_tasks
:
"
{{
role_path
}}/tasks/credentials.yml"
with_dict
:
"
{{
deployments
}}"
-
name
:
Restart deployments services
systemd
:
state
:
restarted
daemon_reload
:
yes
name
:
"
sc-{{item.value.deployment_name}}"
-
name
:
Create deployments
script
:
"
{{
role_path
}}/files/create_deploy.sh
{{
item.value.deployment_name
|
replace('.',
'_')
}}
{{installers_dir}}
{{item.value.install_dir}}
{{item.value.http_port}}
{{item.value.https_port}}
{{item.value.humanity_validator_port}}
{{
api_access_token
}}
'{{
domains|join('
')
}}'"
with_dict
:
"
{{
deployments
}}"
register
:
create_deploy
args
:
executable
:
/bin/bash
-
fail
:
msg
:
"
{{item.stdout}}"
when
:
"
'FAILED'
in
item.stdout"
with_items
:
"
{{
create_deploy.results
}}"
-
name
:
Include task configure-haproxy
include_tasks
:
"
{{
role_path
}}/tasks/configure-haproxy.yml"
...
...
roles/create_deploys/files/create_deploy.sh
View file @
e0f923b2
...
...
@@ -11,41 +11,51 @@ HTTPPORT=$4
HTTPSPORT
=
$5
HUMANITYVALIDATORPORT
=
$6
APIACCESSSTOKEN
=
$7
DEPLOYMENTSITELONGNAME
=
$8
DEPLOYMENTSITELONGNAMESECRET
=
$9
DOMAINS
=
$8
SERVICE_NAME
=
$1
SC_PACK_CONFIG
=
"/srv/inventory/
$DEPLOY
"
DEPLOY_CONFIG
=
"/srv/inventory/
$DEPLOY
/config"
DOMAINS_COMMA
=
${
DOMAINS
// /,
}
chown
shimmercat:shimmercat /srv
# TODO all inside try catch, error -> echo "FAILED: error.." and exit 0
sc_pack create
-f
$SC_PACK_CONFIG
"/sc_pack.conf.yaml"
cp
-r
$DEPLOY_CONFIG
/
*
$INSTALL_DIR
mkdir
-p
$INSTALL_DIR
/supervisor
mkdir
-p
$INSTALL_DIR
/www
for
DOMAIN
in
$DOMAINS
do
mkdir
-p
$INSTALL_DIR
/shimmercat-scratch-folder/sni-certs/
$DOMAIN
cp
-r
$INSTALL_DIR
/views-dir
$INSTALL_DIR
/views-dir-
$DOMAIN
done
systemctl
link
$INSTALL_DIR
"/.sc_pack-rkt/sc-"
$SERVICE_NAME
".service"
systemctl
enable
"sc-"
$SERVICE_NAME
".service"
#
systemctl daemon-reload
systemctl restart
"sc-"
$SERVICE_NAME
".service"
sleep
2
while
[
!
-f
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
]
do
sleep
2
# or less like 0.2
sleep
2
done
yq
-yi
.hapsSettings.enabled
=
"true"
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
yq
-yi
.hapsSettings.webpOverTheFold
=
"true"
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
yq
-yi
.security.enableLARSI
=
"true"
"
$INSTALL_DIR
/shimmercat-scratch-folder/tweaks.yaml"
sleep
2
cd
$INSTALL_DIR
sc_pack update
--latest
chown
-R
shimmercat:shimmercat /srv/haproxy
chown
-R
shimmercat:shimmercat
$INSTALL_DIR
sc_pack update
--latest
systemctl daemon-reload
systemctl restart
"sc-"
$SERVICE_NAME
".service"
systemctl restart haproxy.service
# create inventory
...
...
roles/create_deploys/tasks/main.yml
View file @
e0f923b2
...
...
@@ -47,7 +47,7 @@
-
name
:
Creates directory to save primary deployments sc_pack.conf.yaml
file
:
path
:
"
/srv/inventory/{{item.value.deployment_name}}"
path
:
"
/srv/inventory/{{item.value.deployment_name}}
/config
"
mode
:
0775
recurse
:
yes
with_dict
:
"
{{
deployments
}}"
...
...
@@ -59,106 +59,41 @@
owner
:
shimmercat
with_dict
:
"
{{
deployments
}}"
-
name
:
Create credentials
include_tasks
:
"
{{
role_path
}}/tasks/credentials.yml"
with_dict
:
"
{{
deployments
}}"
-
name
:
Create deployments
script
:
"
{{
role_path
}}/files/create_deploy.sh
{{
item.value.deployment_name
|
replace('.',
'_')
}}
{{installers_dir}}
{{item.value.install_dir}}
{{item.value.http_port}}
{{item.value.https_port}}
{{item.value.humanity_validator_port}}
{{
api_access_token
}}"
with_dict
:
"
{{
deployments
}}"
register
:
create_deploy
-
fail
:
msg
:
"
{{item.stdout}}"
when
:
"
'FAILED'
in
item.stdout"
with_items
:
"
{{
create_deploy.results
}}"
-
name
:
Create supervisor folder
file
:
path
:
"
{{
item
}}/supervisor"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_list
:
"
{{deployments_dirs}}"
-
name
:
Upload devlove.yaml
template
:
src
:
"
{{
role_path
}}/templates/config/{{
haproxyconfig_option
}}/devlove/devlove.yaml.jinja2"
dest
:
"
{{item.value.install_dir}}
/devlove.yaml"
dest
:
"
/srv/inventory/{{item.value.deployment_name}}/config
/devlove.yaml"
owner
:
shimmercat
group
:
shimmercat
with_dict
:
"
{{
deployments
}}"
-
name
:
Create views-dir folders
file
:
path
:
"
{{item[0]}}/views-dir-{{item[1]}}"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
-
name
:
Create views-dir folders
file
:
path
:
"
{{item[0]}}/views-dir-{{item[1]}}"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
-
name
:
Copy views-dir to remote server
copy
:
src
:
"
{{
role_path
}}/templates/config/{{haproxyconfig_option}}/views-dir"
dest
:
"
{{item}}"
owner
:
shimmercat
group
:
shimmercat
with_items
:
-
"
{{
deployments_dirs
}}"
-
name
:
Copy domains views-dir to remote server
copy
:
src
:
"
{{
role_path
}}/templates/config/{{haproxyconfig_option}}/views-dir/"
dest
:
"
{{item[0]}}/views-dir-{{item[1]}}"
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
-
name
:
Create sni-certs folders
file
:
path
:
"
{{item[0]}}/shimmercat-scratch-folder/sni-certs/{{item[1]}}"
mode
:
0775
recurse
:
yes
owner
:
shimmercat
group
:
shimmercat
with_nested
:
-
"
{{
deployments_dirs
}}"
-
"
{{
domains
}}"
synchronize
:
src="{{ role_path }}/templates/config/{{ haproxyconfig_option }}/views-dir/" dest="/srv/inventory/{{item.value.deployment_name}}/config/views-dir"
with_dict
:
"
{{
deployments
}}"
-
name
:
Extract www.tar into /deployments_dirs/www
unarchive
:
src
:
"
{{
role_path
}}/templates/config/{{haproxyconfig_option}}/www/www.tar"
dest
:
"
{{item}}
"
dest
:
"
/srv/inventory/{{item.value.deployment_name}}/config
"
owner
:
shimmercat
group
:
shimmercat
with_items
:
-
"
{{
deployments_dirs
}}"
with_dict
:
"
{{
deployments
}}"
when
:
haproxyconfig_option == "option-1"
-
name
:
Restart deployments services
systemd
:
state
:
restarted
daemon_reload
:
yes
name
:
"
sc-{{item.value.deployment_name}}"
-
name
:
Create credentials
include_tasks
:
"
{{
role_path
}}/tasks/credentials.yml"
with_dict
:
"
{{
deployments
}}"
-
name
:
Create deployments
script
:
"
{{
role_path
}}/files/create_deploy.sh
{{
item.value.deployment_name
|
replace('.',
'_')
}}
{{installers_dir}}
{{item.value.install_dir}}
{{item.value.http_port}}
{{item.value.https_port}}
{{item.value.humanity_validator_port}}
{{
api_access_token
}}"
with_dict
:
"
{{
deployments
}}"
register
:
create_deploy
-
fail
:
msg
:
"
{{item.stdout}}"
when
:
"
'FAILED'
in
item.stdout"
with_items
:
"
{{
create_deploy.results
}}"
-
name
:
Include task configure-haproxy
include_tasks
:
"
{{
role_path
}}/tasks/configure-haproxy.yml"
with_list
:
"
{{domains}}"
...
...
roles/install_sc_pack/files/installers/sc_pack.bootstrap
View file @
e0f923b2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment