mirror of
https://github.com/CaramelFur/Picsur.git
synced 2026-07-13 19:32:29 +02:00
add documentation and docker
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
**/node_modules
|
||||
dist
|
||||
**/dist
|
||||
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
support
|
||||
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM node:16-alpine
|
||||
|
||||
ADD . /imagur
|
||||
WORKDIR /imagur
|
||||
|
||||
RUN yarn install --frozen-lockfile
|
||||
|
||||
WORKDIR /imagur/shared
|
||||
RUN yarn build
|
||||
|
||||
WORKDIR /imagur/frontend
|
||||
RUN yarn build
|
||||
|
||||
WORKDIR /imagur/backend
|
||||
RUN yarn build
|
||||
|
||||
CMD ["yarn", "start:prod"]
|
||||
|
||||
37
README.md
37
README.md
@@ -1,3 +1,40 @@
|
||||
# Imagur
|
||||
|
||||
> Totally not an imgur clone
|
||||
|
||||
I couldn't really find any open source project that allowed you to easily host images. So I decided to create one.
|
||||
|
||||
It works like a hybrid between imgur and pastebin.
|
||||
|
||||
## Beta
|
||||
|
||||
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.
|
||||
|
||||
## 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`.
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure a couple different things using environment variables. Here is the current list with their default values:
|
||||
|
||||
```txt
|
||||
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"
|
||||
```
|
||||
|
||||
@@ -3,34 +3,39 @@ import { fileURLToPath } from 'url';
|
||||
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../');
|
||||
|
||||
const Config = {
|
||||
host: process.env.IMAGUR_HOST || '0.0.0.0',
|
||||
port: process.env.IMAGUR_PORT || 8080,
|
||||
database: {
|
||||
host: process.env.DB_HOST ?? 'localhost',
|
||||
port: process.env.DB_PORT ? parseInt(process.env.DB_PORT) : 5432,
|
||||
username: process.env.DB_USERNAME ?? 'imagur',
|
||||
password: process.env.DB_PASSWORD ?? 'imagur',
|
||||
database: process.env.DB_DATABASE ?? 'imagur',
|
||||
host: process.env.IMAGUR_DB_HOST ?? 'localhost',
|
||||
port: process.env.IMAGUR_DB_PORT
|
||||
? parseInt(process.env.IMAGUR_DB_PORT)
|
||||
: 5432,
|
||||
username: process.env.IMAGUR_DB_USERNAME ?? 'imagur',
|
||||
password: process.env.IMAGUR_DB_PASSWORD ?? 'imagur',
|
||||
database: process.env.IMAGUR_DB_DATABASE ?? 'imagur',
|
||||
},
|
||||
defaultAdmin: {
|
||||
username: process.env.DEFAULT_ADMIN_USERNAME ?? 'admin',
|
||||
password: process.env.DEFAULT_ADMIN_PASSWORD ?? 'admin',
|
||||
username: process.env.IMAGUR_ADMIN_USERNAME ?? 'admin',
|
||||
password: process.env.IMAGUR_ADMIN_PASSWORD ?? 'admin',
|
||||
},
|
||||
jwt: {
|
||||
secret: process.env.JWT_SECRET ?? 'CHANGE_ME',
|
||||
expiresIn: process.env.JWT_EXPIRES_IN ?? '1d',
|
||||
secret: process.env.IMAGUR_JWT_SECRET ?? 'CHANGE_ME',
|
||||
expiresIn: process.env.IMAGUR_JWT_EXPIRES_IN ?? '1d',
|
||||
},
|
||||
uploadLimits: {
|
||||
fieldNameSize: 128,
|
||||
fieldSize: 1024,
|
||||
fields: 16,
|
||||
files: 16,
|
||||
fileSize: process.env.MAX_FILE_SIZE
|
||||
? parseInt(process.env.MAX_FILE_SIZE)
|
||||
fileSize: process.env.IMAGUR_MAX_FILE_SIZE
|
||||
? parseInt(process.env.IMAGUR_MAX_FILE_SIZE)
|
||||
: 128000000,
|
||||
},
|
||||
static: {
|
||||
packageRoot: packageRoot,
|
||||
frontendRoot:
|
||||
process.env.STATIC_FRONTEND_ROOT ?? join(packageRoot, '../frontend/dist'),
|
||||
process.env.IMAGUR_STATIC_FRONTEND_ROOT ??
|
||||
join(packageRoot, '../frontend/dist'),
|
||||
backendRoutes: ['i', 'api'],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AppModule } from './app.module';
|
||||
import * as multipart from 'fastify-multipart';
|
||||
import { MainExceptionFilter } from './layers/http-exception/http-exception.filter';
|
||||
import { SuccessInterceptor } from './layers/success/success.interceptor';
|
||||
import Config from './env';
|
||||
|
||||
async function bootstrap() {
|
||||
const fastifyAdapter = new FastifyAdapter();
|
||||
@@ -18,12 +19,12 @@ async function bootstrap() {
|
||||
|
||||
const app = await NestFactory.create<NestFastifyApplication>(
|
||||
AppModule,
|
||||
fastifyAdapter
|
||||
fastifyAdapter,
|
||||
);
|
||||
app.useGlobalFilters(new MainExceptionFilter());
|
||||
app.useGlobalInterceptors(new SuccessInterceptor());
|
||||
app.useGlobalPipes(new ValidationPipe({ disableErrorMessages: true }));
|
||||
await app.listen(3000);
|
||||
await app.listen(Config.port, Config.host);
|
||||
}
|
||||
|
||||
bootstrap().catch(console.error);
|
||||
|
||||
38
docker-compose.yml
Normal file
38
docker-compose.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
version: "3"
|
||||
services:
|
||||
imagur:
|
||||
build: .
|
||||
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:
|
||||
@@ -1 +1 @@
|
||||
/home/rubikscraft/Documents/Projects/Imagur/Imagur-Monorepo/branding/logo
|
||||
../../../branding/logo/
|
||||
21
workspace.code-workspace
Normal file
21
workspace.code-workspace
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"name": "shared",
|
||||
"path": "shared"
|
||||
},
|
||||
{
|
||||
"name": "backend",
|
||||
"path": "backend"
|
||||
},
|
||||
{
|
||||
"name": "frontend",
|
||||
"path": "frontend"
|
||||
},
|
||||
{
|
||||
"name": "Imagur-Monorepo",
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
Reference in New Issue
Block a user