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.
git clone --depth 1 -b without_nginx [email protected]:hivehelsinki/tinycdn.git
The following concerns only this branch!
-
Create a new 42API application here
-
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 |
- You will need to add your SSL certs into
./nginx/ssl/
like so:
├── nginx.conf
├── nginx.dev.conf
└── ssl
├── cert.crt
├── cert.key
└── touch
- 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 thancert.key
andcert.crt
.
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
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:
- create a .env.dev file and fill in the required fields.
cp .env.sample .env.dev
- Run your container:
docker-compose -f dc-dev.yml up --build -d
- Read the logs to make sure everything went ok
docker-compose -f dc-dev.yml logs -f
- 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
- Propose to save the image locally.