les 3 years ago
parent
commit
23c6bb4bd3

+ 9 - 15
README.md

@@ -1,21 +1,15 @@
 # silicone
-
 Un angolo ragionato per facilitare la messa in opera di servizi autogestiti di prossimità
-  
-
-## Appunti
-Puntando alla semplificazione la maggior parte delle scelte le dobbiamo fare qui.
 
-Ci sono due setup possibili:
-- si vuole uno e un solo servizio per macchina (vps)
-- una macchina gestisce piu' servizi
-
-Quello che cambia è che nel primo caso nginx (per i servizi web) e' interno, nell'altro
-caso e' esterno.
-
-## Ansible
+## Come si usa
+Si imposta il proprio inventory (inventory.yml) e il proprio playbook
+(infra.yml) 
 
+  
+## Password
+Per le password si usa pass, il path usato e' specificato nell'inventory 
 
-## Scrivere nuovi ruoli o testare configurazioni diverse
-Usiamo vagrant dentro `/dev`
 
+## Creare nuovi ruoli:
+Ci sono varie possibilità, si può usare docker o vagrant, sono dentro
+`dev/`, per docker c'e' un README.md

+ 9 - 0
ansible.cfg

@@ -0,0 +1,9 @@
+
+[defaults]
+inventory = ./inventory.yml
+interpreter_python = /usr/bin/python3
+remote_user = root
+
+
+[ssh_connection]
+scp_if_ssh=True

+ 0 - 60
assets/Dockerfile

@@ -1,60 +0,0 @@
-# Etherpad Lite Dockerfile
-#
-# https://github.com/ether/etherpad-lite
-#
-# Author: muxator
-
-FROM node:10-buster-slim
-LABEL maintainer="Etherpad team, https://github.com/ether/etherpad-lite"
-
-# plugins to install while building the container. By default no plugins are
-# installed.
-# If given a value, it has to be a space-separated, quoted list of plugin names.
-#
-# EXAMPLE:
-#   ETHERPAD_PLUGINS="ep_codepad ep_author_neat"
-ARG ETHERPAD_PLUGINS="ep_adminpads2 ep_align ep_comments_page ep_headings2 ep_markdown ep_table_of_contents ep_delete_after_delay_lite"
-
-# By default, Etherpad container is built and run in "production" mode. This is
-# leaner (development dependencies are not installed) and runs faster (among
-# other things, assets are minified & compressed).
-ENV NODE_ENV=production
-
-# Follow the principle of least privilege: run as unprivileged user.
-#
-# Running as non-root enables running this image in platforms like OpenShift
-# that do not allow images running as root.
-RUN useradd --uid 5001 --create-home etherpad
-
-RUN mkdir /opt/etherpad-lite && chown etherpad:0 /opt/etherpad-lite
-
-USER etherpad
-
-WORKDIR /opt/etherpad-lite
-
-COPY --chown=etherpad:0 ./ ./
-
-# install node dependencies for Etherpad
-RUN bin/installDeps.sh && \
-	rm -rf ~/.npm/_cacache
-
-# Install the plugins, if ETHERPAD_PLUGINS is not empty.
-#
-# Bash trick: in the for loop ${ETHERPAD_PLUGINS} is NOT quoted, in order to be
-# able to split at spaces.
-RUN for PLUGIN_NAME in ${ETHERPAD_PLUGINS}; do npm install "${PLUGIN_NAME}"; done
-
-# Copy the configuration file.
-COPY --chown=etherpad:0 ./settings.json.docker /opt/etherpad-lite/settings.json
-
-# Fix permissions for root group
-RUN chmod -R g=u .
-COPY --chown=etherpad:0 assets/index.css /opt/etherpad-lite/src/static/skins/colibris/
-COPY --chown=etherpad:0 assets/fond.jpg /opt/etherpad-lite/src/static/skins/colibris/images/
-COPY --chown=etherpad:0 assets/logo.png /opt/etherpad-lite/src/static/skins/colibris/images/
-COPY --chown=etherpad:0 assets/index.html /opt/etherpad-lite/src/templates/
-COPY --chown=etherpad:0 assets/index.js /opt/etherpad-lite/src/static/skins/colibris/
-COPY --chown=etherpad:0 assets/iframe_editor.css /opt/etherpad-lite/src/static/css/
-
-EXPOSE 9001
-CMD ["node", "node_modules/ep_etherpad-lite/node/server.js"]

+ 2 - 1
assets/etherpad/iframe_editor.css

