1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-19 15:28:06 +02:00

init, basic doctor

This commit is contained in:
Shane Kilkelly 2020-06-02 14:20:23 +01:00
commit 77e05c4fd4
14 changed files with 398 additions and 0 deletions

1
README.md Normal file
View file

@ -0,0 +1 @@
# Overleaf Toolkit

11
bin/docker-compose Executable file
View file

@ -0,0 +1,11 @@
#! /usr/bin/env bash
set -euo pipefail
function __main__() {
exec docker-compose \
-f ./config/docker-compose.yml \
"$@"
}
__main__ "$@"

100
bin/doctor Executable file
View file

@ -0,0 +1,100 @@
#! /usr/bin/env bash
set -euo pipefail
SPACES_PER_INDENT=2
function indent_to_level() {
levels="$1"
number_of_spaces=$(( levels * SPACES_PER_INDENT ))
spaces="$(printf %${number_of_spaces}s)"
echo -n "${spaces}"
}
function print_doctor_header() {
echo "== Overleaf Doctor =="
}
function print_heading() {
_name="$1"
echo "- ${_name}:"
}
function print_sub_point() {
echo "$(indent_to_level 1)- $@"
}
function check_for_binary() {
local name="$1"
if [[ -z $(command -v "$name") ]]; then
report_error "$name not found"
fi
}
function check_host_information() {
print_heading "Host Information"
# Linux or not?
if [[ $(uname -a) =~ .*Linux.* ]]; then
print_sub_point "Linux"
else
print_sub_point "Not Linux !"
fi
# LSB Information (particular distribution of Linux, and version)
if [[ -n $(command -v lsb_release) ]]; then
print_sub_point "Output of 'lsb_release -a':"
lsb_release -a 2>&1 | while read -r _line; do
echo "$(indent_to_level 5)$_line"
done
else
print_sub_point "lsb_release not found !"
fi
}
function check_dependencies() {
function get_version() {
binary_name="$1"
if [[ "bash" == "$binary_name" ]]; then
bash -c 'echo $BASH_VERSION'
else
$binary_name --version
fi
}
number_of_tabs=2
function generate_tabs() {
printf %"$number_of_tabs"s | tr ' ' '\t'
}
function check_for_binary() {
binary_name="$1"
if [[ -n $(command -v $binary_name) ]]; then
version=$(get_version $binary_name)
print_sub_point "${binary_name}$(generate_tabs)(present, $version)"
else
print_sub_point "${binary_name}$(generate_tabs)(MISSING) !"
fi
}
print_heading "Dependencies"
declare -a binaries=(
bash
docker
docker-compose
)
for binary in "${binaries[@]}"; do
check_for_binary "$binary"
done
}
function __main__() {
print_doctor_header
check_host_information
check_dependencies
}
__main__ "$@"

0
bin/error-logs Executable file
View file

13
bin/info Executable file
View file

@ -0,0 +1,13 @@
#! /usr/bin/env bash
set -euo pipefail
function __main__() {
echo ">> Overleaf Info"
# TODO:
# - host info
# - docker version
# - bash version
}
__main__ "$@"

0
bin/logs Executable file
View file

0
bin/shell Executable file
View file

9
bin/up Executable file
View file

@ -0,0 +1,9 @@
#! /usr/bin/env bash
set -euo pipefail
function __main__() {
exec ./bin/docker-compose up
}
__main__ "$@"

146
config/docker-compose.yml Normal file
View file

