def setup_database(install_dir_path): print('******************************************************************') print(' SETTING UP DATABASE') print('******************************************************************') print('NB: Commands may create spurious stderr output if postgres user cannot read install dir') # Read DB configuration from server/app/config/database.js (user, pw, name, schema) = read_db_configuration(install_dir_path) if general.prompt_for_confirm('Drop existing DB schema and user?', None): db_clear_commands = CONST_DB_CLEAR_COMMANDS \ .replace('{db.user}', user) \ .replace('{db.name}', name) \ .strip() \ .split('\n') execute_shell_commands(db_clear_commands) # Generate and write DB creation shell script db_setup_commands = CONST_DB_SETUP_COMMANDS_TEMPLATE \ .replace('{db.user}', user) \ .replace('{db.pw}', pw) \ .replace('{db.name}', name) \ .replace('{db.schema}', schema) \ .strip() \ .split('\n') # Execute the DB setup commands execute_shell_commands(db_setup_commands) print('******************************************************************') print('') print('') print('')
update_symlink( symlink_path=app_symlink_path, target_path=install_dir_path ) if __name__ == '__main__': print('NB: The upgraded application install directory is probably the parent of this scripts directory') install_dir_path = raw_input('Enter the upgraded application install directory path: ').strip() app_symlink_path = raw_input('Enter the application symlink path: ').strip() print('\nYou have entered:') print('- upgraded application install directory path: ' + install_dir_path) print('- application symlink path: ' + app_symlink_path) if general.prompt_for_confirm('Is this correct?'): print('') upgrade_app( install_dir_path=install_dir_path, app_symlink_path=app_symlink_path ) print('') print('') print('') print('******************************************************************') print('******************************************************************') print('******************************************************************') print(' UPGRADE COMPLETE') print('******************************************************************') print('******************************************************************') print('******************************************************************')
install_dir_path=install_dir_path ) # (5) create_app_symlink( install_dir_path=install_dir_path, app_symlink_path=app_symlink_path ) if __name__ == '__main__': print('NB: Usually the application install directory is the parent of directory of this script') (install_dir_path, app_symlink_path) = prompt_for_install_directories() while not general.prompt_for_confirm('Is this correct?', False): (install_dir_path, app_symlink_path) = prompt_for_install_directories() print('\nYou have entered:') print('- application install directory path: ' + install_dir_path) print('- application symlink path: ' + app_symlink_path) if general.prompt_for_confirm('Is this correct?', None): print('') install_app( install_dir_path=install_dir_path, app_symlink_path=app_symlink_path ) print('') print('') print('') print('******************************************************************')