diff --git a/docker/.env-sample b/docker/.env-sample index 47018de..a9f8c5b 100644 --- a/docker/.env-sample +++ b/docker/.env-sample @@ -19,4 +19,4 @@ MYSQL_PYROS_LOGIN=pyros # define password for superadmin user MYSQL_PYROS_PWD=DjangoPyros # Define the local port where you will access the website. When using Docker, we will bind the same port within the docker network and your local port. -PYROS_WEBSITE_PORT=8080 \ No newline at end of file +PYROS_WEBSITE_PORT=8000 \ No newline at end of file diff --git a/docker/PYROS_DOCKER_SHELL b/docker/PYROS_DOCKER_SHELL index 25c8487..f0e311a 100755 --- a/docker/PYROS_DOCKER_SHELL +++ b/docker/PYROS_DOCKER_SHELL @@ -6,4 +6,4 @@ then echo "db_pyros or pyros weren't running, starting them..." ./PYROS_DOCKER_START.bat fi -docker exec -it pyros bash \ No newline at end of file +docker exec -it pyros bash $@ \ No newline at end of file diff --git a/docker/PYROS_DOCKER_TEST b/docker/PYROS_DOCKER_TEST index 5ab494e..8ee910d 100755 --- a/docker/PYROS_DOCKER_TEST +++ b/docker/PYROS_DOCKER_TEST @@ -6,5 +6,5 @@ then echo "db_pyros or pyros weren't running, starting them..." ./PYROS_DOCKER_START.bat fi -docker exec -it pyros python3 pyros.py test +docker exec -it pyros python3 pyros.py test $@ diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c8d6ddb..900266a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -46,7 +46,7 @@ services: - ..:/home/pyros_user/app # tells which port of local machine can communicate with the docker image (host:container), host is your local machine ports: - - "8000:8000" + - "${PYROS_WEBSITE_PORT:-8000}:${PYROS_WEBSITE_PORT:-8000}" # starting db service before install service depends_on: - db diff --git a/pyros.py b/pyros.py index 720f603..15500f4 100755 --- a/pyros.py +++ b/pyros.py @@ -321,11 +321,17 @@ def set_environment_variables_if_not_configured(env_path: str,env_sample_path: s line = line.rstrip() key,value = line.split("=") # setting variables as environment variables - if WITH_DOCKER and os.environ[key] != value: + if not WITH_DOCKER and os.environ.get(key) is None: + print(f"ERROR: Error while reading value for '{key}'.Please fix the '{env_file}' file. For this run, PyROS will take the values from '{env_path}'") + raise BaseException() + if WITH_DOCKER and os.environ.get(key) is None: + print(f"WARNING: Environment value for '{key}' isn't defined within the container (To remove this message : restart docker container to update environment values). PyROS will take the values from '{env_path}'") + raise BaseException() + if WITH_DOCKER and os.environ.get(key) != value: print(f"WARNING: Environment value for '{key}' needs to be uptaded (To remove this message : restart docker container to update them). PyROS will take the value from '{env_path}'") os.environ[key] = value except: - print(f".env not found at {env_path} or is empty, creating a file at this path from the .env-sample file stored at {ENV_SAMPLE_PATH}\nvalues from .env-sample will be used as environment variables") + #print(f".env not found at {env_path} or is empty, creating a file at this path from the .env-sample file stored at {ENV_SAMPLE_PATH}\nvalues from .env-sample will be used as environment variables") with open(env_sample_path,'r') as env_sample_file: with open(env_path,"w") as env_file: for env_sample_line in env_sample_file: @@ -517,7 +523,9 @@ def test(app): #start_dir = os.getcwd() if app == None: - apps = ['obsconfig','scientific_program','common', 'scheduler', 'routine_manager', 'user_manager', 'alert_manager.tests.TestStrategyChange'] + #apps = ['obsconfig','scientific_program','common', 'scheduler', 'routine_manager', 'user_manager', 'alert_manager.tests.TestStrategyChange'] + # Removing temporiraly scientific_program and alert_manager from tests + apps = ['obsconfig','common', 'scheduler', 'routine_manager', 'user_manager'] else: os.environ["PATH_TO_OBSCONF_FILE"] = os.path.join(os.path.abspath(PYROS_DJANGO_BASE_DIR),"obsconfig/fixtures/observatory_configuration_ok_simple.yml") change_dir(PYROS_DJANGO_BASE_DIR) -- libgit2 0.21.2