Дмитрий Козлюк 2 лет назад
Родитель e106ce6f6c
Сommit 01c3cc46a2

1
.gitignore поставляемый

@ -0,0 +1 @@
/gitea

@ -0,0 +1,5 @@
---
gitea_install_binary: 'n'
gitea_db_password: ''
gitea_dba_password: ''
gitea_conf__server__http_port: 3000

@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -eu
file="$1"
dir=`mktemp -d`
trap "rm -rf '$dir'" EXIT
# LibreOffice logs to stdout in some distributions.
libreoffice --headless --convert-to pdf "$file" --outdir "$dir" >/dev/null 2>&1
exec cat "$dir/$(basename $file .pptx).pdf"

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

После

Ширина:  |  Высота:  |  Размер: 180 KiB

@ -0,0 +1,23 @@
{{template "base/head" .}}
<div class="page-content home">
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<div>
<img class="logo" width="220" height="220" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}"/>
</div>
<div class="hero">
<h1 class="ui icon header title">
{{AppName}}
</h1>
<h2>
Открытые материалы кафедры
<span style="white-space: nowrap">Управления и интеллектуальных технологий</span>
</h2>
<h2>
<a href="http://uit.mpei.ru" style="color: #003d95">Сайт кафедры</a>
</h2>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}

@ -0,0 +1,24 @@
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer>
<family>PT Sans</family>
</prefer>
</alias>
<alias>
<family>serif</family>
<prefer>
<family>PT Serif</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>PT Mono</family>
</prefer>
</alias>
</fontconfig>

