placeany/README.md

76 lines
2.2 KiB
Markdown
Raw Normal View History

2024-09-03 01:04:07 +02:00
# Placeany
2024-09-03 00:53:55 +02:00
A quick and simple service for getting pictures of whatever-you-want
for use as placeholders in your designs or code. Just put your image
size (width & height) after the URL and you'll get a placeholder.
There is also a bookmarklet service which enhances sites with many images.
2024-09-03 00:53:55 +02:00
Inspirations:
2024-09-03 09:12:04 +02:00
- https://web.archive.org/web/20110504042732/http://placekitten.com/
- https://web.archive.org/web/20120223050454/http://www.heyben.com/horse_ebookmarklet/.
## Example calls
# generates an image, 200px wide and 300px tall
http://localhost:8080/200/300*
# generates an image in grayscale, 200px wide and 300px tall
http://localhost:8080/g/200/300
2024-09-03 00:53:55 +02:00
## Installation
2024-09-03 01:04:07 +02:00
First, create an image collection.
2024-09-03 00:53:55 +02:00
2024-09-03 01:04:07 +02:00
1. Create the directory `./images`.
1. Get some images, from [Unsplash](https://unsplash.com) or similar.
1. Place images in image directory.
### Run as local web server
1. Go to the code: `cd path/to/holder`. Copy `images` folder to it.
2024-09-03 00:53:55 +02:00
1. Create and activate a virtualenv.
1. Get dependencies in place: `pip install -r requirements.txt`
2024-09-03 09:12:04 +02:00
1. Start the app: `waitress-serve wsgi:app`
1. Go to [http://localhost:8080](http://localhost:8080) in your web browser.
2024-09-03 00:53:55 +02:00
1. Done!
### Run as Container
The most easy and portable way to use this is to use Docker or Podman.
In this build, waitress is used for production readyness. Port 5099 is
instead used.
podman build .
2024-09-03 09:12:04 +02:00
podman run -it -p 8080:8080 -v ./images:/app/images <container id>
2024-09-03 00:53:55 +02:00
If you wish to embed images in container as well, use alternate
Containerfile.
podman build -f Containerfile.aio --build-arg images=./images .
2024-09-03 09:12:04 +02:00
podman run -it -p 8080:8080 <container id>
2024-09-03 00:53:55 +02:00
2024-09-03 09:12:04 +02:00
### Run behind reverse proxy
2024-09-03 00:53:55 +02:00
2024-09-03 09:12:04 +02:00
A reverse proxy in front of placeany is recommended. An example
Caddyfile is available to make https "just work", but Nginx+certbot
will be equally fine.
2024-09-03 00:53:55 +02:00
2024-09-03 09:12:04 +02:00
## Podman tip: generate systemd files
Make sure to enable lingering user processes.
loginctl enable-linger $USER
Then, create and change directory to systemd.
mkdir -p .config/systemd/user
cd .config/systemd/user
Now, generate the systemd user service.
podman generate systemd --new -f -n placeany
Your container can now be enabled and started.