This is the public source code for the Iamages Server. An official instance is deployed at https://iamages.jkelol111.me/api, usually using the latest commit available here.
- Get a copy from releases and extract somewhere/clone this repo to use the bleeding edge version.
- Install MongoDB.
- Install dependencies using
poetryorpip3(bothpyproject.tomland syncedrequirements.txtavailable, pick your optimal solution) - Create the database by using
scripts/mkdb.py. - Make a storage directory and update your environment values:
IAMAGES_MAX_SIZE: maximum size of one file (in bytes).IAMAGES_DB_HOST: MongoDB login URL toiamagesdatabase (requires URL encoding)IAMAGES_JWT_SECRET: random string used to generate tokens.IAMAGES_SERVER_OWNER: name of server owner.IAMAGES_SERVER_CONTACT: contact to the server owner (examples include: mailto, tel link).IAMAGES_SMTP_HOST: SMTP host address.IAMAGES_SMTP_PORT: SMTP host port.IAMAGES_SMTP_STARTTLS: SMTP STARTTLS enabled (recommended).IAMAGES_SMTP_USERNAME: SMTP username (optional).IAMAGES_SMTP_PASSWORD: SMTP password (optional).IAMAGES_SMTP_FROM: email address used inFromfields.
- Start the server using
gunicorn(a sample startup script is provided asstart_prod_server.sh).
Periodically check back here for new releases/commits, and update the server using step 1 and 2 (3 might be required too, along with 'Using database/storage layout upgrader' below)
Follow Server deployment guide above until step 4.
- Install Traefik.
- Start Treafik proxy (a sample startup script is provided as
start_dev_proxy.sh). - Start the server using
uvicorn(a sample startup script is provided asstart_dev_server.sh).
Changes in the code will automatically be reloaded if you start the server using this method.
Most of the time, Iamages Server updates are as simple as getting a new copy, replacing the older one, and restart the server. However, database/storage layout changes may occur between updates (rarely), in which case you will have to follow this section in addition to updating the server.
- Archive/backup the current server using
scripts/storagearchive.py(view instructions inscripts/README.md). - Run
scripts/dbupgrade.py - Start the new server. If no errors come up, you should be good to go (test some endpoints for good measure).
If errors come up, it's a matter of rolling back to the older server version, and restoring an archive/backup using scripts/storagearchive.py.
- README files for the various scripts can be viewed in
scripts/README.md.