@ -0,0 +1,22 @@
# DO NOT EDIT: this file is generated by Ansible.
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
Wants=postgresql.service
After=postgresql.service
[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
RuntimeDirectory=gitea
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/var/lib/git GITEA_WORK_DIR=/var/lib/gitea
[Install]
WantedBy=multi-user.target

@ -0,0 +1,11 @@
galaxy_info:
author: Dmitry Kozlyuk <KozliukDA@mpei.ru>
description: Gitea
company: MPEI
license: BSD-3-Clause
min_ansible_version: 2.9
platforms:
- name: Ubuntu
versions:
- 19.10
- 22.04

@ -0,0 +1,157 @@
---
- name: install software
package:
name:
# Gitea operation
- git
# PostgreSQL
- postgresql
- python3-psycopg2
- name: ensure ru_RU.UTF-8 locale
locale_gen:
name: 'ru_RU.UTF-8'
- name: ensure Postgres user exists
become: true
become_user: 'postgres'
postgresql_user:
name: 'gitea'
password: '{{ gitea_db_password }}'
login_password: '{{ gitea_dba_password }}'
- name: ensure Postgres database exists
become: true
become_user: 'postgres'
postgresql_db:
name: 'gitea'
owner: 'gitea'
encoding: 'UTF-8'
lc_collate: 'ru_RU.UTF-8'
lc_ctype: 'ru_RU.UTF-8'
template: 'template0'
login_password: '{{ gitea_dba_password }}'
- name: setup git user
user:
name: 'git'
comment: 'Git Version Control'
home: '/var/lib/git'
shell: '/bin/bash'
password: '*' # disabled
system: true
- name: ensure git user home permissions
file:
path: '/var/lib/git'
owner: 'git'
group: 'git'
- name: install binary
copy:
src: 'gitea'
dest: '/usr/local/bin/gitea'
mode: 0755
when: gitea_install_binary == 'y'
register: gitea_binary
- name: ensure state directory structure
file:
path: '/var/lib/gitea/{{ item }}'
state: directory
mode: 0750
owner: 'git'
group: 'git'
with_items:
- ''
- 'custom'
- 'data'
- 'log'
- name: ensure configuration directory structure
file:
path: '/etc/gitea'
state: directory
owner: 'root'
group: 'git'
mode: 0750
- name: configure
template:
src: 'gitea.ini'
dest: '/etc/gitea/app.ini'
owner: 'root'
group: 'git'
mode: 0640
register: gitea_conf
- name: deploy custom files
become: true
become_user: 'git'
copy:
src: 'custom/'
dest: '/var/lib/gitea/custom/'
register: gitea_custom
- name: configure service
copy:
src: 'gitea.service'
dest: '/etc/systemd/system/gitea.service'
register: service_conf
- name: load service configuration
systemd:
daemon_reload: true
when: service_conf.changed
- name: apply service configuration
service:
name: 'gitea'
state: restarted
when: gitea_binary.changed or gitea_conf.changed or gitea_custom.changed or service_conf.changed
- name: ensure the service is started
service:
name: 'gitea'
state: started
- name: configure Nginx
blockinfile:
path: '{{ gitea_nginx_conf_path }}'
block: |
location /git/ {
proxy_pass http://localhost:{{ gitea_conf__server__http_port }}/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 32M;
}
insertbefore: 'location'
marker: '# {mark} ANSIBLE MANAGED BLOCK: Gitea'
register: nginx_conf
- name: apply Nginx configuration
service:
name: 'nginx'
state: reloaded
when: nginx_conf.changed
- become: true
become_user: git
block:
- name: 'list Gitea admin users'
command: 'gitea --config /etc/gitea/app.ini admin user list'
register: gitea_user
- name: 'configure Gitea {{ gitea_user_username }} user'
when: gitea_user_username not in gitea_user.stdout
command: >-
gitea --config /etc/gitea/app.ini admin user create
--username '{{ gitea_user_username }}'
--password '{{ gitea_user_password }}'
--email '{{ gitea_user_email }}'
--must-change-password
--admin

@ -0,0 +1,3 @@
---
- include_tasks: 'gitea.yml'
- include_tasks: 'pptx.yml'

@ -0,0 +1,39 @@
---
- name: install PPTX conversion script
copy:
src: 'convert-pptx.sh'
dest: '/usr/local/bin/convert-pptx'
mode: 0755
- name: install software
package:
name:
- libreoffice-impress-nogui
- name: install fonts
package:
name:
- fonts-noto-core # Math
- fonts-paratype # Cyrillic
register: fonts
- name: ensure font configuration directory
become: true
become_user: 'git'
file:
path: '/var/lib/git/.local/share/fonts'
state: directory
- name: configure fonts
become: true
become_user: 'git'
copy:
src: 'fontconfig.conf'
dest: '/var/lib/git/.local/share/fonts/local.conf'
register: fontconfig
- name: update font cache
when: fonts.changed or fontconfig.changed
become: true
become_user: 'git'
command: 'fc-cache'

@ -0,0 +1,55 @@
APP_NAME = Git УИТ
RUN_MODE = prod
[database]
DB_TYPE = postgres
HOST = localhost
NAME = gitea
USER = gitea
PASSWD = {{ gitea_db_password }}
SSL_MODE = disable
CHARSET = utf8
LOG_SQL = false
[server]
DOMAIN = {{ gitea_conf__server__domain }}
ROOT_URL = {{ gitea_conf__server__root_url }}
HTTP_PORT = {{ gitea_conf__server__http_port }}
LFS_START_SERVER = true
LFS_JWT_SECRET = {{ gitea_conf__server__lfs_jwt_secret }}
OFFLINE_MODE = true
[service]
DISABLE_REGISTRATION = true
DEFAULT_ALLOW_CREATE_ORGANIZATION = false
[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false
[session]
PROVIDER = db
[log]
MODE = console
LEVEL = info
[security]
INSTALL_LOCK = true
INTERNAL_TOKEN = {{ gitea_conf__security__internal_token }}
PASSWORD_HASH_ALGO = pbkdf2
SECRET_KEY = {{ gitea_conf__security__secret_key }}
[i18n]
LANGS = ru-RU,en-US
NAMES = Русский,English
[repository]
ROOT = /var/lib/gitea/data/gitea-repositories
[markup.pptx]
ENABLED = true
FILE_EXTENSIONS = .pptx
RENDER_COMMAND = /usr/local/bin/convert-pptx
IS_INPUT_FILE = true
RENDER_CONTENT_MODE = pdf
Загрузка…
Отмена
Сохранить