forked from ISTI-ansible-roles/ansible-roles
Modify the parse server role so that the user can access the configuration files and the logs.
This commit is contained in:
parent
572c94edf4
commit
35a5e9d95b
|
@ -1,6 +1,8 @@
|
||||||
---
|
---
|
||||||
parse_server_user: parsesrv
|
parse_server_user: parsesrv
|
||||||
parse_server_user_home: /srv/parse
|
parse_server_user_home: /srv/parse
|
||||||
|
parse_server_config_dir: '{{ parse_server_user_home }}/config'
|
||||||
|
parse_server_logs_dir: '{{ parse_server_user_home }}/logs'
|
||||||
parse_server_npm_modules:
|
parse_server_npm_modules:
|
||||||
- parse-server
|
- parse-server
|
||||||
- pm2
|
- pm2
|
||||||
|
@ -8,7 +10,10 @@ parse_server_npm_modules:
|
||||||
parse_server_http_port: 1337
|
parse_server_http_port: 1337
|
||||||
parse_server_db: parse_db
|
parse_server_db: parse_db
|
||||||
parse_server_mongodb_uri: 'mongodb://localhost:27017/{{ parse_server_db }}'
|
parse_server_mongodb_uri: 'mongodb://localhost:27017/{{ parse_server_db }}'
|
||||||
|
parse_server_verbose_mode: 0
|
||||||
|
# VERBOSE, INFO, ERROR, NONE
|
||||||
|
parse_server_log_level: ERROR
|
||||||
|
parse_server_json_logs: 0
|
||||||
parse_server_app_id: 'foo'
|
parse_server_app_id: 'foo'
|
||||||
#parse_server_master_key: 'use a vault file'
|
#parse_server_master_key: 'use a vault file'
|
||||||
parse_server_app_name: '{{ parse_server_app_id }}'
|
parse_server_app_name: '{{ parse_server_app_id }}'
|
||||||
|
|
|
@ -6,10 +6,16 @@
|
||||||
- name: Create the parse home directory
|
- name: Create the parse home directory
|
||||||
file: dest={{ parse_server_user_home }} owner={{ parse_server_user }} group={{ parse_server_user }} mode=0755 state=directory
|
file: dest={{ parse_server_user_home }} owner={{ parse_server_user }} group={{ parse_server_user }} mode=0755 state=directory
|
||||||
|
|
||||||
|
- name: Create the parse config directory
|
||||||
|
file: dest={{ parse_server_config_dir }} owner={{ parse_server_user }} group={{ parse_server_user }} mode=0750 state=directory
|
||||||
|
|
||||||
- name: Install the parse server
|
- name: Install the parse server
|
||||||
npm: name={{ item }} global=yes state=present production=true
|
npm: name={{ item }} global=yes state=present production=true
|
||||||
with_items: '{{ parse_server_npm_modules }}'
|
with_items: '{{ parse_server_npm_modules }}'
|
||||||
|
|
||||||
|
- name: Install the parse server environment file
|
||||||
|
template: src=parse-server.env dest={{ parse_server_config_dir }}/parse-server.env owner={{ parse_server_user }} group={{ parse_server_user }} mode=0640
|
||||||
|
|
||||||
- name: Install the parse server startup script
|
- name: Install the parse server startup script
|
||||||
template: src=parse_server.upstart.j2 dest=/etc/init/parse_server.conf mode=0644
|
template: src=parse_server.upstart.j2 dest=/etc/init/parse_server.conf mode=0644
|
||||||
|
|
||||||
|
@ -25,10 +31,10 @@
|
||||||
with_items: '{{ parse_server_dashboard_npm_modules }}'
|
with_items: '{{ parse_server_dashboard_npm_modules }}'
|
||||||
|
|
||||||
- name: Install the parse dashboard environment variables file
|
- name: Install the parse dashboard environment variables file
|
||||||
template: src=parse-server-dashboard dest=/etc/default/parse-server-dashboard
|
template: src=parse-server-dashboard.env dest={{ parse_server_config_dir }}/parse-server-dashboard.env owner={{ parse_server_user }} group={{ parse_server_user }} mode=0640
|
||||||
|
|
||||||
- name: Install the parse dashboard configuration file
|
- name: Install the parse dashboard configuration file
|
||||||
template: src=parse-dashboard-config.json dest={{ parse_server_user_home }}/parse-dashboard-config.json
|
template: src=parse-dashboard-config.json dest={{ parse_server_config_dir }}/parse-dashboard-config.json owner={{ parse_server_user }} group={{ parse_server_user }} mode=0640
|
||||||
|
|
||||||
- name: Install the parse dashboard startup script
|
- name: Install the parse dashboard startup script
|
||||||
template: src=parse_server_dashboard.upstart.j2 dest=/etc/init/parse_server_dashboard.conf mode=0644
|
template: src=parse_server_dashboard.upstart.j2 dest=/etc/init/parse_server_dashboard.conf mode=0644
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
export MASTER_KEY='{{ parse_server_master_key }}'
|
||||||
|
export APPLICATION_ID='{{ parse_server_app_id }}'
|
||||||
|
export LOG_LEVEL='{{ parse_server_log_level }}'
|
||||||
|
export JSON_LOGS={{ parse_server_json_logs }}
|
||||||
|
export PARSE_SERVER_LOGS_FOLDER='{{ parse_server_logs_dir }}'
|
||||||
|
export VERBOSE={{ parse_server_verbose_mode }}
|
||||||
|
export DATABASE_URI='{{ parse_server_mongodb_uri }}'
|
|
@ -8,5 +8,13 @@ setuid {{ parse_server_user }}
|
||||||
setgid {{ parse_server_user }}
|
setgid {{ parse_server_user }}
|
||||||
|
|
||||||
script
|
script
|
||||||
exec /usr/bin/parse-server --appId "{{ parse_server_app_id }}" --masterKey "{{ parse_server_master_key }}" --databaseURI {{ parse_server_mongodb_uri }}
|
. {{ parse_server_config_dir }}/parse-server.env
|
||||||
|
export MASTER_KEY
|
||||||
|
export APPLICATION_ID
|
||||||
|
export LOG_LEVEL
|
||||||
|
export PARSE_SERVER_LOGS_FOLDER
|
||||||
|
export JSON_LOGS
|
||||||
|
export VERBOSE
|
||||||
|
export DATABASE_URI
|
||||||
|
exec /usr/bin/parse-server --appId "$APPLICATION_ID" --masterKey "$MASTER_KEY" --databaseURI $DATABASE_URI > {{ parse_server_logs_dir }}/parse_server_startup.log 2>&1
|
||||||
end script
|
end script
|
||||||
|
|
|
@ -8,8 +8,8 @@ setuid {{ parse_server_user }}
|
||||||
setgid {{ parse_server_user }}
|
setgid {{ parse_server_user }}
|
||||||
|
|
||||||
script
|
script
|
||||||
. /etc/default/parse-server-dashboard
|
. {{ parse_server_config_dir }}/parse-server-dashboard.env
|
||||||
export PARSE_DASHBOARD_TRUST_PROXY
|
export PARSE_DASHBOARD_TRUST_PROXY
|
||||||
export MOUNT_PATH
|
export MOUNT_PATH
|
||||||
exec /usr/bin/parse-dashboard --config parse-dashboard-config.json
|
exec /usr/bin/parse-dashboard --config {{ parse_server_config_dir }}/parse-dashboard-config.json > {{ parse_server_logs_dir }}/parse_server_dashboard_startup.log 2>&1
|
||||||
end script
|
end script
|
||||||
|
|
Loading…
Reference in New Issue