mirror of
				https://framagit.org/YunoHost-Apps/gitea_ynh.git
				synced 2025-10-31 05:45:30 +01:00 
			
		
		
		
	 60cb5e5ae4
			
		
	
	60cb5e5ae4
	
	
	
		
			
			* Move app install dir from /opt to /var/www * Revamp the way binaries are downloaded thanks to manifestv2 (no need to check for arch, etc) * Remove custom helpers (exec_as, ynh_handle_app_migration) * Rename LFS_KEY as LFS_JWT_SECRET and KEY as SECRET_KEY as named in app.ini * Add JWT_SECRET for oauth and INTERNAL_TOKEN in app.ini * update upstream sample app.ini URL * Disable actions for now. * Automatically add ssh permissions to the system user * Remove support for upgrade before 1.6.4. Edit test_upgrade_from accordingly.
		
			
				
	
	
		
			83 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| #=================================================
 | |
| # GENERIC START
 | |
| #=================================================
 | |
| # IMPORT GENERIC HELPERS
 | |
| #=================================================
 | |
| 
 | |
| source _common.sh
 | |
| source /usr/share/yunohost/helpers
 | |
| 
 | |
| #=================================================
 | |
| # APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
 | |
| #=================================================
 | |
| # DOWNLOAD, CHECK AND UNPACK SOURCE
 | |
| #=================================================
 | |
| ynh_script_progression --message="Installing sources files and data directories..." --weight=10
 | |
| 
 | |
| 
 | |
| ynh_setup_source --dest_dir="$install_dir"
 | |
| chmod +x "$install_dir/gitea"
 | |
| 
 | |
| # create needed directories
 | |
| _gitea_mkdirs
 | |
| 
 | |
| ynh_script_progression --message="Configuring application, step 1/2..."
 | |
| 
 | |
| _gitea_set_secrets
 | |
| _gitea_add_config
 | |
| _gitea_permissions_install_dir
 | |
| 
 | |
| #=================================================
 | |
| # SYSTEM CONFIGURATION
 | |
| #=================================================
 | |
| ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
 | |
| 
 | |
| # Create a dedicated NGINX config using the conf/nginx.conf template
 | |
| ynh_add_nginx_config
 | |
| 
 | |
| # Create a dedicated systemd config
 | |
| ynh_add_systemd_config
 | |
| 
 | |
| # Add gitea to YunoHost's monitored services
 | |
| yunohost service add "$app" --log="/var/log/$app/gitea.log"
 | |
| 
 | |
| # Configure logrotate
 | |
| ynh_use_logrotate --logfile "/var/log/$app"
 | |
| 
 | |
| # Create a dedicated Fail2Ban config
 | |
| ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
 | |
| 
 | |
| #=================================================
 | |
| # APP INITIAL CONFIGURATION
 | |
| #=================================================
 | |
| # ADD A CONFIGURATION
 | |
| #=================================================
 | |
| 
 | |
| ynh_script_progression --message="Configuring application, step 2/2..."
 | |
| 
 | |
| # Start gitea for building mysql tables
 | |
| ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:"
 | |
| 
 | |
| # Add ldap config
 | |
| ynh_replace_string --match_string "__APP__" --replace_string "$app" --target_file ../conf/login_source.sql
 | |
| ynh_mysql_connect_as "$db_user" "$db_pwd" "$db_name" < ../conf/login_source.sql
 | |
| 
 | |
| # Stop the service to restart it just afterwards
 | |
| ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/gitea.log"
 | |
| 
 | |
| #=================================================
 | |
| # GENERIC FINALIZATION
 | |
| #=================================================
 | |
| # START SYSTEMD SERVICE
 | |
| #=================================================
 | |
| ynh_script_progression --message="Starting gitea services..." --weight=3
 | |
| 
 | |
| ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/gitea.log" --line_match="Starting new Web server: tcp:127.0.0.1:"
 | |
| 
 | |
| #=================================================
 | |
| # END OF SCRIPT
 | |
| #=================================================
 | |
| ynh_script_progression --message="Installation of $app completed" --last
 |