galaktika-solutions / gStack

A Docker based Django-Postgres-Nginx boilerplate
0 stars 3 forks source link

If .secret.env does not exist at 'make createsecret' then it created as a folder #28

Closed danieltatrai closed 5 years ago

danieltatrai commented 5 years ago

After creating .secret.env as a blank file I was able to generate all secrets, but after make build:

➜ gStack git:(cleanup) ✗ make build Building 2019-01-12-13-52 docker-compose -f docker-compose.yml -f docker-compose.dev.yml down WARNING: The LOG_DRIVER variable is not set. Defaulting to a blank string. Removing gstacktest-postgres ... done Removing network gstacktest_default make imagebuild make[1]: Entering directory '/home/daniel/gStack' docker-compose -f docker-compose.yml -f docker-compose.dev.yml build WARNING: The LOG_DRIVER variable is not set. Defaulting to a blank string. Building build_js Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/docker/utils/build.py", line 96, in create_archive with open(full_path, 'rb') as f: PermissionError: [Errno 13] Permission denied: '/home/daniel/gStack/.files.bak/ca.key'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/docker-compose", line 11, in sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 71, in main command() File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 127, in perform_command handler(command, command_options) File "/usr/local/lib/python3.5/dist-packages/compose/cli/main.py", line 282, in build gzip=options.get('--compress', False), File "/usr/local/lib/python3.5/dist-packages/compose/project.py", line 378, in build service.build(no_cache, pull, force_rm, memory, build_args, gzip) File "/usr/local/lib/python3.5/dist-packages/compose/service.py", line 1067, in build platform=self.platform, File "/usr/local/lib/python3.5/dist-packages/docker/api/build.py", line 154, in build path, exclude=exclude, dockerfile=dockerfile, gzip=gzip File "/usr/local/lib/python3.5/dist-packages/docker/utils/build.py", line 31, in tar root=root, fileobj=fileobj, gzip=gzip, extra_files=extra_files File "/usr/local/lib/python3.5/dist-packages/docker/utils/build.py", line 100, in create_archive 'Can not read file in context: {}'.format(full_path) OSError: Can not read file in context: /home/daniel/gStack/.files.bak/ca.key makefile:14: recipe for target 'imagebuild' failed make[1]: [imagebuild] Error 1 make[1]: Leaving directory '/home/daniel/gStack' makefile:46: recipe for target 'build' failed make: [build] Error 2

.files git:(cleanup) ✗ ls -lia total 20 2239121 drwxr-xr-x 2 daniel daniel 4096 jan 12 14:42 . 2107566 drwxrwxr-x 13 daniel daniel 4096 jan 12 14:46 .. 2239125 -rw-r--r-- 1 daniel daniel 1188 jan 12 14:41 dev.gstacktest.net-ca.crt 2239126 -rw-r--r-- 1 daniel daniel 1090 jan 12 14:41 dev.gstacktest.net.crt 2239127 -rw------- 1 daniel daniel 1679 jan 12 14:41 dev.gstacktest.net.key

dev.gstacktest.net.key created with wrong permissions?

danieltatrai commented 5 years ago

After correcting the permissions and make createsuperuser: gStack git:(cleanup) ✗ make createsuperuser docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm -e ENV=DEV django with_django django-admin createsuperuser WARNING: The LOG_DRIVER variable is not set. Defaulting to a blank string. Starting gstacktest-postgres ... done db ready Traceback (most recent call last): File "/python/bin/django-admin", line 11, in sys.exit(execute_from_command_line()) File "/python/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/python/lib/python3.6/site-packages/django/core/management/init.py", line 325, in execute settings.INSTALLED_APPS File "/python/lib/python3.6/site-packages/django/conf/init.py", line 57, in getattr self._setup(name) File "/python/lib/python3.6/site-packages/django/conf/init.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/python/lib/python3.6/site-packages/django/conf/init.py", line 107, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/src/django_project/core/settings.py", line 16, in for admin in os.environ.get('ADMINS', '').split(',') File "/src/django_project/core/settings.py", line 16, in for admin in os.environ.get('ADMINS', '').split(',') AttributeError: 'NoneType' object has no attribute 'groups' makefile:29: recipe for target 'createsuperuser' failed make: *** [createsuperuser] Error 1

I have ADMINS=Daniel daniel.tatrai@gmail.com, in my .env. Do not know how to solve this.

richardbann commented 5 years ago

For the admins thing: must be in format name

richardbann commented 5 years ago

Should handle it though

richardbann commented 5 years ago

Md does not show it correctly: so email in angle brackets!

richardbann commented 5 years ago

In the readme it's correct

danieltatrai commented 5 years ago

Thanks! I thought it means it is optional for some reason. NOTE: make migrate needed before make createsuperuser

richardbann commented 5 years ago

Back to the main errors. I guess the .env was not correct. The LOG_DRIVER variable was not set according to the error message

richardbann commented 5 years ago

Guess we can close.