Add the Overleaf playbook

This commit is contained in:
tanshu committed 2026-10-18 21:35:52 +05:30
1 parent 250456e3fe
commit fc31504f57
7 files changed
+125

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
server {
listen 80;
server_name {{ http_host }};
# set max upload size
client_max_body_size 10G;
location / {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive" always;
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
proxy_pass http://localhost:{{ host_port }};
}
}
+13
View File
@@ -0,0 +1,13 @@
#################################################
# Setup Overleaf
#################################################
---
# - hosts: gondor
- hosts: all
become: true
vars_files:
- vars/default.yml
roles:
- sharelatex
# - nginx
View File
Whitespace-only changes.
+6
View File
@@ -0,0 +1,6 @@
---
# Handlers for Nginx role
- name: Reload Nginx
service:
name: nginx
state: reloaded
+24
View File
@@ -0,0 +1,24 @@
---
# Tasks for Nginx role
- name: Check if Nginx conf file exists
stat:
path: "/etc/nginx/sites-available/{{ http_conf }}"
register: status
- name: No need to reload Nginx
debug:
msg: "No need to reload Nginx as sites-available entries have already been created"
- name: Set Nginx conf file
when: status.stat.exists == false
template:
src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enable new site
when: status.stat.exists == false
file:
src: "/etc/nginx/sites-available/{{ http_conf }}"
dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
state: link
notify: Reload Nginx
+50
View File
@@ -0,0 +1,50 @@
---
# Tasks for Sharelatex role
- name: Pull Sharelatex image
docker_image:
name: "{{ sharelatex_image }}"
source: pull
force_source: yes
- name: Ensure Overleaf Directory exists
file:
path: "/var/lib/{{ host_directory }}"
state: directory
mode: 0755
- name: Create webserver container
docker_container:
name: "{{ sharelatex_container }}"
image: "{{ sharelatex_image }}"
state: started
restart_policy: "unless-stopped"
env:
# SHARELATEX_APP_NAME: Overleaf Community Edition
# SHARELATEX_MONGO_URL: mongodb://mongo/sharelatex
OVERLEAF_APP_NAME: Overleaf Community Edition
OVERLEAF_MONGO_URL: mongodb://mongo/sharelatex
# Same property, unfortunately with different names in
# different locations
OVERLEAF_REDIS_HOST: redis
REDIS_HOST: redis
ENABLED_LINKED_FILE_TYPES: 'project_file,project_output_file'
# Enables Thumbnail generation using ImageMagick
ENABLE_CONVERSIONS: 'true'
# Disables email confirmation requirement
EMAIL_CONFIRMATION_DISABLED: 'true'
# temporary fix for LuaLaTex compiles
# see https://github.com/overleaf/overleaf/issues/695
TEXMFVAR: /var/lib/sharelatex/tmp/texmf-var
links:
- "{{ mongo_container }}:mongo"
- "{{ redis_container }}:redis"
published_ports:
- "127.0.0.1:{{ host_port }}:80"
volumes:
- "/var/lib/{{ host_directory }}:/var/lib/overleaf"
# - "/var/lib/{{ host_directory }}:/var/lib/sharelatex"
+12
View File
@@ -0,0 +1,12 @@
---
http_host: "latex.tanshu.com"
http_conf: "latex.tanshu.com.conf"
sharelatex_image: sharelatex/sharelatex
sharelatex_container: sharelatex
mongo_container: mongo
redis_container: redis
host_directory: overleaf
host_port: 3199