You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "AArenxiaoming (via GitHub)" <gi...@apache.org> on 2023/11/17 16:04:44 UTC

[I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

AArenxiaoming opened a new issue, #26016:
URL: https://github.com/apache/superset/issues/26016

   error logs   
   ```txt
   logging was configured successfully
   2023-11-17 15:51:26,046:INFO:superset.utils.logging_configurator:logging was configured successfully
   2023-11-17 15:51:26,053:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
   We haven't found any Content Security Policy (CSP) defined in the configurations. Please make sure to configure CSP using the TALISMAN_ENABLED and TALISMAN_CONFIG keys or any other external software. Failing to configure CSP have serious security implications. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP for more information. You can disable this warning using the CONTENT_SECURITY_POLICY_WARNING key.
   2023-11-17 15:51:26,054:WARNING:superset.initialization:We haven't found any Content Security Policy (CSP) defined in the configurations. Please make sure to configure CSP using the TALISMAN_ENABLED and TALISMAN_CONFIG keys or any other external software. Failing to configure CSP have serious security implications. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP for more information. You can disable this warning using the CONTENT_SECURITY_POLICY_WARNING key.
   2023-11-17 15:51:26,061:ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: (psycopg2.OperationalError) connection to server at "superset" (192.168.80.4), port 5432 failed: Connection refused
           Is the server running on that host and accepting TCP/IP connections?
   
   (Background on this error at: https://sqlalche.me/e/14/e3q8)
   [2023-11-17 15:51:26 +0000] [411] [INFO] Worker exiting (pid: 411)
   Loaded your LOCAL configuration at [/app/docker/pythonpath_dev/superset_config.py]
   [2023-11-17 15:51:26 +0000] [414] [INFO] Booting worker with pid: 414
   ```
   
   /app/docker/pythonpath_dev/superset_config.py
   
   ```txt
   
   # Licensed to the Apache Software Foundation (ASF) under one
   # or more contributor license agreements.  See the NOTICE file
   # distributed with this work for additional information
   # regarding copyright ownership.  The ASF licenses this file
   # to you under the Apache License, Version 2.0 (the
   # "License"); you may not use this file except in compliance
   # with the License.  You may obtain a copy of the License at
   #
   #   http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing,
   # software distributed under the License is distributed on an
   # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   # KIND, either express or implied.  See the License for the
   # specific language governing permissions and limitations
   # under the License.
   #
   # This file is included in the final Docker image and SHOULD be overridden when
   # deploying the image to prod. Settings configured here are intended for use in local
   # development environments. Also note that superset_config_docker.py is imported
   # as a final step as a means to override "defaults" configured here
   #
   import logging
   import os
   from datetime import timedelta
   from typing import Optional
   
   from cachelib.file import FileSystemCache
   from celery.schedules import crontab
   
   logger = logging.getLogger()
   
   
   def get_env_variable(var_name: str, default: Optional[str] = None) -> str:
       """Get the environment variable or raise exception."""
       try:
           return os.environ[var_name]
       except KeyError:
           if default is not None:
               return default
           else:
               error_msg = "The environment variable {} was missing, abort...".format(
                   var_name
               )
               raise EnvironmentError(error_msg)
   
   
   DATABASE_DIALECT = get_env_variable("DATABASE_DIALECT")
   DATABASE_USER = get_env_variable("DATABASE_USER")
   DATABASE_PASSWORD = get_env_variable("DATABASE_PASSWORD")
   DATABASE_HOST = get_env_variable("DATABASE_HOST")
   DATABASE_PORT = get_env_variable("DATABASE_PORT")
   DATABASE_DB = get_env_variable("DATABASE_DB")
   SECRET_KEY = "XSdIQWosfM3uXHzCNUR"
   # The SQLAlchemy connection string.
   #SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://superset:superset@superset/superset'
   
   SQLALCHEMY_DATABASE_URI = "%s://%s:%s@%s:%s/%s" % (
       DATABASE_DIALECT,
       DATABASE_USER,
       DATABASE_PASSWORD,
       DATABASE_HOST,
       DATABASE_PORT,
       DATABASE_DB,
   )
   
   REDIS_HOST = get_env_variable("REDIS_HOST")
   REDIS_PORT = get_env_variable("REDIS_PORT")
   REDIS_CELERY_DB = get_env_variable("REDIS_CELERY_DB", "0")
   REDIS_RESULTS_DB = get_env_variable("REDIS_RESULTS_DB", "1")
   
   RESULTS_BACKEND = FileSystemCache("/app/superset_home/sqllab")
   
   
   class CeleryConfig(object):
       BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
       CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks")
       CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_RESULTS_DB}"
       CELERYD_LOG_LEVEL = "DEBUG"
       CELERYD_PREFETCH_MULTIPLIER = 1
       CELERY_ACKS_LATE = False
       CELERYBEAT_SCHEDULE = {
           "reports.scheduler": {
               "task": "reports.scheduler",
               "schedule": crontab(minute="*", hour="*"),
           },
           "reports.prune_log": {
               "task": "reports.prune_log",
               "schedule": crontab(minute=10, hour=0),
           },
       }
   
   
   CELERY_CONFIG = CeleryConfig
   
   FEATURE_FLAGS = {"ALERT_REPORTS": True}
   ALERT_REPORTS_NOTIFICATION_DRY_RUN = True
   WEBDRIVER_BASEURL = "http://superset:8088/"
   # The base URL for the email report hyperlinks.
   WEBDRIVER_BASEURL_USER_FRIENDLY = WEBDRIVER_BASEURL
   
   SQLLAB_CTAS_NO_LIMIT = True
   
   #
   # Optionally import superset_config_docker.py (which will have been included on
   # the PYTHONPATH) in order to allow for local settings to be overridden
   #
   try:
       import superset_config_docker
       from superset_config_docker import *  # noqa
   
       logger.info(
           f"Loaded your Docker configuration at " f"[{superset_config_docker.__file__}]"
       )
   except ImportError:
       logger.info("Using default Docker config...")
   
   ```
   docker-compose-non-dev.yml
   ```txt
   #
   # Licensed to the Apache Software Foundation (ASF) under one or more
   # contributor license agreements.  See the NOTICE file distributed with
   # this work for additional information regarding copyright ownership.
   # The ASF licenses this file to You under the Apache License, Version 2.0
   # (the "License"); you may not use this file except in compliance with
   # the License.  You may obtain a copy of the License at
   #
   #    http://www.apache.org/licenses/LICENSE-2.0
   #
   # Unless required by applicable law or agreed to in writing, software
   # distributed under the License is distributed on an "AS IS" BASIS,
   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   # See the License for the specific language governing permissions and
   # limitations under the License.
   #
   #x-superset-image: &superset-image apache/superset:${TAG:-latest-dev}
   x-superset-image: &superset-image apache/superset:2.1.2rc2
   x-superset-depends-on: &superset-depends-on
     - db
     - redis
   x-superset-volumes: &superset-volumes
     # /app/pythonpath_docker will be appended to the PYTHONPATH in the final container
     - ./docker:/app/docker
     - superset_home:/app/superset_home
   
   version: "3.7"
   services:
     redis:
       image: redis:latest
       container_name: superset_cache
       restart: unless-stopped
       volumes:
         - redis:/data
   
     db:
       env_file: docker/.env-non-dev
       image: postgres:10
       container_name: superset_db
       restart: unless-stopped
       volumes:
         - db_home:/var/lib/postgresql/data
   
     superset:
       env_file: docker/.env-non-dev
       image: *superset-image
       container_name: superset_app
       command: ["/app/docker/docker-bootstrap.sh", "app-gunicorn"]
       user: "root"
       restart: unless-stopped
       ports:
         - 8088:8088
       depends_on: *superset-depends-on
       volumes: *superset-volumes
   
     superset-init:
       image: *superset-image
       container_name: superset_init
       command: ["/app/docker/docker-init.sh"]
       env_file: docker/.env-non-dev
       depends_on: *superset-depends-on
       user: "root"
       volumes: *superset-volumes
   
     superset-worker:
       image: *superset-image
       container_name: superset_worker
       command: ["/app/docker/docker-bootstrap.sh", "worker"]
       env_file: docker/.env-non-dev
       restart: unless-stopped
       depends_on: *superset-depends-on
       user: "root"
       volumes: *superset-volumes
   
     superset-worker-beat:
       image: *superset-image
       container_name: superset_worker_beat
       command: ["/app/docker/docker-bootstrap.sh", "beat"]
       env_file: docker/.env-non-dev
       restart: unless-stopped
       depends_on: *superset-depends-on
       user: "root"
       volumes: *superset-volumes
   
   volumes:
     superset_home:
       external: false
     db_home:
       external: false
     redis:
       external: false
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "AArenxiaoming (via GitHub)" <gi...@apache.org>.
AArenxiaoming closed issue #26016: when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work 
URL: https://github.com/apache/superset/issues/26016


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "AArenxiaoming (via GitHub)" <gi...@apache.org>.
AArenxiaoming commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-1822237868

   ```bash
   psql -d superset -U superset -W
   # Password for user superset:
   ```
   ```sql
   select database_name, password from dbs;
   update dbs set password = null;
   ```
   # then you can see yourdomainaddress.com/databaseview/list/
   # then add a database ,  somename is ok 
   
   # 5 = New DB
   # 2 = Original DB
   ```sql
   update tables set database_id = 5 where database_id = 2;
   update tab_state set database_id = 5 where database_id = 2;
   update query set database_id = 5 where database_id = 2;
   update saved_query set db_id = 5 where db_id = 2;
   update table_schema set database_id = 5 where database_id = 2;
   delete from dbs where database_name = 'Original DB';
   update dbs set database_name = 'Original DB' where database_name = 'New DB';
   ```
   
   # if you got this error 
   # delete from dbs where database_name = 'Original DB';
   # ERROR:  update or delete on table "dbs" violates foreign key constraint "sl_datasets_database_id_fkey" on table "sl_datasets"
   # ERROR:  update or delete on table "dbs" violates foreign key constraint "sl_tables_database_id_fkey" on table "sl_tables"
   # then 
   ```sql
   UPDATE sl_datasets SET database_id = 5 WHERE database_id = 2;
   UPDATE sl_tables SET database_id = 5 WHERE database_id = 2;
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "AArenxiaoming (via GitHub)" <gi...@apache.org>.
AArenxiaoming commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-1818090400

   ![image](https://github.com/apache/superset/assets/38529441/b078e1bb-bb16-42fc-a83b-46b1bc288010)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "AArenxiaoming (via GitHub)" <gi...@apache.org>.
AArenxiaoming commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-1817280293

   ![image](https://github.com/apache/superset/assets/38529441/db4d971c-64e1-4c58-ae58-80de89f16162)
   i can login to pg in superset_app 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "AArenxiaoming (via GitHub)" <gi...@apache.org>.
AArenxiaoming commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-1816766828

   ![image](https://github.com/apache/superset/assets/38529441/aecd6a5d-a9d7-4ab1-859e-f6520e6266df)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "DarwinDennis003 (via GitHub)" <gi...@apache.org>.
DarwinDennis003 commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-1818724369

   Generate a secret key using openssl rand -base64 42 in bash and update the secret_key constant in config.py 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "AArenxiaoming (via GitHub)" <gi...@apache.org>.
AArenxiaoming commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-1818990327

   have add to this file /app/docker/pythonpath_dev/superset_config.py
   
   ![image](https://github.com/apache/superset/assets/38529441/5e6a1b61-eedc-4b33-8824-3c984059409b)
   
   the problem is this , web sever can not connect db , web sever can login  use before id, password 
   ![image](https://github.com/apache/superset/assets/38529441/d88251e2-4e30-49a8-a1b7-df6e743540aa)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "liujiwen-up (via GitHub)" <gi...@apache.org>.
liujiwen-up commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-2006516778

   > ```shell
   > psql -d superset -U superset -W
   > # Password for user superset:
   > ```
   > 
   > ```sql
   > select database_name, password from dbs;
   > update dbs set password = null;
   > ```
   > 
   > # then you can see yourdomainaddress.com/databaseview/list/
   > # then add a database , somename is ok
   > # 5 = New DB
   > # 2 = Original DB
   > ```sql
   > update tables set database_id = 5 where database_id = 2;
   > update tab_state set database_id = 5 where database_id = 2;
   > update query set database_id = 5 where database_id = 2;
   > update saved_query set db_id = 5 where db_id = 2;
   > update table_schema set database_id = 5 where database_id = 2;
   > delete from dbs where database_name = 'Original DB';
   > update dbs set database_name = 'Original DB' where database_name = 'New DB';
   > ```
   > 
   > # if you got this error
   > # delete from dbs where database_name = 'Original DB';
   > # ERROR: update or delete on table "dbs" violates foreign key constraint "sl_datasets_database_id_fkey" on table "sl_datasets"
   > # ERROR: update or delete on table "dbs" violates foreign key constraint "sl_tables_database_id_fkey" on table "sl_tables"
   > # then
   > ```sql
   > UPDATE sl_datasets SET database_id = 5 WHERE database_id = 2;
   > UPDATE sl_tables SET database_id = 5 WHERE database_id = 2;
   > ```
   
   `psql -d superset -U superset -W`What is this password? Is there a default value? Where is it set?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] when i add SECRET_KEY = "XSdIQWosfM3uXHzCNUR" ,the server can not work [superset]

Posted by "AArenxiaoming (via GitHub)" <gi...@apache.org>.
AArenxiaoming commented on issue #26016:
URL: https://github.com/apache/superset/issues/26016#issuecomment-1819005997

   ![image](https://github.com/apache/superset/assets/38529441/7c5c49a7-8b11-425b-aee5-f22ea4b1cc8a)
   
   when i change  alse can not login, the web tell me this error
   
   ![image](https://github.com/apache/superset/assets/38529441/06326083-e2ef-45a3-b60e-036b773038d5)
   
   ![image](https://github.com/apache/superset/assets/38529441/0b7a5e24-b596-4574-a0e4-9854a8d312b8)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org