Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9a9a900
Create YunohostAppGenerator.py
lapineige Oct 13, 2023
b3c218c
Initial release - v0.7.5
lapineige Oct 13, 2023
a9942ca
Apply black
alexAubin Oct 13, 2023
8ecf5c9
appgenerator: rename stuff to app generator consistently
alexAubin Oct 27, 2023
0676b30
appgenerator: typo in requirements.txt
alexAubin Oct 27, 2023
cffedb3
appgenerator: cleanup a bunch of stuff to try to focus on what matter…
alexAubin Oct 27, 2023
9fa59c7
Merge branch 'YunoHost:master' into master
lapineige Oct 29, 2023
5203270
python option needs python3-venv package
lapineige Oct 29, 2023
9c7ce3f
fix missing quotes and multi_instance handling
lapineige Oct 29, 2023
5a5863c
appgenerator: rework the main form structure to have something matchi…
alexAubin Oct 29, 2023
2f2af41
Update tools/app_generator/templates/change_url.j2
lapineige Oct 29, 2023
4225be4
Fix YunoHost typo
lapineige Oct 29, 2023
5cce210
Fix YunoHost typo
lapineige Oct 29, 2023
9b7d00d
Fix YunoHost typo
lapineige Oct 29, 2023
ff13da7
Fix YunoHost typo
lapineige Oct 29, 2023
81ce95d
Fix YunoHost typo
lapineige Oct 29, 2023
6082bc0
Fix YunoHost typo
lapineige Oct 29, 2023
6c269a5
appgenerator: simplify/rework the HTML/form structure using Flask-Boo…
alexAubin Nov 8, 2023
561d874
appgenerator: more refactoring of the way we handled the specific tec…
alexAubin Nov 9, 2023
3b6a297
appgenerator: forgot to add Flask-Bootstrap in requirements.txt earli…
alexAubin Nov 9, 2023
2684281
appgenerator: propagate changes to template files + rework preview/zi…
alexAubin Nov 9, 2023
d8d0de3
v0.8.1
lapineige Feb 25, 2024
5206f8c
v0.8.1
lapineige Feb 25, 2024
d9aba37
v0.8.1
lapineige Feb 25, 2024
28463ad
Merge pull request #1 from lapineige/yologen_v0.8.1
lapineige Feb 25, 2024
ce774d5
add manifest scheme
lapineige Feb 25, 2024
b2401f9
v0.8.2
lapineige Feb 25, 2024
ab182ed
v0.8.2
lapineige Feb 25, 2024
8852701
v0.8.4 : fix docs files + default config file value
lapineige Mar 6, 2024
fc149d5
v0.8.5
lapineige Mar 6, 2024
2de77db
v0.8.5 : add log file + various stuff
lapineige Mar 6, 2024
c145aa2
add auto_update options
lapineige Mar 9, 2024
d43af40
add autoupdate options
lapineige Mar 9, 2024
d5115b7
v0.9.1 - add translations
lapineige Mar 31, 2024
2a9dbcb
add flask_babel
lapineige Mar 31, 2024
4dec4be
v0.9.1 - add translations
lapineige Mar 31, 2024
18fddeb
v0.9.1 - add translations (babel)
lapineige Mar 31, 2024
86a5b06
fix naming
lapineige Mar 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
719 changes: 719 additions & 0 deletions tools/app_generator/app_generator.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tools/app_generator/babel.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[python: *.py]
[jinja2: templates/**.html]
18 changes: 18 additions & 0 deletions tools/app_generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
blinker==1.6.3
cffi==1.16.0
click==8.1.7
dominate==2.8.0
Flask==3.0.0
flask_babel~=4.0.0
Flask-Bootstrap==3.3.7.1
Flask-Cors==4.0.0
Flask-Misaka==1.0.0
Flask-WTF==1.2.1
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
misaka==2.1.1
pycparser==2.21
visitor==0.1.3
Werkzeug==3.0.0
WTForms==3.0.1
45 changes: 45 additions & 0 deletions tools/app_generator/static/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.form-horizontal .form-group {
margin-left: 0;
margin-right: 0;
}

h2 {
font-weight: bold;
font-size: 1.3em !important;
}

.checkbox {
margin-bottom: 15px !important;
}

.checkbox label {
font-weight: bold;
}



.active, .collapse-button:hover {
background-color: #318ddc;
}

.collapse-title:after {
content: '\002B';
color: white;
font-weight: bold;
float: right;
margin-left: 5px;
}

.expanded .collapse-title::after {
content: "\2212";
}

.collapsed {
padding: 0px 15px 0px 15px;
}

.collapsible {
max-height: 0px;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
3 changes: 3 additions & 0 deletions tools/app_generator/templates/ADMIN.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This is a dummy admin doc for this app

The app install dir is `__INSTALL_DIR__`
1 change: 1 addition & 0 deletions tools/app_generator/templates/DESCRIPTION.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a dummy description of this app features
1 change: 1 addition & 0 deletions tools/app_generator/templates/DISCLAIMER.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a dummy disclaimer that will be added to the README.MD of your app.
7 changes: 7 additions & 0 deletions tools/app_generator/templates/POST_INSTALL.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This is a dummy disclaimer to display after the install

The app url is <https://__DOMAIN____PATH__>

The app install dir is `__INSTALL_DIR__`

The app id is `__ID__`
1 change: 1 addition & 0 deletions tools/app_generator/templates/POST_UPGRADE.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a dummy disclaimer to display after upgrades
1 change: 1 addition & 0 deletions tools/app_generator/templates/PRE_INSTALL.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a dummy disclaimer to display prior to the install
1 change: 1 addition & 0 deletions tools/app_generator/templates/PRE_UPGRADE.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a dummy disclaimer to display prior to any upgrade
14 changes: 14 additions & 0 deletions tools/app_generator/templates/_common.sh.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

#=================================================
# COMMON VARIABLES
#=================================================

{% if data.use_nodejs -%}
nodejs_version={{ data.nodejs_version }}
{% endif -%}

#=================================================
# PERSONAL HELPERS
#=================================================

105 changes: 105 additions & 0 deletions tools/app_generator/templates/backup.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/bin/bash
#### App file generated with YoloGen, the YunoHost app generator, version {{ data['GENERATOR_VERSION'] }}.

{% if data.generator_mode == 'tutorial' -%} # This is the tutorial version of the app.
# It contains extra commands to explain what should be done in case you want to adjust some part of the script.
# Once you are done, you may remove them.
{% endif %}
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================

# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers

#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."

{% if data.generator_mode == 'tutorial' -%}
### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
### to be backuped and not an actual copy of any file. The actual backup that
### creates and fill the archive with the files happens in the core after this
### script is called. Hence ynh_backups calls takes basically 0 seconds to run.
{% endif %}

{% if data.data_dir -%}
#=================================================
# BACKUP THE DATA DIR
#=================================================
{% if data.generator_mode == 'tutorial' -%}
### Only relevant if there is a "data_dir" resource for this app
# The --is_big parameters ensure this folder is not included in the backup by default (taking less space), except if BACKUP_CORE_ONLY=0 is passed before the backup command. You might want to document that for your users.
# TODO : there should be an option for this
{% endif %}
ynh_backup --src_path="$data_dir" # --is_big
{% endif %}

#=================================================
# SYSTEM CONFIGURATION
#=================================================

# Backup the nginx configuration
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"

{% if data.main_technology == "php" -%}
# Backup the PHP-FPM configuration
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
{% endif %}

{% if data.use_fail2ban -%}
# Backup the Fail2Ban config
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
{% endif %}

{% if data.use_logrotate -%}
# Backup the logrotate configuration
ynh_backup --src_path="/etc/logrotate.d/$app"
{% endif %}

{% if data.main_technology not in ["php", "none"] -%}
# Backup the systemd service unit
ynh_backup --src_path="/etc/systemd/system/$app.service"
{% endif %}

#=================================================
# BACKUP VARIOUS FILES
#=================================================

{% if data.use_cron -%}
# Backup the cron configuration
ynh_backup --src_path="/etc/cron.d/$app"
{% endif %}

{% if data.generator_mode == 'tutorial' -%}
### For apps with huge logs, you might want to pass --is_big,
### and in restore script, mkdir and pass --not_mandatory to ynh_restore_file.
{% endif %}
ynh_backup --src_path="/var/log/$app/" # TODO : add an option to specify log file

{% if data.database != 'false' -%}
#=================================================
# BACKUP THE DATABASE
#=================================================
ynh_print_info --message="Backing up the {{ data.database }} database..."

### (However, things like MySQL dumps *do* take some time to run, though the
### copy of the generated dump to the archive still happens later)

{% if data.use_db == 'mysql' -%}
ynh_mysql_dump_db --database="$db_name" > db.sql
{% elif data.use_db == 'postgresql' -%}
ynh_psql_dump_db --database="$db_name" > db.sql
{% endif %}
{% endif %}

#=================================================
# END OF SCRIPT
#=================================================

ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
54 changes: 54 additions & 0 deletions tools/app_generator/templates/change_url.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
### App file generated with YoloGen, the Yunohost app generator, version {{ data['GENERATOR_VERSION'] }}.

{% if data.generator_mode == 'tutorial' -%}
# This is the tutorial version of the app.
# It contains extra commands to explain what should be done in case you want to adjust some part of the script.
# Once you are done, you may remove them.
{% endif %}

#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================

source _common.sh
source /usr/share/yunohost/helpers

{% if data.main_technology not in ["php", "none"] -%}
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."

ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
{% endif %}

#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..."

ynh_change_url_nginx_config

#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================

{% if data.main_technology not in ["php", "none"] -%}
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."

ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
{% endif %}

#=================================================
# END OF SCRIPT
#=================================================

ynh_script_progression --message="Change of URL completed for $app" --last
Loading