Si vous constatez la perte de tickets, de commentaires ou de projets, veuillez consulter la page https://status.framasoft.org/incident/626.

Verified Commit 1371079d authored by Luc Didry's avatar Luc Didry

First version, working

parents
Pipeline #132875 passed with stages
in 46 seconds
conf-generator/public/peertube.sls
*.swp
image: hatsoftwares/pillar-generator:latest
pages:
script:
- cp pillar/ttrss.sls conf-generator/public/pillar.sls
- cd conf-generator/
- yarn install -s --pure-lockfile
- NODE_ENV=production yarn run build
- mv dist/ ../public/
artifacts:
paths:
- public
only:
- master
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
# Salt formula for Tiny Tiny RSS installation
## What does it do?
This formula:
- installs [Tiny Tiny RSS](https://tt-rss.org/) with all its dependencies (PostgreSQL, PHP…)
- configures it
- installs and configures Nginx to serve Tiny Tiny RSS
- creates a [Let’s encrypt](https://letsencrypt.org/) certificate and configures Nginx to use it
- creates a cron task to warn you about the certificate expiration (even if the certificate should be automatically renewed)
- sets up a backup system (with [borg](https://borgbackup.readthedocs.io/) and `pg_dump`)
- can install and configure [`apticron`](https://packages.debian.org/stretch/apticron)
## How to use it?
Put `salt/ttrss/` into your Salt formulas directory, use <https://fiat-tux.frama.io/hat-softwares/salt/ttrss> to create the needed pillar configuration, put it into your pillar configuration, then you’re good to go.
## How to use it with salt-ssh?
All commands have to be run with the `root` user.
Install `salt-ssh`:
```
apt install salt-ssh
```
Modify `/etc/salt/roster`:
```
# You will need to authorize root to use SSH
# For security, authorize it only with SSH keys (PermitRootLogin prohibit-password in /etc/ssh/sshd_config)
my_server:
host: serveur.example.org
user: root
# Alternatively, you can use a regular user with sudo privilege
#my_server:
# host: serveur.example.org
# user: foo
# sudo: True
```
Let `salt-ssh` creates a pair of SSH keys (answer no to the question that will be asked):
```
salt-ssh my_server test.ping
```
Put `/var/lib/salt/pki/master/ssh/salt-ssh.rsa.pub` content in `/root/.ssh/authorized_keys` (or `~.ssh/authorized_keys` of the user you choose)
Copy the formula
```
cp -r salt pillar /srv/
```
Use <https://fiat-tux.frama.io/salt/ttrss> to create the needed pillar, put it into your pillar configuration, then you’re good to go.
```
salt-ssh my_server state.sls ttrss
```
## Translating
If you want to translate the pillar generator in your language, you can do it on <https://trad.framasoft.org/iteration/view/salt/ttrss>.
Please, read its [homepage](https://trad.framasoft.org/) to know how to do it.
If you want to add a non-listed language on zanata, please create an issue on <https://framagit.org/fiat-tux/salt/ttrss/issues>.
.DS_Store
node_modules
/dist
po/*po
.zanata-cache/
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
push-locales:
node ./node_modules/i18next-conv/bin/index.js -l en -s public/locales/en.json -t po/ttrss.pot
zanata-cli -q -B push
pull-locales:
zanata-cli -q -B pull --min-doc-percent 40
for i in po/*.po; do \
lang=$$(basename $$i | sed -e 's/\.po$$//'); \
node ./node_modules/i18next-conv/bin/index.js --skipUntranslated -l $$lang -s $$i -t public/locales/$$lang.json; \
done
stats-locales:
zanata-cli -q stats
# pillar-conf-generator
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn run serve
```
### Compiles and minifies for production
```
yarn run build
```
### Run your tests
```
yarn run test
```
### Lints and fixes files
```
yarn run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/app'
]
}
{
"name": "peertube-pillar-generator",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@panter/vue-i18next": "^0.15.0",
"axios": "^0.18.0",
"bulma": "^0.7.4",
"bulma-extensions": "^6.2.5",
"core-js": "^2.6.5",
"i18next": "^15.1.0",
"i18next-browser-languagedetector": "^3.0.1",
"i18next-fetch-backend": "^2.2.0",
"iso-639": "^0.2.2",
"js-yaml": "^3.13.1",
"vue": "^2.6.10"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.7.0",
"@vue/cli-plugin-eslint": "^3.7.0",
"@vue/cli-service": "^3.7.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"i18next-conv": "^9.0.0",
"node-sass": "^4.12.0",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.5.21"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {
"no-console": 0,
"no-irregular-whitespace": 0
},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2019-05-06T20:43:10.301Z\n"
"PO-Revision-Date: 2019-05-06T20:43:10.301Z\n"
"Language: en\n"
msgid "Tiny Tiny RSS pillar generator"
msgstr "Tiny Tiny RSS pillar generator"
msgid "Created by {{- opentag}}Luc Didry{{- endtag}}"
msgstr "Created by {{- opentag}}Luc Didry{{- endtag}}"
msgid "Source"
msgstr "Source"
msgid "Language"
msgstr "Language"
msgid "Your instance"
msgstr "Your instance"
msgid ""
"Web address of your Tiny Tiny RSS instance (without {{- "
"opentag}}http(s)://{{- endtag}})"
msgstr ""
"Web address of your Tiny Tiny RSS instance (without {{- "
"opentag}}http(s)://{{- endtag}})"
msgid "How many CPU threads should be allocated to the update daemon?"
msgstr "How many CPU threads should be allocated to the update daemon?"
msgid "Setting up email sending"
msgstr "Setting up email sending"
msgid "Display name of the email’s sender"
msgstr "Display name of the email’s sender"
msgid "Email sender address"
msgstr "Email sender address"
msgid "Subject of digest emails"
msgstr "Subject of digest emails"
msgid "Registrations"
msgstr "Registrations"
msgid "Open registrations?"
msgstr "Open registrations?"
msgid ""
"Maximum number of accounts (when this number is reached, registrations are "
"disabled. For an unlimited number of accounts, put {{- opentag}}0{{- "
"endtag}})"
msgstr ""
"Maximum number of accounts (when this number is reached, registrations are "
"disabled. For an unlimited number of accounts, put {{- opentag}}0{{- "
"endtag}})"
msgid "Admin account"
msgstr "Admin account"
msgid ""
"The login of the admin account is, without surprise, {{- opentag}}admin{{- "
"endtag}}."
msgstr ""
"The login of the admin account is, without surprise, {{- opentag}}admin{{- "
"endtag}}."
msgid "Email attached to admin account"
msgstr "Email attached to admin account"
msgid "Password of admin account"
msgstr "Password of admin account"
msgid ""
"Apticron is a program that runs daily on your server and notifies you by "
"email if package updates are available."
msgstr ""
"Apticron is a program that runs daily on your server and notifies you by "
"email if package updates are available."
msgid "Install apticron? {{- opentag}}recommended{{- endtag}}"
msgstr "Install apticron? {{- opentag}}recommended{{- endtag}}"
msgid ""
"Recipient for apticron’s emails ({{- opentag}}root{{- endtag}} is ok if you "
"configured a real address in {{- opentag}}/etc/aliases{{- endtag}}"
msgstr ""
"Recipient for apticron’s emails ({{- opentag}}root{{- endtag}} is ok if you "
"configured a real address in {{- opentag}}/etc/aliases{{- endtag}}"
msgid "Download configuration"
msgstr "Download configuration"
msgid "Reset"
msgstr "Reset"
\ No newline at end of file
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>Tiny Tiny RSS pillar generator</title>
</head>
<body>
<noscript>
<strong>We're sorry but PeerTube pillar generator doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
{
"Tiny Tiny RSS pillar generator": "Tiny Tiny RSS pillar generator",
"Created by {{- opentag}}Luc Didry{{- endtag}}": "Created by {{- opentag}}Luc Didry{{- endtag}}",
"Source": "Source",
"Language": "Language",
"Your instance": "Your instance",
"Web address of your Tiny Tiny RSS instance (without {{- opentag}}http(s)://{{- endtag}})": "Web address of your Tiny Tiny RSS instance (without {{- opentag}}http(s)://{{- endtag}})",
"How many CPU threads should be allocated to the update daemon?": "How many CPU threads should be allocated to the update daemon?",
"Setting up email sending": "Setting up email sending",
"Display name of the email’s sender": "Display name of the email’s sender",
"Email sender address": "Email sender address",
"Subject of digest emails": "Subject of digest emails",
"Registrations": "Registrations",
"Open registrations?": "Open registrations?",
"Maximum number of accounts (when this number is reached, registrations are disabled. For an unlimited number of accounts, put {{- opentag}}0{{- endtag}})": "Maximum number of accounts (when this number is reached, registrations are disabled. For an unlimited number of accounts, put {{- opentag}}0{{- endtag}})",
"Admin account": "Admin account",
"The login of the admin account is, without surprise, {{- opentag}}admin{{- endtag}}.": "The login of the admin account is, without surprise, {{- opentag}}admin{{- endtag}}.",
"Email attached to admin account": "Email attached to admin account",
"Password of admin account": "Password of admin account",
"Apticron is a program that runs daily on your server and notifies you by email if package updates are available.": "Apticron is a program that runs daily on your server and notifies you by email if package updates are available.",
"Install apticron? {{- opentag}}recommended{{- endtag}}": "Install apticron? {{- opentag}}recommended{{- endtag}}",
"Recipient for apticron’s emails ({{- opentag}}root{{- endtag}} is ok if you configured a real address in {{- opentag}}/etc/aliases{{- endtag}}": "Recipient for apticron’s emails ({{- opentag}}root{{- endtag}} is ok if you configured a real address in {{- opentag}}/etc/aliases{{- endtag}}",
"Download configuration": "Download configuration",
"Reset": "Reset"
}
\ No newline at end of file
{
"Tiny Tiny RSS pillar generator": "Générateur de pillar pour Tiny Tiny RSS",
"Created by {{- opentag}}Luc Didry{{- endtag}}": "Créé par {{- opentag}}Luc Didry{{- endtag}}",
"Source": "Source",
"Language": "Langage",
"Your instance": "Votre instance",
"Web address of your Tiny Tiny RSS instance (without {{- opentag}}http(s)://{{- endtag}})": "Adresse web de votre instance Tiny Tiny RSS (sans {{- opentag}}http(s)://{{- endtag}})",
"How many CPU threads should be allocated to the update daemon?": "Combien de <em>threads</em> CPU faut-il allouer au dæmon de mise à jour des flux RSS ?",
"Setting up email sending": "Paramètrage de l’envoi de courriels",
"Display name of the email’s sender": "Nom affiché de l’expéditeur des courriels",
"Email sender address": "Adresse d’expéditeur des courriels",
"Subject of digest emails": "Sujet des emails de résumé",
"Registrations": "Inscriptions",
"Open registrations?": "Ouvrir les inscriptions ?",
"Maximum number of accounts (when this number is reached, registrations are disabled. For an unlimited number of accounts, put {{- opentag}}0{{- endtag}})": "Nombre maximum de comptes (lorsque ce nombre est atteint, les inscriptions sont désactivées. Pour un nombre illimité de comptes, mettre {{- opentag}}0{{- endtag}})",
"Admin account": "Compte administrateur",
"The login of the admin account is, without surprise, {{- opentag}}admin{{- endtag}}.": "L’identifiant du compte administrateur est, sans surprise, {{- opentag}}admin{{- endtag}}.",
"Email attached to admin account": "Email attaché au compte admin",
"Password of admin account": "Mot de passe du compte admin",
"Apticron is a program that runs daily on your server and notifies you by email if package updates are available.": "Apticron est un programme lancé quotidiennement sur votre serveur et qui vous informe par courriel si des mises à jour de paquets sont disponibles.",
"Install apticron? {{- opentag}}recommended{{- endtag}}": "Installer apticron ? {{- opentag}}recommandé{{- endtag}}",
"Recipient for apticron’s emails ({{- opentag}}root{{- endtag}} is ok if you configured a real address in {{- opentag}}/etc/aliases{{- endtag}}": "Destinataire des courriels d’apticron ({{- opentag}}root{{- endtag}} peut convenir si vous avez configuré une véritable adresse dans {{- opentag}}/etc/aliases{{- endtag}})",
"Download configuration": "Télécharger la configuration",
"Reset": "Réinitialiser"
}
\ No newline at end of file
# vim:set sw=2 ts=2 sts=2 ft=yaml expandtab:
ttrss:
my_server:
db_password: ''
apticron:
enabled: false
email: root
hostname: ttrss.example.com
threads: 1
admin:
email: admin@example.com
password: totototo
registration:
activated: false
accounts_number: 10
smtp:
from_name: Tiny Tiny RSS
from_address: noreply@example.com
digest_subject: '[tt-rss] New headlines for last 24 hours'
<template>
<section class="container content" id="app">
<h1 class="h1 has-text-centered">
{{ $t('Tiny Tiny RSS pillar generator', {foo: 'bar'}) }}
</h1>
<div class="field is-horizontal">
<div class="field-label is-normal">
<label for="lang" class="label">
{{ $t('Language') }}
</label>
</div>
<div class="field-body">
<div class="select">
<select id="lang" v-model="$i18n.i18next.language" v-on:change="changeLang">
<option v-for="lang in filteredLangs" v-bind:key="lang" :value="lang">{{ nativeName(lang) }}</option>
</select>
</div>
</div>
</div>
<Form/>
<footer class="has-text-centered is-size-7">
<span v-html="$t('Created by {{- opentag}}Luc Didry{{- endtag}}', { opentag: fiatTuxUrl })"></span>
<a href="https://framagit.org/fiat-tux/salt/ttrss" target="_blank" rel="noreferrer">{{ $t('Source') }}</a>
</footer>
</section>
</template>
<script>
import Form from './components/Form.vue'
let iso_639_1 = require('iso-639').iso_639_1
export default {
name: 'app',
components: {
Form
},
data() {
return {
fiatTuxUrl: '<a href="https://fiat-tux.fr" target="_blank" rel="noreferrer">',
}
},
methods: {
nativeName: function(code) {
return this.capitalizeFirstLetter(iso_639_1[code].nativeName);
},
changeLang: function(event) {
this.$i18n.i18next.changeLanguage(event.target.value);
},
capitalizeFirstLetter: function(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
},
computed: {
filteredLangs: function() {
let langs = this.$i18n.i18next.options.whitelist
let index = langs.indexOf('cimode')
if (index === -1)
return langs
langs.splice(index, 1)
return langs
}
}
}
</script>
<style lang="sass">
@import '../node_modules/bulma/sass/utilities/_all.sass'
@import '../node_modules/bulma/sass/base/_all.sass'
@import '../node_modules/bulma/sass/layout/section.sass'
@import '../node_modules/bulma/sass/grid/columns.sass'
@import '../node_modules/bulma/sass/elements/content.sass'
@import '../node_modules/bulma/sass/elements/container.sass'
@import '../node_modules/bulma/sass/elements/button.sass'
@import '../node_modules/bulma/sass/elements/tag.sass'
@import '../node_modules/bulma/sass/elements/form.sass'
@import '../node_modules/bulma-extensions/bulma-accordion/dist/css/bulma-accordion.sass'
.container
margin-top: 20px
margin-left: auto
margin-right: auto
max-width: 960px
footer
margin-top: 10px
</style>
This diff is collapsed.
import Vue from 'vue'
import App from './App.vue'
import i18next from 'i18next';
import VueI18Next from '@panter/vue-i18next';
import Fetch from 'i18next-fetch-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
Vue.use(VueI18Next);
i18next
.use(Fetch)
.use(LanguageDetector)
.init({
fallbackLng: 'en',
whitelist: [
'en',
'fr'
],
keySeparator: '',
nsSeparator: 'Ŏ',
lowerCaseLng: true,
interpolation: {
defaultVariables: {
endtag: '</a>'
}
},
backend: {
loadPath: 'locales/{{lng}}.json'
}
})
const i18n = new VueI18Next(i18next);
Vue.config.productionTip = false
new Vue({
render: h => h(App),
i18n: i18n
}).$mount('#app')
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/salt/peertube/' : '/',
}
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config xmlns="http://zanata.org/namespace/config/">
<url>https://trad.framasoft.org/</url>
<project>salt</project>
<project-type>gettext</project-type>
<project-version>ttrss</project-version>
<src-dir>po</src-dir>
<trans-dir>po</trans-dir>
</config>
base:
'*':
- ttrss
# vim:set sw=2 ts=2 sts=2 ft=yaml expandtab:
ttrss:
my_server:
db_password: ''
apticron:
enabled: false
email: root
hostname: ttrss.example.com
threads: 1
admin:
email: admin@example.com
password: totototo
registration:
activated: false
accounts_number: 10
smtp:
from_name: Tiny Tiny RSS
from_address: noreply@example.com
digest_subject: '[tt-rss] New headlines for last 24 hours'
base:
'*':
- ttrss
#!/bin/bash
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
borg='/usr/bin/borg'
target='/var/www/ttrss_daily_backups/borg/'
src='/var/www/ttrss/'
exclude='-e /var/www/ttrss_daily_backups/borg/'
## Backup the database
## Dump of ttrss_prod database, suitable for pg_restore
pg_dump --format custom -f /var/www/ttrss_daily_backups/postgresql/ttrss_prod.$(date +%A).bak -d ttrss_prod
## Show me the backups
$borg list $target
## Backup Peertube
$borg create -v --stats $exclude $target::ttrss-{now:%Y-%m-%d_%H-%M} $src
## Check the backups
$borg check $target
## Prune old backups
$borg prune -v --list --save-space -w 4 -d 10 --prefix='ttrss' $target
#!/bin/bash
sleep 1
curl -s \
--output /dev/null \
--header 'Host: {{ settings.hostname }}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'op=installschema' \
--data 'DB_TYPE=pgsql' \
--data 'DB_USER=ttrss' \
--data 'DB_PASS={{ settings.db_password }}' \
--data 'DB_NAME=ttrss_prod' \
--data 'DB_HOST=localhost' \
--data 'DB_PORT=5432' \
--data 'SELF_URL_PATH=https://{{ settings.hostname }}' \
'https://localhost/install/' || exit 1
echo "Database initialized"
curl -s \
--output /dev/null \
--header 'Host: {{ settings.hostname }}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'op=saveconfig' \
--data 'DB_TYPE=pgsql' \
--data 'DB_USER=ttrss' \
--data 'DB_PASS={{ settings.db_password }}' \
--data 'DB_NAME=ttrss_prod' \
--data 'DB_HOST=localhost' \
--data 'DB_PORT=5432' \
--data 'SELF_URL_PATH=https://{{ settings.hostname }}' \
'https://localhost/install/' || exit 1
echo "Configuration saved"
sed -i /var/www/ttrss/config.php \
-e "s/ENABLE_REGISTRATION', .*/ENABLE_REGISTRATION', {{ settings.registration.activated }});/" \
-e "s/REG_NOTIFY_ADDRESS', '.*/REG_NOTIFY_ADDRESS', '{{ settings.admin.email }}');/" \
-e "s/REG_MAX_USERS', .*/REG_MAX_USERS', {{ settings.registration.accounts_number }});/" \
-e "s/SMTP_FROM_NAME', '.*/SMTP_FROM_NAME', '{{ settings.smtp.from_name }}');/" \
-e "s/SMTP_FROM_ADDRESS', '.*/SMTP_FROM_ADDRESS', '{{ settings.smtp.from_address }}');/" \
-e "s/DIGEST_SUBJECT', '.*/DIGEST_SUBJECT', '{{ settings.smtp.digest_subject }}');/" || exit 1
echo "Configuration modified"
curl -s \
--cookie-jar /tmp/curl-cookiejar \
--output /dev/null \
--header 'Host: {{ settings.hostname }}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'op=login' \
--data 'login=admin' \
--data 'password=password' \