AadarshBhalerao opened a new issue, #40961:
URL: https://github.com/apache/airflow/issues/40961

   ### Apache Airflow version
   
   2.9.3
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   I have created a Dockerfile
   
   ```
   # Use the official Airflow image as the base
   FROM apache/airflow:2.9.3
   
   # Switch to root to install PostgreSQL and create directories with proper 
permissions
   USER root
   
   # Install PostgreSQL and other necessary packages
   RUN apt-get update && \
       apt-get install -y postgresql postgresql-contrib && \
       apt-get clean
   
   # Create a new user for PostgreSQL
   RUN service postgresql start && \
       sudo -u postgres psql -c "CREATE USER airflow WITH PASSWORD 'airflow';" 
&& \
       sudo -u postgres psql -c "CREATE DATABASE airflow OWNER airflow;"
   
   # Expose the PostgreSQL port
   EXPOSE 5432
   
   # Switch back to the airflow user
   USER airflow
   
   # Set environment variables to configure Airflow to use PostgreSQL
   ENV AIRFLOW__CORE__EXECUTOR=LocalExecutor
   ENV 
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@localhost/airflow
   ENV AIRFLOW__CORE__FERNET_KEY=FB0o_zt4e3Ziq3LdUUO7F2Z95cvFFx16hU8jTeR1ASM=
   ENV AIRFLOW__CORE__LOAD_EXAMPLES=False
   ENV AIRFLOW__API__AUTH_BACKENDS=airflow.api.auth.backend.basic_auth
   ENV AIRFLOW__SCHEDULER__ENABLE_HEALTH_CHECK=True
   
   # Copy your dags, plugins, and other configuration files if needed
   COPY ./dags /opt/airflow/dags
   COPY ./plugins /opt/airflow/plugins
   COPY ./config /opt/airflow/config
   COPY ./logs /opt/airflow/logs
   
   # Command to start PostgreSQL, initialize Airflow database, create admin 
user, start scheduler, and webserver
   CMD bash -c "service postgresql start && \
   airflow db init && \
   airflow users create --role Admin --username admin --password admin --email 
[email protected] --firstname admin --lastname admin && \
   airflow scheduler & airflow webserver"
   ```
   
   I created an image ```docker build -t my-airflow .```
   
   And then a container ```docker run --name airflow-container -d -p 8080:8080 
-p 5432:5432 -v /path/to/dags:/opt/airflow/dags -v 
/path/to/logs:/opt/airflow/logs -v /path/to/plugins:/opt/airflow/plugins 
my-airflow```
   
   When I opened logs in docker desktop I see these errors
   
   ```
   2024-07-23 19:38:00 ....................
   2024-07-23 19:38:00 ERROR! Maximum number of retries (20) reached.
   2024-07-23 19:38:00 
   2024-07-23 19:38:00 Last check result:
   2024-07-23 19:38:00 $ airflow db check
   2024-07-23 19:38:00 
/home/airflow/.local/lib/python3.12/site-packages/airflow/configuration.py:764 
FutureWarning: The auth_backends setting in [api] has had 
airflow.api.auth.backend.session added in the running config, which is needed 
by the UI. Please update your config before Apache Airflow 3.0.
   2024-07-23 19:38:00 Unable to load the config, contains a configuration 
error.
   2024-07-23 19:38:00 Traceback (most recent call last):
   2024-07-23 19:38:00   File "/usr/local/lib/python3.12/pathlib.py", line 
1311, in mkdir
   2024-07-23 19:38:00     os.mkdir(self, mode)
   2024-07-23 19:38:00 FileNotFoundError: [Errno 2] No such file or directory: 
'/opt/airflow/logs/scheduler/2024-07-23'
   2024-07-23 19:38:00 
   2024-07-23 19:38:00 During handling of the above exception, another 
exception occurred:
   2024-07-23 19:38:00 
   2024-07-23 19:38:00 Traceback (most recent call last):
   2024-07-23 19:38:00   File "/usr/local/lib/python3.12/logging/config.py", 
line 581, in configure
   2024-07-23 19:38:00     handler = self.configure_handler(handlers[name])
   2024-07-23 19:38:00               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   2024-07-23 19:38:00   File "/usr/local/lib/python3.12/logging/config.py", 
line 854, in configure_handler
   2024-07-23 19:38:00     result = factory(**kwargs)
   2024-07-23 19:38:00              ^^^^^^^^^^^^^^^^^
   2024-07-23 19:38:00   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/log/file_processor_handler.py",
 line 53, in __init__
   2024-07-23 19:38:00     Path(self._get_log_directory()).mkdir(parents=True, 
exist_ok=True)
   2024-07-23 19:38:00   File "/usr/local/lib/python3.12/pathlib.py", line 
1315, in mkdir
   2024-07-23 19:38:00     self.parent.mkdir(parents=True, exist_ok=True)
   2024-07-23 19:38:00   File "/usr/local/lib/python3.12/pathlib.py", line 
1311, in mkdir
   2024-07-23 19:38:00     os.mkdir(self, mode)
   2024-07-23 19:38:00 PermissionError: [Errno 13] Permission denied: 
'/opt/airflow/logs/scheduler'
   2024-07-23 19:38:00 
   2024-07-23 19:38:00 The above exception was the direct cause of the 
following exception:
   2024-07-23 19:38:00 
   2024-07-23 19:38:00 Traceback (most recent call last):
   2024-07-23 19:38:00   File "/home/airflow/.local/bin/airflow", line 5, in 
<module>
   2024-07-23 19:38:00     from airflow.__main__ import main
   2024-07-23 19:38:00   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/__init__.py", line 
74, in <module>
   2024-07-23 19:38:00     settings.initialize()
   2024-07-23 19:38:00   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/settings.py", line 
531, in initialize
   2024-07-23 19:38:00     LOGGING_CLASS_PATH = configure_logging()
   2024-07-23 19:38:00                          ^^^^^^^^^^^^^^^^^^^
   2024-07-23 19:38:00   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/logging_config.py", 
line 74, in configure_logging
   2024-07-23 19:38:00     raise e
   2024-07-23 19:38:00   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/logging_config.py", 
line 69, in configure_logging
   2024-07-23 19:38:00     dictConfig(logging_config)
   2024-07-23 19:38:00   File "/usr/local/lib/python3.12/logging/config.py", 
line 920, in dictConfig
   2024-07-23 19:38:00     dictConfigClass(config).configure()
   2024-07-23 19:38:00   File "/usr/local/lib/python3.12/logging/config.py", 
line 588, in configure
   2024-07-23 19:38:00     raise ValueError('Unable to configure handler '
   2024-07-23 19:38:00 ValueError: Unable to configure handler 'processor'
   2024-07-23 19:38:00
   ```
   
   
   This is my folder structure
   <img width="147" alt="image" 
src="https://github.com/user-attachments/assets/f204b425-5386-4f96-a6e5-dce2eaf34dfb";>
   
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   Please follow the files shared above
   
   ### Operating System
   
   WSL
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to