@ -0,0 +1,146 @@
version: '2.2'
services:
overleaf:
restart: always
# Server Pro users:
# image: quay.io/sharelatex/sharelatex-pro
image: hello-world
# container_name: overleaf
# depends_on:
# mongo:
# condition: service_healthy
# redis:
# condition: service_started
# ports:
# - 80:80
# links:
# - mongo
# - redis
# volumes:
# - ~/sharelatex_data:/var/lib/sharelatex
# ########################################################################
# #### Server Pro: Un-comment the following line to mount the docker ####
# #### socket, required for Sibling Containers to work ####
# ########################################################################
# # - /var/run/docker.sock:/var/run/docker.sock
# environment:
# SHARELATEX_APP_NAME: Overleaf Community Edition
# SHARELATEX_MONGO_URL: mongodb://mongo/sharelatex
# # Same property, unfortunately with different names in
# # different locations
# SHARELATEX_REDIS_HOST: redis
# REDIS_HOST: redis
# ENABLED_LINKED_FILE_TYPES: 'url,project_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
# ## Set for SSL via nginx-proxy
# #VIRTUAL_HOST: 103.112.212.22
# # SHARELATEX_SITE_URL: http://sharelatex.mydomain.com
# # SHARELATEX_NAV_TITLE: Our ShareLaTeX Instance
# # SHARELATEX_HEADER_IMAGE_URL: http://somewhere.com/mylogo.png
# # SHARELATEX_ADMIN_EMAIL: support@it.com
# # SHARELATEX_LEFT_FOOTER: '[{"text": "Powered by <a href=\"https://www.sharelatex.com\">ShareLaTeX</a> 2016"},{"text": "Another page I want to link to can be found <a href=\"here\">here</a>"} ]'
# # SHARELATEX_RIGHT_FOOTER: '[{"text": "Hello I am on the Right"} ]'
# # SHARELATEX_EMAIL_FROM_ADDRESS: "team@sharelatex.com"
# # SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID:
# # SHARELATEX_EMAIL_AWS_SES_SECRET_KEY:
# # SHARELATEX_EMAIL_SMTP_HOST: smtp.mydomain.com
# # SHARELATEX_EMAIL_SMTP_PORT: 587
# # SHARELATEX_EMAIL_SMTP_SECURE: false
# # SHARELATEX_EMAIL_SMTP_USER:
# # SHARELATEX_EMAIL_SMTP_PASS:
# # SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH: true
# # SHARELATEX_EMAIL_SMTP_IGNORE_TLS: false
# # SHARELATEX_CUSTOM_EMAIL_FOOTER: "<div>This system is run by department x </div>"
# ################
# ## Server Pro ##
# ################
# # SANDBOXED_COMPILES: 'true'
# # SANDBOXED_COMPILES_SIBLING_CONTAINERS: 'true'
# # SANDBOXED_COMPILES_HOST_DIR: '/var/sharelatex_data/data/compiles'
# # SYNCTEX_BIN_HOST_PATH: '/var/sharelatex_data/bin/synctex'
# # DOCKER_RUNNER: 'false'
# ## Works with test LDAP server shown at bottom of docker compose
# # SHARELATEX_LDAP_URL: 'ldap://ldap:389'
# # SHARELATEX_LDAP_SEARCH_BASE: 'ou=people,dc=planetexpress,dc=com'
# # SHARELATEX_LDAP_SEARCH_FILTER: '(uid={{username}})'
# # SHARELATEX_LDAP_BIND_DN: 'cn=admin,dc=planetexpress,dc=com'
# # SHARELATEX_LDAP_BIND_CREDENTIALS: 'GoodNewsEveryone'
# # SHARELATEX_LDAP_EMAIL_ATT: 'mail'
# # SHARELATEX_LDAP_NAME_ATT: 'cn'
# # SHARELATEX_LDAP_LAST_NAME_ATT: 'sn'
# # SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN: 'true'
# # SHARELATEX_TEMPLATES_USER_ID: "578773160210479700917ee5"
# # SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS: '[ {"name":"All Templates","url":"/templates/all"}]'
# # SHARELATEX_PROXY_LEARN: "true"
# mongo:
# restart: always
# image: mongo
# container_name: mongo
# expose:
# - 27017
# volumes:
# - ~/mongo_data:/data/db
# healthcheck:
# test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
# interval: 10s
# timeout: 10s
# retries: 5
# redis:
# restart: always
# image: redis:5.0.0
# container_name: redis
# expose:
# - 6379
# volumes:
# - ~/redis_data:/data
# # ldap:
# # restart: always
# # image: rroemhild/test-openldap
# # container_name: ldap
# # expose:
# # - 389
# # See https://github.com/jwilder/nginx-proxy for documentation on how to configure the nginx-proxy container,
# # and https://github.com/overleaf/overleaf/wiki/HTTPS-reverse-proxy-using-Nginx for an example of some recommended
# # settings. We recommend using a properly managed nginx instance outside of the Overleaf Server Pro setup,
# # but the example here can be used if you'd prefer to run everything with docker-compose
# # nginx-proxy:
# # image: jwilder/nginx-proxy
# # container_name: nginx-proxy
# # ports:
# # #- "80:80"
# # - "443:443"
# # volumes:
# # - /var/run/docker.sock:/tmp/docker.sock:ro
# # - /home/sharelatex/tmp:/etc/nginx/certs

0
config/environment.yml Normal file
View file

2
config/local.env Normal file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
set -euo pipefail

0
data/.gitkeep Normal file
View file