@@ -30,6 +30,7 @@ html.inner-editor {
   padding: 10px;
   overflow: hidden;
   background-color: white;
+  line-height: 25px;
 
   /* Be careful editing following rules. Longs words should not overflow, ep_align justify should work,
      Test on chrome, firefox and safari... Copy / Paste a word inside a sentence should not add line-breaks
@@ -139,4 +140,4 @@ body.mozilla, body.safari {
 }
 body.grayedout {
   background-color: #eee !important
-}
+}

+ 15 - 0
dev/README.md

@@ -0,0 +1,15 @@
+# only once
+docker network create --subnet=172.172.0.0/16 silicone
+docker build -t silicone:base .
+
+# for each service to test
+# create a container with static ip
+docker run --name etherpad  -d --net silicone --ip 172.172.0.2 -it silicone:base 
+
+# copy your ssh key
+docker cp ~/.ssh/id_rsa.pub etherpad:/root/.ssh/authorized_keys
+docker exec -it etherpad chown root.root /root/.ssh/authorized_keys
+
+
+# then you can go with ansible using 172.172.0.2 as your host inside
+  inventory

+ 4 - 26
infra.yml

@@ -1,32 +1,10 @@
 ---
 
-- name: "Etherpad"
+## ETHERPAD
+- name: Etherpad
   hosts: paddone
   roles:
     - role: stable/common
     - role: stable/etherpad
-  vars:
-    title: "Pad@cisti"
-    pad_lang: "it-IT"
-    pad_default_text: |
-      Sei su pad.cisti.org! Qui potrai usare usare PAD.
-      Un PAD è uno strumento di scrittura collaborativa per scrivere testi, comunicati o quello che vuoi assieme ad altre persone!
-      Questo è uno dei servizi di cisti.org, fuori dalle logiche del profitto e del capitalismo, dietro ci sono un gruppo di persone volontarie che si responsabilizzano a mantenere in piedi tutto questo.
-
-      ALCUNE COSE DA SAPERE:
-      - Per iniziare cancella tutto questo testo e inizia a scrivere!
-      - Ogni pad può essere modificato da CHIUNQUE sia in possesso del sito (URL) o che possa indovinarlo facilmente, quindi scegli bene il nome del pad che vuoi creare!
-      - Questo pad verrà eliminato automaticamente dopo 60 giorni di inattività
-      - Una volta cancellato un pad NON ci sono modi di recuperarlo!
-      - Questo pad ci tiene così tanto alla privacy che non sappiamo neanche chi sei, rispetta l'anonimato e usalo bene.
-
-
-
-                                                          made with ❤ by underscore_to hacklab
-    override_files:
-      - index.css: /srv/etherpad/etherpad/src/static/skins/colibris/
-      - fond.jpg: /srv/etherpad/etherpad/src/static/skins/colibris/images/
-      - logo.png: /srv/etherpad/etherpad/src/static/skins/colibris/images/
-      - index.html: /srv/etherpad/etherpad/src/templates/
-      - index.js: /srv/etherpad/etherpad/src/static/skins/colibris/
-      - iframe_editor.css: /srv/etherpad/etherpad/src/static/css/
+  vars_files:
+    - vars/etherpad.yml

+ 4 - 4
inventory.yml

@@ -1,6 +1,6 @@
 paddone:
-  hosts: 192.168.199.102
-  vars:
-    ansible_user: root
-    ansible_python_interpreter: /usr/bin/python3
+  hosts: paddone.cose.belle
 
+all:
+  vars:
+    passwordstore_path: cisti.org/ansible

+ 2 - 1
roles/stable/etherpad/defaults/main.yml

@@ -4,7 +4,8 @@ favicon: "favicon.ico"
 listen_ip: "0.0.0.0"
 listen_port: "8001"
 log_level: "INFO"
-database_password: "{{lookup('password', './.pass/etherpad_db_password')}}"
+database_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/etherpad/db_password create=True nosymbols=true')}}"
+pad_admin_password: "{{lookup('community.general.passwordstore', '{{passwordstore_path}}/etherpad/admin_password create=True nosymbols=true')}}"
 
 plugins: ['ep_headings2', 'ep_table_of_contents', 'ep_comments_page', 'ep_align', 'ep_delete_after_delay_lite']
 

+ 6 - 6
roles/stable/etherpad/templates/settings.json.j2

@@ -363,21 +363,21 @@
      * Set to 0 to disable extra scrolling
      */
     "percentage": {
-      "editionAboveViewport": 0,
-      "editionBelowViewport": 0
+      "editionAboveViewport": 0.2,
+      "editionBelowViewport": 0.2
     },
 
     /*
      * Time (in milliseconds) used to animate the scroll transition.
      * Set to 0 to disable animation
      */
-    "duration": 0,
+    "duration": 200,
 
     /*
      * Flag to control if it should scroll when user places the caret in the
      * last line of the viewport
      */
-    "scrollWhenCaretIsInTheLastLineOfViewport": false,
+    "scrollWhenCaretIsInTheLastLineOfViewport": true,
 
     /*
      * Percentage of viewport height to be additionally scrolled when user
@@ -403,7 +403,7 @@
     "admin": {
       // 1) "password" can be replaced with "hash" if you install ep_hash_auth
       // 2) please note that if password is null, the user will not be created
-      "password": "fk30f1EmWspoCVQOqgvhuODHw",
+      "password": "{{pad_admin_password}}",
       "is_admin": true
     },
   },
@@ -418,7 +418,7 @@
    *
    * WARNING: this will disable security on the instance.
    */
-  "loadTest": "${LOAD_TEST:false}",
+  "loadTest": false,
 
   /*
    * Disable indentation on new line when previous line ends with some special

+ 0 - 1
tests/assets

@@ -1 +0,0 @@
-../assets

+ 0 - 32
tests/etherpad-playbook.yml

@@ -1,32 +0,0 @@
----
-
-- name: "Testing etherpad role"
-  hosts: etherpad
-  roles:
-    - role: stable/common
-    - role: stable/etherpad
-  vars:
-    title: "Pad@cisti"
-    pad_lang: "it-IT"
-    pad_default_text: |
-      Sei su pad.cisti.org! Qui potrai usare usare PAD.
-      Un PAD è uno strumento di scrittura collaborativa per scrivere testi, comunicati o quello che vuoi assieme ad altre persone!
-      Questo è uno dei servizi di cisti.org, fuori dalle logiche del profitto e del capitalismo, dietro ci sono un gruppo di persone volontarie che si responsabilizzano a mantenere in piedi tutto questo.
-
-      ALCUNE COSE DA SAPERE:
-      - Per iniziare cancella tutto questo testo e inizia a scrivere!
-      - Ogni pad può essere modificato da CHIUNQUE sia in possesso del sito (URL) o che possa indovinarlo facilmente, quindi scegli bene il nome del pad che vuoi creare!
-      - Questo pad verrà eliminato automaticamente dopo 60 giorni di inattività
-      - Una volta cancellato un pad NON ci sono modi di recuperarlo!
-      - Questo pad ci tiene così tanto alla privacy che non sappiamo neanche chi sei, rispetta l'anonimato e usalo bene.
-
-
-
-                                                          made with ❤ by underscore_to hacklab
-    override_files:
-      - index.css: /srv/etherpad/etherpad/src/static/skins/colibris/
-      - fond.jpg: /srv/etherpad/etherpad/src/static/skins/colibris/images/
-      - logo.png: /srv/etherpad/etherpad/src/static/skins/colibris/images/
-      - index.html: /srv/etherpad/etherpad/src/templates/
-      - index.js: /srv/etherpad/etherpad/src/static/skins/colibris/
-      - iframe_editor.css: /srv/etherpad/etherpad/src/static/css/                                                          

+ 0 - 9
tests/goploader.yml

@@ -1,9 +0,0 @@
----
-
-- name: "GoPloader Testing Role"
-  hosts: goploader.antifa.tech
-  roles:
-    - role: common
-    - role: goploader
-      vars:
-         hostname: goploader.antifa.tech

+ 0 - 12
tests/infra.yml

@@ -1,12 +0,0 @@
----
-
-- name: "Frontend"
-  hosts: frontend
-  become: true
-  roles:
-    - role: frontend
-      vars:
-        proxies:
-          cicles.cisti.org: "{{grande_macchina}}:8080"
-          mastodon.cisti.org: "{{grande_macchina}}:9001"
-          gancio.cisti.org: "{{grande_macchina}}:9001"

+ 0 - 7
tests/inventory.yml

@@ -1,7 +0,0 @@
-etherpad:
-  hosts: 172.172.0.2
-  vars:
-    ansible_user: root
-    ansible_ssh_private_key_file: /home/les/.ssh/id_rsa.pub
-    ansible_python_interpreter: /usr/bin/python3
-

+ 0 - 1
tests/roles

@@ -1 +0,0 @@
-../roles

+ 0 - 10
tests/up1.playbook.yml

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

+ 27 - 0
vars/etherpad.yml

@@ -0,0 +1,27 @@
+---
+  title: "Pad@cisti"
+  pad_lang: "it-IT"
+  pad_default_text: |
+    Sei su pad.cisti.org! Qui potrai usare usare PAD.
+    Un PAD è uno strumento di scrittura collaborativa per scrivere testi, comunicati o quello che vuoi assieme ad altre persone!
+    Questo è uno dei servizi di cisti.org, fuori dalle logiche del profitto e del capitalismo, dietro ci sono un gruppo di persone volontarie che si responsabilizzano a mantenere in piedi tutto questo.
+
+    ALCUNE COSE DA SAPERE:
+    - Per iniziare cancella tutto questo testo e inizia a scrivere!
+    - Ogni pad può essere modificato da CHIUNQUE sia in possesso del sito (URL) o che possa indovinarlo facilmente, quindi scegli bene il nome del pad che vuoi creare!
+    - Questo pad verrà eliminato automaticamente dopo 60 giorni di inattività
+    - Una volta cancellato un pad NON ci sono modi di recuperarlo!
+    - Questo pad ci tiene così tanto alla privacy che non sappiamo neanche chi sei, rispetta l'anonimato e usalo bene.
+
+
+
+                                                          made with ❤ by underscore_to hacklab
+
+  # Custom cisti.org style modification (background image, display random pad string in input field)
+  override_files:
+    - index.css: /srv/etherpad/etherpad/src/static/skins/colibris/
+    - fond.jpg: /srv/etherpad/etherpad/src/static/skins/colibris/images/
+    - logo.png: /srv/etherpad/etherpad/src/static/skins/colibris/images/
+    - index.html: /srv/etherpad/etherpad/src/templates/
+    - index.js: /srv/etherpad/etherpad/src/static/skins/colibris/
+    - iframe_editor.css: /srv/etherpad/etherpad/src/static/css/