Skip to content

hivehelsinki/tinycdn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyCDN

Description

TinyCDN is a simple application designed to make it easy to access your 42 students' profile pictures internally.

You may wonder why such an application is necessary. Perhaps you want to create a static website or a simple app without the hassle of setting up a 42API connector or OAuth to retrieve your students' profile picture links. In that case, TinyCDN can help you access any of your students' pictures using the URL tinycdn.domain.nl/LE_LOGIN. This is no longer possible through 42 due to GDPR restrictions on external exposure of student profile pictures.

⚠️ This branch contains a nginx container. If you already have your own reverse proxy handling your certs, you can move to the without_nginx branch or git clone directly without_nginx branch and follow the README.md like so:

git clone --depth 1 -b without_nginx git@github.com:hivehelsinki/tinycdn.git

The following concerns only this branch!



Install

  1. Create a new 42API application here

  2. Create the .env file and fill in the required information

copy .env.sample .env
key desc
CAMPUS_ID Your campus ID on the intranet
FT_ID Your 42API UID starting with u-s4t2af
FT_SECRET Your 42API Secret starting with s-s4t2af

  1. You will need to add your SSL certs into ./nginx/ssl/ like so:
├── nginx.conf
├── nginx.dev.conf
└── ssl
    ├── cert.crt
    ├── cert.key
    └── touch

  1. Edit ./nginx/nginx.conf to suit your needs.

In this step, you may need:

  • to update the allow lines if you want to restrict this service to some other specific internal IPs
  • to update the ssl_certificate lines if you want to use different filen names for your certificates than cert.key and cert.crt.

Run

docker-compose up -d --build

I would then recommend to take a look at the logs, making sure you don't see any errors.

docker-compose logs -f

Test

Open a browser and try to access https://tinycdn.domain.nl/ it should returns the following:

{
  "name": "TinyCDN",
  "version": "0.0.3"
}

If so, try to access a student profile picture via: https://tinycdn.domain.nl/LOGIN. For example, https://tinycdn.domain.nl/jgengo



Dev

If you want to run this application in dev mode:

  • debug logs
  • no ip restriction
  • auto reload on edition
  • http only

You can follow the following steps:

  1. create a .env.dev file and fill in the required fields.
cp .env.sample .env.dev
  1. Run your container:
docker-compose -f dc-dev.yml up --build -d
  1. Read the logs to make sure everything went ok
docker-compose -f dc-dev.yml logs -f
  1. Access it via : http://localhost

Feel free to change the port forwarding if you want to use something else than 80 in the dc-dev.yml



Todo

  • Propose to save the image locally.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published