View file

@ -0,0 +1,46 @@
version: '2.2'
services:
sharelatex:
restart: always
# Server Pro users:
# image: quay.io/sharelatex/sharelatex-pro
image: sharelatex/sharelatex
container_name: sharelatex
depends_on:
mongo:
condition: service_healthy
redis:
condition: service_started
privileged: true
ports:
- 80:80
links:
- mongo
- redis
volumes:
- ~/data/sharelatex_data:/var/lib/sharelatex
- /var/run/docker.sock:/var/run/docker.sock
env_file: ./private/environment
mongo:
restart: always
image: mongo
container_name: mongo
expose:
- 27017
volumes:
- ~/mongo_data:/data/db
healthcheck:
test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
interval: 10s
timeout: 10s
retries: 5
redis:
restart: always
image: redis
container_name: redis
expose:
- 6379
volumes:
- ~/redis_data:/data

70
examples/environment Normal file
View file

@ -0,0 +1,70 @@
SHARELATEX_APP_NAME: Overleaf Community Edition
SHARELATEX_MONGO_URL: mongodb://mongo/sharelatex
# Same property, unfortunately with different names in
# different locations
SHARELATEX_REDIS_HOST: redis
REDIS_HOST: redis
ENABLED_LINKED_FILE_TYPES: 'url,project_file'
# Enables Thumbnail generation using ImageMagick
ENABLE_CONVERSIONS: 'true'
# Disables email confirmation requirement
EMAIL_CONFIRMATION_DISABLED: 'true'
## Set for SSL via nginx-proxy
#VIRTUAL_HOST: 103.112.212.22
# SHARELATEX_SITE_URL: http://sharelatex.mydomain.com
# SHARELATEX_NAV_TITLE: Our ShareLaTeX Instance
# SHARELATEX_HEADER_IMAGE_URL: http://somewhere.com/mylogo.png
# SHARELATEX_ADMIN_EMAIL: support@it.com
# SHARELATEX_LEFT_FOOTER: '[{"text": "Powered by <a href=\"https://www.sharelatex.com\">ShareLaTeX</a> 2016"},{"text": "Another page I want to link to can be found <a href=\"here\">here</a>"} ]'
# SHARELATEX_RIGHT_FOOTER: '[{"text": "Hello I am on the Right"} ]'
# SHARELATEX_EMAIL_FROM_ADDRESS: "team@sharelatex.com"
# SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID:
# SHARELATEX_EMAIL_AWS_SES_SECRET_KEY:
# SHARELATEX_EMAIL_SMTP_HOST: smtp.mydomain.com
# SHARELATEX_EMAIL_SMTP_PORT: 587
# SHARELATEX_EMAIL_SMTP_SECURE: false
# SHARELATEX_EMAIL_SMTP_USER:
# SHARELATEX_EMAIL_SMTP_PASS:
# SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH: true
# SHARELATEX_EMAIL_SMTP_IGNORE_TLS: false
# SHARELATEX_CUSTOM_EMAIL_FOOTER: "<div>This system is run by department x </div>"
################
## Server Pro ##
################
# SANDBOXED_COMPILES: 'true'
# SANDBOXED_COMPILES_SIBLING_CONTAINERS: 'true'
# SANDBOXED_COMPILES_HOST_DIR: '/var/sharelatex_data/data/compiles'
# SYNCTEX_BIN_HOST_PATH: '/var/sharelatex_data/bin/synctex'
# DOCKER_RUNNER: 'false'
## Works with test LDAP server shown at bottom of docker compose
# SHARELATEX_LDAP_URL: 'ldap://ldap:389'
# SHARELATEX_LDAP_SEARCH_BASE: 'ou=people,dc=planetexpress,dc=com'
# SHARELATEX_LDAP_SEARCH_FILTER: '(uid={{username}})'
# SHARELATEX_LDAP_BIND_DN: 'cn=admin,dc=planetexpress,dc=com'
# SHARELATEX_LDAP_BIND_CREDENTIALS: 'GoodNewsEveryone'
# SHARELATEX_LDAP_EMAIL_ATT: 'mail'
# SHARELATEX_LDAP_NAME_ATT: 'cn'
# SHARELATEX_LDAP_LAST_NAME_ATT: 'sn'
# SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN: 'true'
# SHARELATEX_TEMPLATES_USER_ID: "578773160210479700917ee5"
# SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS: '[ {"name":"All Templates","url":"/templates/all"}]'
# SHARELATEX_PROXY_LEARN: "true"