{"id":13611215,"url":"https://github.com/hauxir/imgpush","last_synced_at":"2025-04-09T06:13:49.553Z","repository":{"id":42184116,"uuid":"192221538","full_name":"hauxir/imgpush","owner":"hauxir","description":"Minimalist Self-hosted Image Service for user submitted images in your app ","archived":false,"fork":false,"pushed_at":"2024-05-17T12:43:10.000Z","size":75413,"stargazers_count":313,"open_issues_count":9,"forks_count":47,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T13:49:07.167Z","etag":null,"topics":["avatar-service","docker","hacktoberfest","image-api","image-hosting","image-uploader","imagehost","images","kubernetes","picture","selfhosted"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hauxir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-16T18:02:51.000Z","updated_at":"2025-03-12T05:27:23.000Z","dependencies_parsed_at":"2024-08-01T19:54:58.600Z","dependency_job_id":null,"html_url":"https://github.com/hauxir/imgpush","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauxir%2Fimgpush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauxir%2Fimgpush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauxir%2Fimgpush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauxir%2Fimgpush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hauxir","download_url":"https://codeload.github.com/hauxir/imgpush/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avatar-service","docker","hacktoberfest","image-api","image-hosting","image-uploader","imagehost","images","kubernetes","picture","selfhosted"],"created_at":"2024-08-01T19:01:52.918Z","updated_at":"2025-04-09T06:13:49.521Z","avatar_url":"https://github.com/hauxir.png","language":"Python","funding_links":[],"categories":["Python","Software","File Sharing and Synchronization","🚀 DevOps \u0026 Infrastructure"],"sub_categories":["File Transfer - Single-click \u0026 Drag-n-drop Upload","E-commerce"],"readme":"\u003cimg width=\"246\" alt=\"Screenshot 2019-06-19 at 17 56 29\" src=\"https://user-images.githubusercontent.com/2439255/59781204-a23da780-92bb-11e9-99c5-490feecca557.png\"\u003e\nMinimalist Self-hosted Image Service for user submitted images in your app (e.g. avatars).\n\n## Features\n- One simple API endpoint for uploading images\n- Automatic Conversion to an image format of your choice\n- Automatic resizing to any size of your liking\n- Built-in Rate limiting\n- Built-in Allowed Origin whitelisting\n- Liveness API \n\n## Usage\nUploading an image:\n```bash\n\u003e curl -F 'file=@/some/file.jpg' http://some.host\n{\"filename\":\"somename.png\"}\n```\nUploading an image by URL:\n```bash\n curl -X POST -H \"Content-Type: application/json\" -d '{\"url\": \"\u003cSOME_URL\u003e\"}'  http://some.host\n ```\nFetching a file in a specific size(e.g. 320x240):\n```\nhttp://some.host/somename.png?w=320\u0026h=240\n```\nreturns the image cropped to the desired size\n\n## Running\nimgpush requires docker\n\n```bash\ndocker run -v \u003cPATH TO STORE IMAGES\u003e:/images -p 5000:5000 hauxir/imgpush:latest\n```\n\n### Kubernetes\n\n\u003e This is fully optional and is only needed if you want to run imgpush in Kubernetes.\n\nIf you want to deploy imgpush in Kubernetes, there is an example deployment available in the Kubernetes directory.\nIn case you do not have a running Kubernetes cluster yet, you can use [Minikube](https://kubernetes.io/docs/setup/) to setup a local single-node Kubernetes cluster.\nOtherwise you can just use your existing cluster.\n\n1. Verify that your cluster works:\n```\n$ kubectl get pods\n# Should return without an error, maybe prints information about some deployed pods.\n```\n\n2. Apply the `kubernetes/deployment-example.yaml` file:\n```\n$ kubectl apply -f kubernetes/deployment-example.yaml\nnamespace/imgpush created\ndeployment.apps/imgpush created\npersistentvolumeclaim/imgpush created\nservice/imgpush created\n```\n\n3. It will take a moment while your Kubernetes downloads the current imgpush image.\n4. Verify that the deployment was successful:\n```\n$ kubectl -n imgpush get deployments.\nNAME      READY   UP-TO-DATE   AVAILABLE   AGE\nimgpush   1/1     1            1           3m41s\n\n$ kubectl -n imgpush get svc\nNAME      TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)    AGE\nimgpush   ClusterIP   10.10.10.41   \u003cnone\u003e        5000/TCP   3m57s\n```\n\n5. When the deployment is finished, the READY column should be `1/1`.\n6. Afterwards you can forward the port to your local machine and upload an image via your webbrowser (visit http://127.0.0.1:5000/).\n```\n$ kubectl -n imgpush port-forward service/imgpush 5000\nForwarding from 127.0.0.1:5000 -\u003e 5000\nHandling connection for 5000\nHandling connection for 5000\nHandling connection for 5000\nHandling connection for 5000\n```\n\n7. To expose imgpush to the internet you need to configure an [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/). The exact configuration depends on you cluster but you can find an example in the `kubernetes/deployment-example.yaml` file that you can adapt to your setup.\n\n\n### Liveness\n\nimgpush provides the `/liveness` endpoint that always returns `200 OK` that you can use for docker Healthcheck and kubernetes liveness probe. \n\nFor Docker, as `curl` is install in the image : \n\n```yaml\nhealthcheck:\n    start_period: 0s\n    test: ['CMD-SHELL', 'curl localhost:5000/liveness -s -f -o /dev/null || exit 1']\n    interval: 30s\n```\n\nFor Kubernetes\n```yaml\nlivenessProbe:\n    httpGet:\n    path: /liveness\n    port: 5000            \n    initialDelaySeconds: 5\n    periodSeconds: 30\n```\n\n\n\n## Configuration\n| Setting  | Default value | Description |\n| ------------- | ------------- |------------- |\n| OUTPUT_TYPE  | Same as Input file | An image type supported by imagemagick, e.g. png or jpg |\n| MAX_SIZE_MB  | \"16\"  | Integer, Max size per uploaded file in megabytes |\n| MAX_UPLOADS_PER_DAY  | \"1000\"  | Integer, max per IP address |\n| MAX_UPLOADS_PER_HOUR  | \"100\"  | Integer, max per IP address |\n| MAX_UPLOADS_PER_MINUTE  | \"20\"  | Integer, max per IP address |\n| ALLOWED_ORIGINS  | \"['*']\"  | array of domains, e.g ['https://a.com'] |\n| VALID_SIZES  | Any size  | array of integers allowed in the h= and w= parameters, e.g \"[100,200,300]\". You should set this to protect against being bombarded with requests! |\n| NAME_STRATEGY  | \"randomstr\"  | `randomstr` for random 5 chars, `uuidv4` for UUIDv4 |\n| NUDE_FILTER_MAX_THRESHOLD  | None  | max unsafe value returned from nudenet library(https://github.com/notAI-tech/NudeNet), range is from 0-0.99. Blocks nudity from being uploaded. |\n\nSetting configuration variables is all set through env variables that get passed to the docker container.\n### Example:\n```\ndocker run -e ALLOWED_ORIGINS=\"['https://a.com', 'https://b.com']\" -s -v \u003cPATH TO STORE IMAGES\u003e:/images -p 5000:5000 hauxir/imgpush:latest\n```\nor to quickly deploy it locally, run\n```\ndocker-compose up -d\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauxir%2Fimgpush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhauxir%2Fimgpush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauxir%2Fimgpush/lists"}