diff --git a/.gitignore b/.gitignore index 97038d851..25773c730 100644 --- a/.gitignore +++ b/.gitignore @@ -163,4 +163,3 @@ logs/ .idea/ -wall_e/wall_e_models diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..410c152de --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "wall_e_models"] + path = .wall_e_models + url = https://github.com/CSSS/wall_e_models.git diff --git a/.run_walle.py b/.run_walle.py index 3ec2de227..5c76d49b3 100755 --- a/.run_walle.py +++ b/.run_walle.py @@ -46,10 +46,6 @@ def create_argument_parser(): choices=[DatabaseType.sqlite3.value, DatabaseType.postgreSQL.value], help="indicates whether you want to use sqlite3 or postgres for the database type." ) - parser_obj.add_argument( - "--wall_e_models_location", action='store', default=None, - help="used to specify the absolute path to the wall_e_models", metavar="/path/to/wall_e_model/repo" - ) parser_obj.add_argument( "--launch_wall_e", action='store', default=None, choices=['true', 'false'], help="script will run wall_e." ) @@ -84,7 +80,6 @@ def pull_variable_from_command_line_arguments(argparser): :return: ( the dockerized_wall_e command-line flag the database type command-line flag - the wall_e_models location the launch_wall_e command-line flag the install_requirements command-line flag the setup_database command-line flag @@ -97,7 +92,7 @@ def pull_variable_from_command_line_arguments(argparser): database_type = DatabaseType.postgreSQL.value return ( convert_command_line_argument_to_menu_format(argparser.dockerized_wall_e), database_type, - argparser.wall_e_models_location, convert_command_line_argument_to_menu_format(argparser.launch_wall_e), + convert_command_line_argument_to_menu_format(argparser.launch_wall_e), convert_command_line_argument_to_menu_format(argparser.install_requirements), convert_command_line_argument_to_menu_format(argparser.setup_database) @@ -280,7 +275,7 @@ def take_user_input_for_string_variable(message, description=None, default_value ( basic_config__DOCKERIZED_CMD_LINE_ARGUMENT, database_config__TYPE_CMD_LINE_ARGUMENT, - WALL_E_MODEL_PATH_CMD_LINE_ARGUMENT, LAUNCH_WALL_E_CMD_LINE_ARGUMENT, INSTALL_REQUIREMENTS_CMD_LINE_ARGUMENT, + LAUNCH_WALL_E_CMD_LINE_ARGUMENT, INSTALL_REQUIREMENTS_CMD_LINE_ARGUMENT, SETUP_DATABASE_CMD_LINE_ARGUMENT ) = pull_variable_from_command_line_arguments(args) @@ -329,16 +324,6 @@ def take_user_input_for_string_variable(message, description=None, default_value print("Feel free to add that feature in or revert to using db.sqlite3") exit(1) -WALL_E_MODEL_PATH = WALL_E_MODEL_PATH_CMD_LINE_ARGUMENT -while WALL_E_MODEL_PATH is None or not os.path.exists(WALL_E_MODEL_PATH): - WALL_E_MODEL_PATH = get_string_variables( - "Please specify the relative/absolute path for the wall_e_model in the form /path/to/wall_e_model/repo", - "WALL_E_MODEL_PATH", - command_line_argument=WALL_E_MODEL_PATH, overwrite_env=overwrite_env_file, - default_value=WALL_E_MODEL_PATH - ) - if WALL_E_MODEL_PATH is not None and not os.path.exists(WALL_E_MODEL_PATH): - print(f"path {WALL_E_MODEL_PATH} does not exist") LAUNCH_WALL_E = get_boolean_variable( "Do you you want this script to launch wall_e? [the alternative is to use PyCharm]", "LAUNCH_WALL_E", command_line_argument=LAUNCH_WALL_E_CMD_LINE_ARGUMENT, overwrite_env=overwrite_env_file @@ -396,7 +381,7 @@ def take_user_input_for_string_variable(message, description=None, default_value essential_variables_are_null = check_for_null_variables( basic_config__TOKEN=basic_config__TOKEN, basic_config__GUILD_ID=basic_config__GUILD_ID, - basic_config__DOCKERIZED=basic_config__DOCKERIZED, WALL_E_MODEL_PATH=WALL_E_MODEL_PATH + basic_config__DOCKERIZED=basic_config__DOCKERIZED ) if essential_variables_are_null[0]: raise Exception(f"necessary variable {essential_variables_are_null[1]} is None") @@ -447,7 +432,6 @@ def take_user_input_for_string_variable(message, description=None, default_value with open(RUN_ENV_FILE_LOCATION, "w") as f: f.seek(0) f.write(f"""LAUNCH_WALL_E='{LAUNCH_WALL_E}' -WALL_E_MODEL_PATH='{WALL_E_MODEL_PATH}' POSTGRES_PASSWORD='postgres_passwd' ORIGIN_IMAGE='sfucsssorg/wall_e' HELP_SELECTED='0' diff --git a/.wall_e_models b/.wall_e_models new file mode 160000 index 000000000..ff65269f6 --- /dev/null +++ b/.wall_e_models @@ -0,0 +1 @@ +Subproject commit ff65269f66f03e744d3c6644bfa6ccd639ee903f diff --git a/CI/validate_and_deploy/2_deploy/server_scripts/Dockerfile.wall_e b/CI/validate_and_deploy/2_deploy/server_scripts/Dockerfile.wall_e index 7b7137c3c..eae3e64e6 100755 --- a/CI/validate_and_deploy/2_deploy/server_scripts/Dockerfile.wall_e +++ b/CI/validate_and_deploy/2_deploy/server_scripts/Dockerfile.wall_e @@ -8,8 +8,6 @@ COPY CI/validate_and_deploy/2_deploy/create-database.ddl . COPY CI/validate_and_deploy/2_deploy/server_scripts/wait-for-postgres.sh . -COPY CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt . - RUN apk add --no-cache tzdata # https://github.com/docker-library/postgres/issues/220 CMD ["./wait-for-postgres.sh", "db", "python", "./main.py" ] diff --git a/CI/validate_and_deploy/2_deploy/server_scripts/wait-for-postgres.sh b/CI/validate_and_deploy/2_deploy/server_scripts/wait-for-postgres.sh index 94de727d0..7998a8620 100755 --- a/CI/validate_and_deploy/2_deploy/server_scripts/wait-for-postgres.sh +++ b/CI/validate_and_deploy/2_deploy/server_scripts/wait-for-postgres.sh @@ -26,7 +26,6 @@ if [[ "${basic_config__ENVIRONMENT}" == "TEST" ]]; then --set=WALL_E_DB_PASSWORD="${database_config__WALL_E_DB_PASSWORD}" \ --set=WALL_E_DB_DBNAME="${database_config__WALL_E_DB_DBNAME}" \ -h "$host" -U "postgres" -f "${HOME_DIR}"/create-database.ddl - python3 -m pip install -r ../CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt python3 django_manage.py migrate wget https://dev.sfucsss.org/wall_e/fixtures/banrecords.json wget https://dev.sfucsss.org/wall_e/fixtures/commandstats.json @@ -45,7 +44,6 @@ if [[ "${basic_config__ENVIRONMENT}" == "TEST" ]]; then rm -r /wall_e || true fi -python3 -m pip install -r wall_e_models_requirement.txt python3 django_manage.py migrate exec $cmd diff --git a/CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt b/CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt deleted file mode 100644 index 64970f4d3..000000000 --- a/CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt +++ /dev/null @@ -1 +0,0 @@ -wall-e-models==0.57 \ No newline at end of file diff --git a/run_walle.sh b/run_walle.sh index 8787745ec..daa01aec2 100755 --- a/run_walle.sh +++ b/run_walle.sh @@ -10,8 +10,10 @@ fi # need to delete and re-create so that the if statement that tries to detected if the # help menu was invoked can work correctly -cat ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env | grep -v HELP_SELECTED > ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2 -mv ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2 ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env +if [ -f "CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env" ]; then + cat ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env | grep -v HELP_SELECTED > ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2 + mv ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env.2 ./CI/validate_and_deploy/2_deploy/user_scripts/run_wall_e.env +fi ./.run_walle.py $@ @@ -42,11 +44,7 @@ else python3 -m pip install -r layer-2-requirements.txt rm layer-1-requirements.txt layer-2-requirements.txt python3 -m pip install -r requirements.txt - python3 -m pip install -r ../CI/validate_and_deploy/2_deploy/server_scripts/wall_e_models_requirement.txt - python3 -m pip uninstall -y wall_e_models - fi - if [ ! -f 'wall_e_models' ]; then - ln -sn "${WALL_E_MODEL_PATH}/wall_e_models" wall_e_models || true + python3 -m pip install -r ../.wall_e_models/requirements.txt fi if [[ "${SETUP_DATABASE}" == "True" ]]; then diff --git a/wall_e/wall_e_models b/wall_e/wall_e_models new file mode 120000 index 000000000..ddea771ca --- /dev/null +++ b/wall_e/wall_e_models @@ -0,0 +1 @@ +../.wall_e_models/wall_e_models \ No newline at end of file