mirror of
				https://github.com/i701/sarlink-portal-api.git
				synced 2025-10-30 21:36:58 +00:00 
			
		
		
		
	
		
			Some checks failed
		
		
	
	Build and Push Docker Images / Build and Push Docker Images (push) Failing after 4m12s
				
			- Updated the `reverse_dhivehi_string` function to correct the range for combining characters. - Added new device handling in the health check view and integrated the `add_new_devices_to_omada` task. - Improved date handling in `CreateTemporaryUserView` to ensure proper string conversion. - Enhanced OTP sending by converting mobile numbers to strings. - Implemented MAC address validation in the `Device` model using a custom validator. - Removed unnecessary fields from the `CreateDeviceSerializer`. - Normalized MAC address format in the `DeviceListCreateAPIView`. - Updated the `djangopasswordlessknox` package to improve code consistency and readability. - Added migration to enforce MAC address validation in the database.
		
			
				
	
	
	
		
			1.5 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			1.5 KiB
		
	
	
	
	
	
	
	
sarlink-portal-api
API for SARLink portal in Django Rest Framework.
Deployment steps
- clone the repo git clone git@github.com:i701/sarlink-portal-api.git
- Create virtual enviroment virtualenv venvand activate itsource venv/bin/activate
- Install requirements pip install -r requirements.txt
- Copy .env.example to .env and fill in the configs cp .env.example .env
- generate static python manage.py collectstatic
- Run Migrations python manage.py migrate
deployement with Docker
- Create compose.yml
services:
  portal-api:
    hostname: portal-api
    image: git.shihaam.dev/sarlink/sarlink-portal-api/api
    env_file: .env.api
  nginx:
    hostname: portal-api-nginx
    image: git.shihaam.dev/sarlink/sarlink-portal-api/nginx
    volumes_from:
      - portal-api
    ports:
      - 4000:80
    depends_on:
      - portal-api
  portal-db:
    image: postgres:14
    restart: always
    hostname: portal-db
    volumes:
      - ./database:/var/lib/postgresql/data
    env_file: .env.db
- Start services: docker compose up -d
- Run Migrations: docker compose exec portal-api python manage.py migrate
- Test api with curl:
curl -X POST http://localhost:4000/api/auth/login/ \
-H "Content-Type: application/json" \
-d '{"username":"admin", "password":"soemthign"}'
expected response: {"message":"Unable to log in with provided credentials."}
- For Celery to work run the worker and the beat
celery -A apibase worker --loglevel=info
celery -A apibase beat --loglevel=info