Skip to content

Commit

Permalink
feat: added healthcheck to outline
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasPeters committed Aug 27, 2024
1 parent 6eb31bf commit 8bd46c9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
13 changes: 13 additions & 0 deletions ansible/roles/outline/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
mode: "0600"
notify: "trigger outline migration"

- name: "Create outline 'Dockerfile'"
ansible.builtin.template:
src: "Dockerfile.j2"
dest: "{{ outline_config.project_source }}/Dockerfile"
owner: "outline"
group: "outline"
mode: "0600"
notify: "trigger outline migration"

- name: "Create outline 'docker.env' file"
ansible.builtin.template:
src: "docker.env.j2"
Expand Down Expand Up @@ -76,6 +85,10 @@
path: "{{ outline_config.project_source }}/.MIGRATION_PENDING"
state: "absent"

- name: "Install required packages"
ansible.builtin.apt:
name: "wget"
state: "present"

- name: "Docker compose"
ansible.builtin.include_tasks: "../docker/tasks/compose-up.yml"
Expand Down
15 changes: 15 additions & 0 deletions ansible/roles/outline/templates/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM outlinewiki/outline:{{ outline_config.version }}

# Become root to install package
USER root

RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*

HEALTHCHECK --interval=5m --start-period=30s --start-interval=10s CMD \
wget -qO- http://localhost:${PORT}/_health | grep -q "OK" \
&& wget -qO- https://hc-ping.com/{{ secret_healthchecks_io.ping_key }}/outline

# Return to defaut user for security reasons
USER nodejs
5 changes: 3 additions & 2 deletions ansible/roles/outline/templates/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
services:

outline:
image: outlinewiki/outline:{{ outline_config.version }}
restart: unless-stopped
build:
dockerfile: Dockerfile
env_file: ./docker.env
restart: on-failure:3
# ports:
# - "4568:3000"
network_mode: host # TODO replace this
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/outline/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

outline_config:
project_source: "/var/www/outline/outline"
version: "0.78.0"
version: "0.78.0" # Git tag

0 comments on commit 8bd46c9

Please sign in to comment.