Compare commits

...

4 commits

Author SHA1 Message Date
les
e326a2026b mv pass path 2020-10-02 23:33:12 +02:00
les
8047bcb9d0 up1 role up&running 2020-10-02 23:31:41 +02:00
les
401a96010b start lufi role 2020-10-02 21:28:53 +02:00
les
d479f747f0 start nginx role 2020-10-02 21:28:40 +02:00
8 changed files with 122 additions and 1 deletions

View file

@ -2,7 +2,7 @@
title: "Etherpad"
favicon: "favicon.ico"
hostname: ":80"
database_password: "{{lookup('password', './database_password')}}"
database_password: "{{lookup('password', './.pass/etherpad_db_password')}}"
pad_options_lang: 'it-it'
plugins: ['ep_comments_page', 'ep_headings2', 'ep_markdown', 'ep_align', 'ep_page_view']

View file

@ -0,0 +1,5 @@
---
- name: "Install NGINX"
apt:
name: nginx
update_cache: yes

View file

@ -0,0 +1,5 @@
---
api_key: "{{lookup('password', './.pass/up1_api_key')}}"
maximum_file_size: 500000000
port: 31337
footer: <a href="https://github.com/Upload/Up1" target="_blank">Source Code</a> - <a href="mailto:info@cisti.org" id="contact" target="_blank">Contact</a>

15
roles/up1/meta/main.yml Normal file
View file

@ -0,0 +1,15 @@
---
dependencies:
# install nodejs
- role: nodejs
# install caddy and configure it as reverse proxy
- role: caddy
vars:
caddy_config: |
{{hostname}}
encode gzip
reverse_proxy /api/* 127.0.0.1:31337
root * /srv/up1/up1/client
file_server

53
roles/up1/tasks/main.yml Normal file
View file

@ -0,0 +1,53 @@
---
- name: ensure lufi user is present
user:
name: "up1"
home: "/srv/up1"
shell: "/bin/bash"
state: present
- name: Clone up1 repo
git:
repo: https://github.com/Upload/Up1
dest: /srv/up1/up1
become: true
become_user: up1
- name: copy server settings
template:
src: server.conf.j2
dest: /srv/up1/up1/server/server.conf
owner: up1
group: up1
mode: 0600
- name: copy client settings
template:
src: config.js.j2
dest: /srv/up1/up1/client/config.js
owner: up1
group: up1
mode: 0600
- name: Install up1 deps
become: true
become_user: up1
npm:
path: /srv/up1/up1/server
- name: NODE | Install pm2
npm:
name: pm2
global: yes
production: yes
state: present
- name: NODE | Start APP
become: true
become_user: up1
shell: pm2 start server.js --name server
args:
chdir: /srv/up1/up1/server
ignore_errors: yes

View file

@ -0,0 +1,4 @@
upload.config.server = '' // Empty if the webapp is in the same place as the server
// upload.config.server = 'https://yourserver.com/' // If the webapp is separated from the server - remember the trailing slash
upload.config.api_key = '{{ api_key }}' // Should be the same as the server, used for uploading
upload.config.footer = '{{ footer }}'

View file

@ -0,0 +1,29 @@
{
"api_key": "{{ api_key }}",
"delete_key": "",
"maximum_file_size": {{ maximum_file_size }},
"path": {
"i": "../i",
"client": "../client"
},
"http": {
"enabled": true,
"listen": "127.0.0.1:{{ port }}"
},
"https": {
"enabled": false,
"listen": ":443",
"cert": "./cert.pem",
"key": "./key.pem"
},
"cloudflare-cache-invalidate": {
"enabled": false,
"token": "Cloudflare API token here",
"email": "Cloudflare login email here",
"domain": "Domain to invalidate cache on"
}
}

10
up1.playbook.yml Normal file
View file

@ -0,0 +1,10 @@
---
- name: "Testing up1 role"
hosts: localhost
become: true
roles:
- role: common
- role: up1
vars:
hostname: :8000