mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	 e2860ed36d
			
		
	
	e2860ed36d
	
	
	
		
			
			* Explicitly set the HOME environment for the migrations to fix issue with certificates * Defines the HOME globally when we're running as root for startup
		
			
				
	
	
		
			19 lines
		
	
	
		
			596 B
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			596 B
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
| #!/command/with-contenv /usr/bin/bash
 | |
| # shellcheck shell=bash
 | |
| declare -r log_prefix="[init-migrations]"
 | |
| 
 | |
| declare -r data_dir="${PAPERLESS_DATA_DIR:-/usr/src/paperless/data}"
 | |
| 
 | |
| echo "${log_prefix} Apply database migrations..."
 | |
| 
 | |
| cd "${PAPERLESS_SRC_DIR}"
 | |
| 
 | |
| # The whole migrate, with flock, needs to run as the right user
 | |
| if [[ -n "${USER_IS_NON_ROOT}" ]]; then
 | |
| 	exec s6-setlock -n "${data_dir}/migration_lock" python3 manage.py migrate --skip-checks --no-input
 | |
| else
 | |
| 	exec s6-setuidgid paperless \
 | |
| 		s6-setlock -n "${data_dir}/migration_lock" \
 | |
| 		python3 manage.py migrate --skip-checks --no-input
 | |
| fi
 |