StanGirard / seo-audits-toolkit

SEO & Security Audit for Websites. Lighthouse & Security Headers crawler, Sitemap/Keywords/Images Extractor, Summarizer, etc ...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting Error on login page

bijanpiri opened this issue · comments

when I visit web app page at http://localhost:3000 it redirects to login address http://localhost:3000/#/login
and I expected to be able to login with userpass admin/admin but I get "Network Error" toast message

image

What should I do to get to admin panel?

Yes there is an error that I need to fix with the init -> #24 (comment)

Could you please describe to me the steps you followed to install OSAT ?

Hey Stan,
Thank you for your instant response.
I followed your instructions at README.md file but I got this error

django.db.utils.IntegrityError: Problem installing fixture '/opt/app/init_data.json': Could not load contenttypes.ContentType(pk=19): duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq"
DETAIL: Key (app_label, model)=(django_celery_beat, solarschedule) already exists.

when I tried this command.

docker exec -it osat-server python manage.py loaddata init_data.json

So I have added a Django superuser by attaching to container

docker exec -it osat-server bash

and then I have added Django superuser by executing

python manage.py createsuperuser

creating Django super user leaves me with empty dashboard so I run following commands as you said in #24

To delete database data:

docker exec -it osat-server python manage.py flush

To import it again

docker exec -it osat-server python manage.py loaddata init_data.json

It seems that we can not loaddata at first place and we have to flush database first to prevent from getting "duplicate key value violates unique constraint " error.

OK, I'll look into it. There is an issue with the fixtures it seems.

Thanks.

I'll keep the issue open for other users to see.

Hi, any news on this issue? Thought to give it a spin and got stuck with the same error. Thanks

Hello @Sparkxxx

Have you tried:

docker exec -it osat-server python manage.py flush
docker exec -it osat-server python manage.py loaddata init_data.json

If so, can you provide me with the issues you encountered ?

Starting from scratch with the install on VM Debian 10 server:

Docker version 20.10.5, build 55c4c88
docker-compose version 1.28.6, build 5db8d86f

I'd add some more steps to the install section

git clone https://github.com/StanGirard/seo-audits-toolkit
cd seo-audits-toolkit
edit .env-example
    modify ALLOWED_HOSTS="*" to whatever hostname.domain the server will be accessible , # not everyone runs the app behind a proxy or on localhost
    changing ALLOWED_HOSTS="http://localhost:8000" to * here did not worked for me. 
    I had to change it from within the osat-server container root@97c1ca22e7fe:/opt/app/core/settings.py -->> ALLOWED_HOSTS = ['*']

docker-compose --env-file .env-example pull ## docker-compose build if you want to build it on your own

Now running:
docker-compose --env-file .env-example up
generates

osat-redis   | *** FATAL CONFIG FILE ERROR (Redis 6.2.1) ***
osat-redis   | Reading the configuration file, at line 4
osat-redis   | >>> 'logfile /var/logs/redis/monitor.log'
osat-redis   | Can't open the log file: Permission denied

ctrl+c and comented out in docker-compose.yml

#- "--logfile ${REDIS_LOG_FILE}"

Running docker-compose --env-file .env-example up again
Running docker exec -it osat-server python manage.py flush , as said CUDA errors is not an issue

/opt/venv/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at  /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
  return torch._C._cuda_getDeviceCount() > 0
You have requested a flush of the database.
This will IRREVERSIBLY DESTROY all data currently in the "osat" database,
and return each table to an empty state.
Are you sure you want to do this?

    Type 'yes' to continue, or 'no' to cancel: yes

Running docker exec -it osat-server python manage.py loaddata init_data.json , as said CUDA errors is not an issue

 /opt/venv/lib/python3.8/site-packages/torch/cuda/__init__.py:52: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at  /pytorch/c10/cuda/CUDAFunctions.cpp:100.)
  return torch._C._cuda_getDeviceCount() > 0
Installed 156 object(s) from 1 fixture(s)

Browsing to -->> http://dockers-dev.ops.lan:3000/#/login and I get network error
Browsing to -->> http://dockers-dev.ops.lan:8000/admin/ works fine

Yesterday on the first install it complained about docker network web beeing unavailable so I just run docker network create web
docker inspect web

[
    {
        "Name": "web",
        "Id": "9043a3099d44567988bd4b989c9fd5f7a2b4da2d02b2ff44b15534c12fe11e5c",
        "Created": "2021-03-30T18:19:08.393666197Z",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "28afd70fcb372d918a9e0f3563d408b5351826701ea98028f57b42b8144b5eb7": {
                "Name": "osat-dashboard",
                "EndpointID": "0b3788f239f8f0d7badab219422b40f24c651d69524db5f4bc544018cd023e92",
                "MacAddress": "02:42:ac:12:00:02",
                "IPv4Address": "172.18.0.2/16",
                "IPv6Address": ""
            },
            "97c1ca22e7fe29956eb86998a5462ebc08fbfa6c0b47383958744836ea9f7195": {
                "Name": "osat-server",
                "EndpointID": "d2d8a040d28bb822f24f52152077cd67b4b37a149688fa2e4a91c121ec750188",
                "MacAddress": "02:42:ac:12:00:03",
                "IPv4Address": "172.18.0.3/16",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

Could you please also post your docker "web" network config so we can see if there's something wrong there?
I can see - "traefik.enable=enable/false" so I presume you are using traefik in front of the app, maybe this is also a problem ?

@Sparkxxx Thanks for this amount of details.

I've looked at my web config: it is exactly the same.

You could give me the errors you see on osat-server when you try to login ?

The error is the same as the original image of this issue.
I've outputed all logs I could find
https://gist.github.com/Sparkxxx/185806e5d0341eb1f195b7cd7e4272d8

Where are the logs inside the docker exec -it osat-server bash ? root@97c1ca22e7fe:/opt/app/logs/ only has test.txt file which is empty.

I think YouTube error comes from the fact that the front is configured only to work on localhost.
Go to the folder admin and search for locahost and change it to your URL of the backend. That might make a change.