Translation status page and start using docker-compose (#300)

lektura
Max Mehl 2018-10-09 14:44:39 +02:00 committed by Gogs
parent ad8f3b8e3a
commit 586b8bd178
9 changed files with 96 additions and 40 deletions

View File

@ -1,21 +1,32 @@
pipeline:
quality:
image: williamyeh/ansible:debian8
commands:
- ansible-playbook -vvv playbook.yml -i hosts --syntax-check
syntaxcheck:
image: publysher/hugo
commands:
- cd site; ./build/build.sh syntax
deploy:
image: williamyeh/ansible:debian8
secrets: [ ssh_key ]
image: docker:dind
commands:
- mkdir /root/.ssh && echo "$SSH_KEY" > /root/.ssh/id_rsa && chmod 0600 /root/.ssh/id_rsa
- ssh-keyscan -H lund.fsfeurope.org >> ~/.ssh/known_hosts
- ansible-playbook playbook.yml -i hosts
# Get docker-compose
- wget -q -O /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)
# Make it executable
- chmod 700 /usr/local/bin/docker-compose
# Download and install glibc (Alpine comes with musl libc) because docker-compose relies on it
- wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-2.27-r0.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.27-r0/glibc-bin-2.27-r0.apk
- wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
- apk add -q --update glibc-2.27-r0.apk glibc-bin-2.27-r0.apk
- apk add -q git
# Clone the git remository
# Make the signatures file available to the PMPC website
# Build the docker container
# Clean things up
- git clone https://git.fsfe.org/pmpc/website.git /tmp/pmpc-build && cd /tmp/pmpc-build/ && cp /tmp/signatures/signatures.json site/data/signatures/signatures.json && docker build -t pmpc .
# Run docker compose
- docker-compose up -d
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /srv/forms/pmpc:/tmp/signatures:ro
when:
event: [push, tag, deployment]
branch: master

View File

@ -1,6 +1,6 @@
FROM php:7.0-apache
ENV HUGO_VERSION 0.26
ENV HUGO_VERSION 0.48
ENV HUGO_BINARY hugo_${HUGO_VERSION}_Linux-64bit.deb
RUN apt-get update && apt-get upgrade -y && \
@ -16,11 +16,19 @@ RUN composer require phpmailer/phpmailer
RUN a2enmod rewrite
ADD https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY} /tmp/hugo.deb
RUN dpkg -i /tmp/hugo.deb \
&& rm /tmp/hugo.deb
RUN dpkg -i /tmp/hugo.deb && \
rm /tmp/hugo.deb
COPY site/ /usr/share/blog
RUN mkdir -p /usr/share/blog
COPY . /tmp/pmpc-build/
WORKDIR /tmp/pmpc-build/site/
RUN build/build.sh && \
cp -r public/ /usr/share/blog/public/ && \
cd / && rm -rf /tmp/pmpc-build
COPY 000-default.conf /etc/apache2/sites-enabled/
CMD /usr/share/blog/build/build.sh && apache2-foreground
CMD apache2-foreground

18
docker-compose.yml 100644
View File

@ -0,0 +1,18 @@
version: '3'
services:
pmpc:
image: pmpc
container_name: pmpc
restart: always
environment:
- HUGO_BASE_URL=https://publiccode.eu/
- VIRTUAL_HOST=publiccode.eu,www.publiccode.eu
- LETSENCRYPT_HOST=publiccode.eu,www.publiccode.eu
- LETSENCRYPT_EMAIL=contact@fsfe.org
logging:
driver: json-file
options:
max-size: "5m"
max-file: "5"
volumes:
- /srv/pmpc-cred:/srv/cred:ro

View File

@ -1,24 +0,0 @@
---
- hosts: lund.fsfeurope.org
remote_user: root
tasks:
- name: build the pmpc container
command: docker build -t pmpc https://git.fsfe.org/pmpc/website.git
- name: run pmpc
docker_container:
name: pmpc
image: pmpc
state: started
restart: yes
restart_policy: always
env:
HUGO_BASE_URL: https://publiccode.eu/
VIRTUAL_HOST: publiccode.eu,www.publiccode.eu
LETSENCRYPT_HOST: publiccode.eu,www.publiccode.eu
LETSENCRYPT_EMAIL: jonas@fsfe.org
volumes:
- "/srv/forms/pmpc:/usr/share/blog/data/signatures:ro"
- "/srv/pmpc-cred:/srv/cred:ro"

View File

@ -2,6 +2,7 @@ baseurl = "https://publiccode.eu"
title = "Public Money, Public Code"
theme = "hugo-creative-theme"
DefaultContentLanguage = "en"
enableGitInfo = true
# Static strings shared by all languages these are not to be translated!
[params.static]

View File

@ -0,0 +1,7 @@
---
title: "Translation Status"
type: "page"
layout: "subpage"
---
{{< translation_status >}}

View File

@ -131,6 +131,8 @@ other= "Transparency"
other= "The code of this website is Free Software."
[legal_contribute2]
other= "You're welcome to contribute!"
[translation_status]
other="Translation status page"
[legal_license]
other= "This work is licensed under a [Creative Commons BY-SA 4.0 Licence](http://creativecommons.org/licenses/by-sa/4.0/)."

View File

@ -2,7 +2,8 @@
<section id="legal">
<div class="text-center">
<h2 class="hidden">Legal Information</h2>
<p>{{ i18n "legal_contribute1" }} <a href="https://git.fsfe.org/pmpc/website" target="_blank">{{ i18n "legal_contribute2" }}</a></p>
<p>{{ i18n "legal_contribute1" }} <a href="https://git.fsfe.org/pmpc/website" target="_blank">{{ i18n "legal_contribute2" }}</a>
| <a href="/translation_status"> {{ i18n "translation_status" }}</a></p>
<p>{{ i18n "legal_by" }} (<a href="https://fsfe.org/index.{{ .Lang }}.html" target="_blank">FSFE</a>)
<a href="https://fsfe.org/about/legal/imprint.{{ .Lang }}.html" target="_blank">{{ i18n "legal_imprint" }}</a>
| <a href="{{ "privacy/" | relLangURL }}">{{ i18n "legal_privacy" }}</a>

View File

@ -0,0 +1,32 @@
{{ $up_to_date := true }}
{{ range .Site.Pages }}
{{ $maindate := .Lastmod }}
{{ range .Translations }}
{{ if and (.IsTranslated) (.IsPage) }}
{{ $i18n_date := .Lastmod }}
{{ if ($maindate.After $i18n_date) }}
{{ $up_to_date := false }}
{{ end }}
{{ end }}
{{ end }}
{{ end}}
{{ if eq $up_to_date false }}
{{ range .Site.Pages }}
<ul>
{{ $maindate := .Lastmod }}
{{ range .Translations }}
{{ if and (.IsTranslated) (.IsPage) }}
{{ $i18n_date := .Lastmod }}
{{ if ($maindate.After $i18n_date) }}
<li>
{{ .Lang }} | <a href="{{ .Permalink }}">{{ .RelPermalink }}</a> | {{ $i18n_date }} is older than {{ $maindate }}
</li>
{{ end }}
{{ end }}
{{ end }}
</ul>
{{ end}}
{{ else }}
<p style="text-align:center;">Everything is up to date! &#128077;</p>
{{ end}}