Comment to 'Image upload problem'
  • So, on our first installation we had to turn of the varnish cache to get photos to show. We then tried out the spacenook config and changed permissions for that. Then decided to go back to current release with default template and never had that problem again. @Romulus might be right about a permissions issue. I'm not really sure.

    • Did you install the application using Docker or directly on the server?

      Installation Guide for the UNA APP DEV Application Using Docker and Composer

      This guide provides detailed steps to install and run the application using Docker and Composer.

      1. Clone the Repository

      Start by cloning the application repository:

      gh repo clone unacms/una una
      

      or alternatively:

      git clone https://github.com/unacms/una.git
      

      Navigate into the cloned repository:

      cd una
      

      Switch to the desired branch (e.g., 14.0.0-RC3):

      git checkout 14.0.0-RC3
      

      2. Install Composer

      Download the Composer Docker image:

      docker pull composer/composer
      

      Note: Depending on your PHP version, you may need a specific Composer version. The latest version may not work, so ensure you're using the correct one. It’s recommended to avoid installing PHP directly on the server.

      3. Install PHP Dependencies Using Composer

      Run the following command to install the PHP dependencies for the application composer latest tag:

      docker run --rm -it -v "$(pwd):/app" composer/composer install
      

      This will execute Composer in a Docker container and install the required PHP dependencies in the current directory.

      For releases: https://github.com/composer/composer/releases

      for 2.2.9 tag example:

      docker run --rm -it -v "$(pwd):/app" composer/composer:2.2.9 install
      

      Note: After the dependencies are installed, you can remove the Composer Docker image to save space:

      docker rmi composer/composer
      

      4. Build Docker Images

      Once permissions are set, build the necessary Docker images for the services:

      docker-compose build cron
      docker-compose build php
      

      5. Set Permissions

      Before running Docker containers, ensure proper permissions are applied. Follow these steps:

      1. Create a file for setting permissions:
      vim set_permissions.sh
      
      1. Copy and paste the following script into the file:
      #!/bin/bash
      # sudo set_permissions.sh
      sudo chown -R www-data:www-data .
      sudo find ./ -type d -exec chmod 755 {} \;
      
      # Set permissions for specific directories
      sudo find ./storage -type d -exec chmod 775 {} \;
      sudo find ./tmp -type d -exec chmod 775 {} \;
      
      sudo chmod 775 ./cache
      sudo chmod 775 ./cache_public
      sudo chmod 775 ./logs
      sudo chmod 775 ./periodic
      sudo chmod 775 ./storage
      sudo chmod 775 ./tmp
      
      # Set permissions for ./inc directories before installation
      sudo chmod 755 ./inc
      
      # GitHub Folders
      sudo chown -R root:root ./.github
      sudo chown -R root:root ./.git
      sudo chmod -R 755 ./.github
      sudo chmod -R 755 ./.git
      
      # Set permissions for all files
      sudo find ./ -type f -exec chmod 644 {} \;
      
      # Set execute permissions for specific files
      sudo chmod +x ./plugins/ffmpeg/ffmpeg.exe
      sudo chmod +x ./periodic/cron.php
      sudo chmod +x ./image_transcoder.php
      
      # GitHub Files
      sudo chown root:root ./.gitignore
      
      # Set permissions for specific files
      sudo chown root:root ./docker-compose.yaml
      sudo chown root:root ./.env
      sudo chown root:root ./INSTALL.md
      sudo chown root:root ./set_permissions.sh
      
      # Set execute permissions for setup files
      sudo chmod +x ./docker-compose.yaml
      sudo chmod +x ./set_permissions.sh
      
      1. Make the script executable:
      chmod +x set_permissions.sh
      
      1. Run the script:
      sudo ./set_permissions.sh
      

      This will apply the appropriate permissions for all directories and files as specified in the script.

      6. Add Your Environment Variables

      Set up your .env file with the necessary environment variables.

      7. Run Docker Containers Using docker-compose

      To run the application, use Docker Compose. Ensure your docker-compose.yml file is properly configured.

      docker-compose up
      

      This will start the Docker containers as defined in the docker-compose.yml file, enabling the application to run.

      8. Access the Application

      Once the application is running, open your web browser and navigate to www.example.com to access the application. Follow the on-screen instructions to complete the installation process.

      This guide covers the steps to download Composer using Docker, install PHP dependencies, and run the application using Docker Compose.

      Regarding Varnish, I don’t have experience with it personally. My projects typically use Memcached, Dragonfly, and Redis, with Nginx as a proxy and Caddy as a reverse proxy. However, if you provide more details about your Varnish setup, I can offer further suggestions based on your configuration.

      • Another important consideration is setting the hostname correctly when your server is behind a proxy. At the UNA level, the hostname could either be localhost or your domain name, depending on the installation method. If the hostname is not configured properly, images and media files may fail to process. This configuration is dependent on both your web server (such as Nginx or Apache) and server-level settings. It’s unlikely that this issue is related to Varnish or any other caching system. However, if you provide logs and details of your setup, we may be able to investigate further. Without additional information, it's difficult to pinpoint the exact source of the issue.

        How to Properly Report an Error?

        When reporting an error, clear and structured information helps diagnose and resolve the problem quickly. Please follow these steps:

        1. Describe the Issue Clearly
        • What were you trying to do when the error occurred?
        • What did you expect to happen?
        • What actually happened?
        1. Provide Error Messages and Logs
        • Copy and paste the full error message.
        • Include relevant logs from the system, application, or web server if possible.
        • Highlight the exact timestamp of the error.
        1. Mention Your Setup
        • Operating system and version (e.g., Ubuntu 22.04, Debian 12).
        • Software versions (e.g., PHP 8.1, MySQL 5.7, Nginx 1.20).
        • Any special configurations (e.g., reverse proxy, custom settings).
        1. Steps to Reproduce
        • List the exact steps to recreate the error.
        • If it’s a web-based issue, mention the browser used and whether cache/cookies were cleared.
        1. Include Relevant Screenshots (if applicable)
        • A screenshot of the error can help clarify the issue faster.
        1. Check Before Reporting
        • Have you tried restarting the service/system?
        • Did you check the logs for additional hints?
        • Did you search online for similar issues?

        Providing detailed information will make troubleshooting much easier and help you get faster solutions.

        Noted! When reporting errors, I will ensure that sensitive data, site names, personal information, and usernames are removed before sharing. Let me know if you need any additional guidelines.