Skip to content

Commit

Permalink
✨ (linkstack): Added a new role linkstack
Browse files Browse the repository at this point in the history
  • Loading branch information
theobori committed Jun 17, 2024
1 parent 04db94e commit b8117bf
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
- role: monitoring
tags: monitoring

- role: linkstack
tags: linkstack

- role: vitalk.secure-ssh
tags: ssh
ssh_user: "{{ ansible_ssh_user }}"
Expand Down
16 changes: 16 additions & 0 deletions roles/linkstack/files/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.8"

services:
linkstack:
image: linkstackorg/linkstack
container_name: linkstack
hostname: linkstack
env_file: .env
ports:
- "127.0.0.1:8880:80"
restart: unless-stopped
volumes:
- linkstack:/htdocs

volumes:
linkstack:
18 changes: 18 additions & 0 deletions roles/linkstack/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- name: Include service role
ansible.builtin.include_role:
name: "service"
vars:
service_name: "linkstack"
service_fqdn: "links.{{ domain }}"
service_nginx_port: "8880"
service_certbot: true
service_nginx: false
service_tor: false
service_docker_compose: false
service_systemd_service: false

- name: Copy LinkStack environment file
ansible.builtin.template:
src: ".env.j2"
dest: "{{ base_dir }}/linkstack/.env"
mode: "0640"
3 changes: 3 additions & 0 deletions roles/linkstack/templates/.env.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HTTP_SERVER_NAME: "links.{{ domain }}"
HTTPS_SERVER_NAME: "links.{{ domain }}"
SERVER_ADMIN: "{{ mailer_from }}"
22 changes: 22 additions & 0 deletions roles/linkstack/templates/nginx.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
include listen-443;
server_name {{ server_name }};

include ssl_params;
ssl_certificate /etc/letsencrypt/live/{{ server_name }}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{ server_name }}/privkey.pem;

include header_params;

location / {
include proxy_params;

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;

# Fixes Mixed Content errors.
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';

proxy_pass http://localhost:{{ server_port }}/;
}
}

0 comments on commit b8117bf

Please sign in to comment.