README.EN.md

Traducción a inglés del Readme. Actualizar en caso de existir modificaciones en el Readme en Español.
setsshkey
Angel Rodriguez 2024-11-25 18:42:55 +01:00
parent fdb530eab3
commit 866a92b3d9
1 changed files with 127 additions and 0 deletions

127
README.EN.md 100644
View File

@ -0,0 +1,127 @@
# 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**:
```bash
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.
```bash
sudo nano /etc/nginx/sites-available/oggit
```
Copy and paste the following configuration into the file:
```nginx
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:
```bash
sudo ln -s /etc/nginx/sites-available/oggit /etc/nginx/sites-enabled/
```
Restart Nginx to apply the changes:
```bash
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:
```bash
sudo nano /opt/oggit/config/packages/nelmio_api_doc.yaml
```
Make sure the file has the following configuration to allow API routes:
```yaml
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`