def deploy(): """ Deploys remotely master branch changes to production server. Returns: None """ try: print() info_print( "This script will only succeed if you have configured the " "production server ssh port to match the one in " "config/production.py and have proper ssh access." ) warning_print( "This process will update the production server with the " "latest master branch changes." ) option = input("Do you want to continue? (y/n)\n") if option != "y" and option != "Y": sys.exit() t0 = time.time() remote_production_task("update_project") remote_production_task("install_python_requirements") remote_production_task("collect_static_files") remote_production_task("make_migrations") remote_production_task("migrate") remote_production_task("restart_server") t1 = time.time() show_time(t0, t1) except KeyboardInterrupt: error_print("Process aborted. Bye!") sys.exit()
def setup_development_machine(): """ Creates remotely a new ubuntu virtual machine ready to work on the project. Returns: None """ try: print() info_print("You need to have Vagrant installed in your host machine.") warning_print( "This process will clean all data on your previous virtual " "machine and build it again from scratch." ) option = input("Do you want to continue? (y/n)\n") if option != "y" and option != "Y": sys.exit() t0 = time.time() pretty_print("\nCleaning previous installation ...") os.chdir("vagrant") run("vagrant destroy --force") run("vagrant box update") run("vagrant up") os.chdir("../") remote_development_task("update_repositories") remote_development_task("create_app_group_and_user") remote_development_task("install_postgresql") remote_development_task("create_postgresql_user_and_db") remote_development_task("install_jpeg_libraries_for_pillow") remote_development_task("install_git") remote_development_task("download_project") remote_development_task("install_virtualenv") remote_development_task("create_virtualenv") remote_development_task("export_project_keys") remote_development_task("install_python_requirements") remote_development_task("make_migrations") remote_development_task("migrate") remote_development_task("install_npm_and_grunt") remote_development_task("install_npm_packages") remote_development_task("install_ruby_and_sass") remote_development_task("install_unity") remote_development_task("create_test_data") remote_development_task("install_pycharm") remote_development_task("configure_pycharm") os.chdir("vagrant") run("vagrant halt") os.chdir("../") local_development_task("show_last_tips") t1 = time.time() show_time(t0, t1) except KeyboardInterrupt: error_print("Process aborted. Bye!") sys.exit()
def setup_production_server(): """ Configures remotely the production server initial setup and deployment. Returns: None """ try: print() info_print( "This script will only succeed if you have configured the " "production server ssh port to match the one in " "config/production.py and have proper ssh access." ) info_print( "After this setup, you should configure the admin allowed IP " "in the nginx configuration file." ) warning_print( "This process will clean all data on the production server " "and build up everything again from scratch." ) option = input("Do you want to continue? (y/n)\n") if option != "y" and option != "Y": sys.exit() t0 = time.time() remote_production_task("clean_production_server") remote_production_task("update_repositories") remote_production_task("create_app_group_and_user") remote_production_task("install_postgresql") remote_production_task("create_postgresql_user_and_db") remote_production_task("install_jpeg_libraries_for_pillow") remote_production_task("install_git") remote_production_task("download_project") remote_production_task("install_virtualenv") remote_production_task("create_virtualenv") remote_production_task("export_project_keys") remote_production_task("install_python_requirements") remote_production_task("create_runtime_files_and_dirs") remote_production_task("collect_static_files") remote_production_task("make_migrations") remote_production_task("migrate") remote_production_task("install_supervisor") remote_production_task("configure_supervisor") remote_production_task("install_nginx") remote_production_task("configure_nginx") remote_production_task("restart_server") t1 = time.time() show_time(t0, t1) except KeyboardInterrupt: error_print("Process aborted. Bye!") sys.exit()