Go to file
Angel Rodriguez 866a92b3d9 README.EN.md
Traducción a inglés del Readme. Actualizar en caso de existir modificaciones en el Readme en Español.
2024-11-25 18:42:55 +01:00
api Initial forgejo install 2024-10-29 12:21:44 +01:00
config refs #734 Removes innecesaries parameters and changes php platform to 8.2 2024-09-16 17:56:44 +02:00
docker Add mock api for testing dockerfile 2024-09-16 17:44:06 +02:00
gitlib Use packaged pyblkid 2024-11-13 08:25:02 +01:00
installer Add oglive key to forgejo 2024-11-13 11:55:04 +01:00
packages Add original source 2024-11-14 13:23:15 +01:00
src refs #734 Adds new endpoints sync and backup and status endpoint 2024-09-13 17:20:01 +02:00
.env refs #734 Removes innecesaries parameters and changes php platform to 8.2 2024-09-16 17:56:44 +02:00
Dockerfile Update to 24.04, solves deployment issue 2024-09-18 20:19:23 +02:00
README.EN.md README.EN.md 2024-11-25 18:42:55 +01:00
README.md refs #734 Adds README for Api installation 2024-09-13 13:37:46 +02:00
composer.json refs #734 Removes innecesaries parameters and changes php platform to 8.2 2024-09-16 17:56:44 +02:00
nelmio_api_doc.yaml refs #734 just changes name and description in swagger web page 2024-09-18 09:32:15 +02:00

README.EN.md

OpenGnsys - Git

Installation Guide to Deploy the "oggit" API

This guide outlines the steps necessary to download, install, configure, and deploy the "oggit" API on a server, including Nginx configuration and integration with Nelmio API Doc.

Prerequisites:

  • PHP 8.2 or higher.
  • Composer installed.
  • Nginx configured.
  • Symfony 5.x or 6.x.
  • Git.

1. Download the Repository

Clone the project repository to the server where you want to deploy the API. Make sure the server has access to Git.

2. Install Dependencies

Once the repository is downloaded, navigate to the project root and run the following command to install all necessary dependencies using Composer:

composer install

3. Configure Nginx

Next, configure Nginx to serve the Symfony project. Create a configuration file at /etc/nginx/sites-available/oggit or edit your existing Nginx configuration file.

sudo nano /etc/nginx/sites-available/oggit

Copy and paste the following configuration into the file:

server {
    listen 80;
    server_name localhost;  # Replace 'localhost' with the server's IP address if necessary

    # Document root for the Symfony project
    root /opt/oggit/public;

    # Block to handle requests to /oggit
    location /oggit {
        try_files $uri $uri/ /index.php?$query_string;
        # Increase the timeout for the install oglive
        proxy_read_timeout 600;
        proxy_connect_timeout 600;
        proxy_send_timeout 600;
        send_timeout 600;
    }

    # Block to handle requests to index.php
    location ~ ^/index.php(/|$) {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock; # Make sure this is correct
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param DOCUMENT_ROOT $document_root;
        internal;
    }

    # Block to return 404 for any PHP requests other than index.php
    location ~ \.php$ {
        return 404;
    }

    # Error and access logs for the Symfony project
    error_log /var/log/nginx/oggit_error.log;
    access_log /var/log/nginx/oggit_access.log;

    location /api/doc {
        try_files $uri /index.php?$query_string;
    }
}

Save the changes and enable the site:

sudo ln -s /etc/nginx/sites-available/oggit /etc/nginx/sites-enabled/

Restart Nginx to apply the changes:

sudo systemctl restart nginx

4. Configure Nelmio API Doc

If you're using NelmioApiDocBundle for Swagger documentation, you need to configure Nelmio to accept specific routes, such as the /oggit routes. To do this, edit the Nelmio configuration file:

sudo nano /opt/oggit/config/packages/nelmio_api_doc.yaml

Make sure the file has the following configuration to allow API routes:

nelmio_api_doc:
    documentation:
        info:
            title: Oggit API
            description: Oggit API Documentation
            version: 1.0.0
    areas: # filter documented areas
        path_patterns:
            - ^/oggit

Save the changes.

5. Verify the Installation

  1. Check the API: Access your API at http://<server-IP>/oggit. If everything is correctly configured, you should be able to make requests to the defined endpoints.

  2. Swagger Documentation: Access the Swagger API documentation at http://<server-IP>/api/doc to view the documented endpoints.

6. Logs and Debugging

Nginx logs can be checked to verify any errors during deployment. The logs are located at the following paths:

  • Error logs: /var/log/nginx/oggit_error.log
  • Access logs: /var/log/nginx/oggit_access.log