This commit is contained in:
rubikscraft 2022-02-25 17:13:53 +01:00
parent 4e897e9245
commit 8bbb708126
No known key found for this signature in database
GPG key ID: 1463EBE9200A5CD4
6 changed files with 13916 additions and 15 deletions

2
.vscode/tasks.json vendored
View file

@ -43,7 +43,7 @@
{
"type": "shell",
"label": "Start postgres",
"command": "podman-compose stop; podman-compose up",
"command": "podman-compose -f ./dev.docker-compose.yml stop; podman-compose -f ./dev.docker-compose.yml up",
"options": {
"cwd": "./support"
},

View file

@ -15,9 +15,56 @@ It works like a hybrid between imgur and pastebin.
Right now this software is still in beta, and many things are still missing, or will be changed in the future.
But it does function, so feel free to give it a try.
## Demo
You can view a live demo here: <https://imagur.rubikscraft.nl>
The images are deleted every five minutes, and the max filesize is 16MB. But it should give you an indication of how it works.
## Running
To start Imagur easily, you can clone the repository and then run `docker-compose up -d`. It will then be running on port `8080`.
You easily run this service yourself via Docker. Here is an example docker-compose file:
```yaml
version: "3"
services:
imagur:
image: ghcr.io/rubikscraft/imagur:latest
container_name: imagur
ports:
- "8080:8080"
environment:
# IMAGUR_HOST: '0.0.0.0'
# IMAGUR_PORT: 8080
IMAGUR_DB_HOST: imagur_postgres
# IMAGUR_DB_PORT: 5432
# IMAGUR_DB_USER: imagur
# IMAGUR_DB_PASSWORD: imagur
# IMAGUR_DB_NAME: imagur
# IMAGUR_ADMIN_USERNAME: imagur
# IMAGUR_ADMIN_PASSWORD: imagur
# IMAGUR_JWT_SECRET: CHANGE_ME
# IMAGUR_JWT_EXPIRY: 1d
# IMAGUR_MAX_FILE_SIZE: 128000000
# IMAGUR_STATIC_FRONTEND_ROOT: "/imagur/frontend/dist"
restart: unless-stopped
imagur_postgres:
image: postgres:11-alpine
container_name: imagur_postgres
environment:
POSTGRES_DB: imagur
POSTGRES_PASSWORD: imagur
POSTGRES_USER: imagur
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data:
```
## Configuration

View file

@ -1,4 +1,4 @@
import { Module, OnModuleInit } from '@nestjs/common';
import { Logger, Module, OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { ImageDBModule } from '../../collections/imagedb/imagedb.module';
import Config from '../../env';
import { DemoManagerService } from './demomanager.service';
@ -7,14 +7,25 @@ import { DemoManagerService } from './demomanager.service';
imports: [ImageDBModule],
providers: [DemoManagerService],
})
export class DemoManagerModule implements OnModuleInit {
export class DemoManagerModule implements OnModuleInit, OnModuleDestroy {
private readonly logger = new Logger('DemoManagerModule');
constructor(private readonly demoManagerService: DemoManagerService) {}
private interval: NodeJS.Timeout;
onModuleInit() {
if (Config.demo.enabled) {
setInterval(this.demoManagerService.execute, Config.demo.interval);
this.logger.log('Demo mode enabled');
this.interval = setInterval(
this.demoManagerService.execute.bind(this.demoManagerService),
Config.demo.interval,
);
}
}
onModuleDestroy() {
if (this.interval) clearInterval(this.interval);
}
}

View file

@ -1,5 +1,8 @@
FROM node:16-alpine
# Sorry for the humongous docker container this generates
# Maybe I'll trim it down some day
ADD . /imagur
WORKDIR /imagur

View file

@ -1,7 +1,7 @@
version: "3"
services:
imagur:
image: test #ghcr.io/rubikscraft/imagur:latest
image: ghcr.io/rubikscraft/imagur:latest
container_name: imagur
ports:
- "8080:8080"

13858
yarn.lock

File diff suppressed because it is too large Load diff