mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-07-26 15:55:56 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
35
roles/appsmith/templates/appsmith-server.service.j2
Normal file
35
roles/appsmith/templates/appsmith-server.service.j2
Normal file
@@ -0,0 +1,35 @@
|
||||
[Unit]
|
||||
Description=Opensource framework to build app and workflows
|
||||
After=syslog.target network.target mongodb.service redis.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User={{ appsmith_user }}
|
||||
Group={{ appsmith_user }}
|
||||
EnvironmentFile={{ appsmith_root_dir }}/etc/env
|
||||
WorkingDirectory={{ appsmith_root_dir }}/server
|
||||
PermissionsStartOnly=yes
|
||||
ExecStartPre={{ appsmith_root_dir }}/bin/pre-start
|
||||
ExecStart=/bin/java -Djava.net.preferIPv4Stack=true \
|
||||
-Dserver.port={{ appsmith_server_port }} \
|
||||
-Djava.security.egd="file:/dev/./urandom" \
|
||||
{% if system_proxy is defined and system_proxy != '' %}
|
||||
-Dhttp.proxyHost={{ system_proxy | urlsplit('hostname') }} \
|
||||
-Dhttp.proxyPort={{ system_proxy | urlsplit('port') }} \
|
||||
-Dhttps.proxyHost={{ system_proxy | urlsplit('hostname') }} \
|
||||
-Dhttps.proxyPort={{ system_proxy | urlsplit('port') }} \
|
||||
{% endif %}
|
||||
-jar server-1.0-SNAPSHOT.jar
|
||||
PrivateTmp=yes
|
||||
ProtectSystem=full
|
||||
ProtectHome=yes
|
||||
NoNewPrivileges=yes
|
||||
MemoryLimit=4096M
|
||||
Restart=on-failure
|
||||
StartLimitInterval=0
|
||||
RestartSec=30
|
||||
SyslogIdentifier=appsmith-server
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
25
roles/appsmith/templates/env.j2
Normal file
25
roles/appsmith/templates/env.j2
Normal file
@@ -0,0 +1,25 @@
|
||||
APPSMITH_MAIL_ENABLED=true
|
||||
APPSMITH_MAIL_FROM={{ appsmith_email_from }}
|
||||
APPSMITH_MAIL_HOST={{ appsmith_email_server }}
|
||||
APPSMITH_MAIL_PORT={{ appsmith_email_port }}
|
||||
APPSMITH_MAIL_SMTP_TLS_ENABLED={{ appsmith_email_tls | ternary('true','false') }}
|
||||
{% if appsmith_email_user is defined and appsmith_email_pass is defined %}
|
||||
APPSMITH_MAIL_SMTP_AUTH=true
|
||||
APPSMITH_MAIL_USERNAME={{ appsmith_email_user }}
|
||||
APPSMITH_MAIL_PASSWORD={{ appsmith_email_pass }}
|
||||
{% endif %}
|
||||
APPSMITH_REDIS_URL={{ appsmith_redis_url }}
|
||||
{% if appsmith_mongo_user is defined and appsmith_mongo_pass is defined and appsmith_mongo_pass != False %}
|
||||
{% set appsmith_mongo_url_obj = appsmith_mongo_url | urlsplit %}
|
||||
APPSMITH_MONGODB_URI={{ appsmith_mongo_url_obj['scheme'] }}://{{ appsmith_mongo_user }}:{{ appsmith_mongo_pass | urlencode | regex_replace('/','%2F') }}@{{ appsmith_mongo_url_obj['hostname'] }}{% if appsmith_mongo_url_obj['port'] %}:{{ appsmith_mongo_url_obj['port'] }}{% endif %}{{ appsmith_mongo_url_obj['path'] }}?{{ appsmith_mongo_url_obj['query'] }}
|
||||
{% else %}
|
||||
APPSMITH_MONGODB_URI={{ appsmith_mongo_url }}
|
||||
{% endif %}
|
||||
APPSMITH_DISABLE_TELEMETRY=true
|
||||
APPSMITH_ENCRYPTION_PASSWORD={{ appsmith_encryption_pass }}
|
||||
APPSMITH_ENCRYPTION_SALT={{ appsmith_encryption_salt }}
|
||||
APPSMITH_SIGNUP_DISABLED={{ appsmith_user_signup | ternary('false','true') }}
|
||||
{% if appsmith_signup_whitelist | length > 0 and appsmith_user_signup %}
|
||||
APPSMITH_SIGNUP_ALLOWED_DOMAINS={{ appsmith_signup_whitelist | join(',') }}
|
||||
{% endif %}
|
||||
APPSMITH_ADMIN_EMAILS={{ appsmith_admin_emails | join(',') }}
|
34
roles/appsmith/templates/nginx.conf.j2
Normal file
34
roles/appsmith/templates/nginx.conf.j2
Normal file
@@ -0,0 +1,34 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name {{ appsmith_public_url | urlsplit('hostname') }};
|
||||
include /etc/nginx/ansible_conf.d/acme.inc;
|
||||
root {{ appsmith_root_dir }}/client;
|
||||
client_max_body_size 10M;
|
||||
|
||||
if ($request_method !~ ^(GET|POST|HEAD|PUT|DELETE|PATCH)$ ) {
|
||||
return 405;
|
||||
}
|
||||
|
||||
# Send info about the original request to the backend
|
||||
proxy_set_header X-Forwarded-For "$proxy_add_x_forwarded_for";
|
||||
proxy_set_header X-Real-IP "$remote_addr";
|
||||
proxy_set_header X-Forwarded-Proto "$scheme";
|
||||
proxy_set_header X-Forwarded-Host "$host";
|
||||
proxy_set_header Host "$host";
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html =404;
|
||||
}
|
||||
location /f {
|
||||
proxy_pass https://cdn.optimizely.com/;
|
||||
}
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:{{ appsmith_server_port }};
|
||||
}
|
||||
location /oauth2 {
|
||||
proxy_pass http://127.0.0.1:{{ appsmith_server_port }};
|
||||
}
|
||||
location /login {
|
||||
proxy_pass http://127.0.0.1:{{ appsmith_server_port }};
|
||||
}
|
||||
}
|
3
roles/appsmith/templates/post-backup.sh.j2
Normal file
3
roles/appsmith/templates/post-backup.sh.j2
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
rm -rf {{ appsmith_root_dir }}/backup/*
|
12
roles/appsmith/templates/pre-backup.sh.j2
Normal file
12
roles/appsmith/templates/pre-backup.sh.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
mongodump \
|
||||
{% if appsmith_mongo_pass is defined and appsmith_mongo_pass != False %}
|
||||
{% set appsmith_mongo_url_obj = appsmith_mongo_url | urlsplit %}
|
||||
--uri {{ appsmith_mongo_url_obj['scheme'] }}://{{ appsmith_mongo_user }}:{{ appsmith_mongo_pass | urlencode | regex_replace('/','%2F') }}@{{ appsmith_mongo_url_obj['hostname'] }}{% if appsmith_mongo_url_obj['port'] %}:{{ appsmith_mongo_url_obj['port'] }}{% endif %}{{ appsmith_mongo_url_obj['path'] }}?{{ appsmith_mongo_url_obj['query'] }} \
|
||||
{% else %}
|
||||
--uri {{ appsmith_mongo_url }} \
|
||||
{% endif %}
|
||||
--out {{ appsmith_root_dir }}/backup
|
19
roles/appsmith/templates/pre-start.sh.j2
Normal file
19
roles/appsmith/templates/pre-start.sh.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# If the conf changed since the last client deployement, or if the client build is newer than the one deployed, then re-deploy
|
||||
if [ {{ appsmith_root_dir }}/etc/env -nt {{ appsmith_root_dir }}/client/ -o {{ appsmith_root_dir }}/src/app/client/build/ -nt {{ appsmith_root_dir }}/client/ ]; then
|
||||
rsync -a --delete {{ appsmith_root_dir }}/src/app/client/build/ {{ appsmith_root_dir }}/client/
|
||||
find {{ appsmith_root_dir }}/client/ -type f | xargs \
|
||||
sed -i \
|
||||
{% for var in [
|
||||
"APPSMITH_SENTRY_DSN","APPSMITH_SMART_LOOK_ID","APPSMITH_OAUTH2_GOOGLE_CLIENT_ID",
|
||||
"APPSMITH_OAUTH2_GITHUB_CLIENT_ID","APPSMITH_MARKETPLACE_ENABLED",
|
||||
"APPSMITH_SEGMENT_KEY","APPSMITH_OPTIMIZELY_KEY","APPSMITH_ALGOLIA_API_ID",
|
||||
"APPSMITH_ALGOLIA_SEARCH_INDEX_NAME","APPSMITH_ALGOLIA_API_KEY","APPSMITH_CLIENT_LOG_LEVEL",
|
||||
"APPSMITH_GOOGLE_MAPS_API_KEY","APPSMITH_TNC_PP","APPSMITH_VERSION_ID",
|
||||
"APPSMITH_VERSION_RELEASE_DATE","APPSMITH_INTERCOM_APP_ID","APPSMITH_MAIL_ENABLED","APPSMITH_DISABLE_TELEMETRY"] %}
|
||||
-e "s/__{{ var }}__/${{ '{' ~ var ~ '}' }}/g"{% if not loop.last %} \{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
fi
|
Reference in New Issue
Block a user