AlphaNecron / Void

Fast and elegant file hosting service.
MIT License
218 stars 13 forks source link

Void doesn't work #26

Closed xeorion closed 2 years ago

xeorion commented 2 years ago

Hello, I installed void using docker-compose.

First I created a stack with docker compose in my portainer instance :

version: '3' services: postgres: image: postgres environment:

Then, on the following folder (/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/config.toml:/void/config.toml), I created a config.toml :

[core] secure = false # Whether to use https or not secret = 'ThisIsTheVerySecretPassword' # The secret used to sign cookie host = '192.168.1.25' # The host Void should run on port = 3001 # The port Void should run on database_url = 'postgres://postgres:passwd_postgres@localhost:5432/portgres' # PostgreSQL database url

[bot] enabled = false # Whether to enable the bot or not prefix = '&' # Bot's prefix token = '' # Bot's token admin = [''] # Admin ids log_channel = '' # The channel where logs are sent, leave blank to disable logging default_uid = 1 # The default user id used to shorten and upload hostname = 'example.com' # The hostname shortened urls should use in Twilight

[shortener] allow_vanity = true # Whether to allow vanity urls or not length = 6 # Slug length route = '/go' # Route to serve shortened urls

[uploader] raw_route = '/r' # Route to serve raw contents length = 6 # Slug length directory = './uploads' # The directory where images are stored max_size = 104857600 # Max upload size (users only), in bytes blacklisted = ['exe'] # Blacklisted file extensions (users only)

I just edited the core part, just to access to the UI. For information, my docker instance has 192.168.1.25 as local IP adress.

The log of the container named "void_file_void_1" is :

yarn run v1.22.17 $ ts-node --compiler-options "{\"module\":\"commonjs\"}" server.ts 11:14:53 AM INFO/CONFIG Reading config file Error: EISDIR: illegal operation on a directory, read at Object.readSync (fs.js:617:3) at tryReadSync (fs.js:382:20) at readFileSync (fs.js:419:19) at readConfig (/void/src/lib/configReader.ts:40:29) at Object. (/void/src/lib/config.ts:4:47) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Module.m._compile (/void/node_modules/ts-node/src/index.ts:1475:23) at Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Object.require.extensions. [as .ts] (/void/node_modules/ts-node/src/index.ts:1478:12) at Module.load (internal/modules/cjs/loader.js:950:32) { errno: -21, syscall: 'read', code: 'EISDIR' } error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The log of the container "void_file_postgres_1" is on this site .

After all, I cannot access to the webUI on 192.128.1.25:3001 and I need some help please.

AlphaNecron commented 2 years ago

Double check whether the disk is r/w?

xeorion commented 2 years ago

How do I do that ?

AlphaNecron commented 2 years ago

Do stat . or create a random file with normal privilege on every folder you provided in the compose file.

xeorion commented 2 years ago

Sorry but I really don't understand what I have to do. I'm a newbie at this. Sorry to waste your time.

AlphaNecron commented 2 years ago

Can you edit your config file in a text editor with normal user?

xeorion commented 2 years ago

I made my research and type the command, that is the answer of stat :

usr@nas : ~# stat /srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/ Fichier : /srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/ Taille : 4096 Blocs : 8 Blocs d'E/S : 4096 répertoire Périphérique : 821h/2081d Inœud : 67633153 Liens : 6 Accès : (0777/drwxrwxrwx) UID : ( 0/ root) GID : ( 0/ root) Accès : 2022-05-06 13:10:20.895070811 +0200 Modif. : 2022-05-06 13:10:05.357434967 +0200 Changt : 2022-05-07 10:37:22.248287513 +0200 Créé : -

Sorry, it's french.

AlphaNecron commented 2 years ago

Hmm, try placing all the files and the compose file in the same folder?

xeorion commented 2 years ago

I change this :

version: '3'
services:
postgres:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=psswd_postgres
- POSTGRES_DATABASE=postgres
volumes:
- /srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/pg_data:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 5s
retries: 5
void:
image: ghcr.io/alphanecron/void/void:v0
ports:
- '3001:3000'
restart: unless-stopped
volumes:
- '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/uploads:/void/uploads'
- '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/public:/void/public'
- '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/config.toml:/void/config.toml'
depends_on:
- 'postgres'
volumes:
pg_data:

To this :

version: '3'
services:
postgres:
image: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=psswd_postgres
- POSTGRES_DATABASE=postgres
volumes:
- /srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/:/var/lib/postgresql/data
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 5s
retries: 5
void:
image: ghcr.io/alphanecron/void/void:v0
ports:
- '3001:3000'
restart: unless-stopped
volumes:
- '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/:/void/uploads'
- '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/:/void/public'
- '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/:/void/config.toml'
depends_on:
- 'postgres'
volumes:
pg_data:

Is that correct ?

AlphaNecron commented 2 years ago

Keep the default schema, place docker-compose.yml, public, uploads and config.toml within a folder.

AlphaNecron commented 2 years ago

Or you can use the latter config, volumes for postgres image should not be altered.

xeorion commented 2 years ago

Is this docker compose correct ? I don't understand what is wrong on my installation.

version: '3'
services:
  postgres:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=CYrv8PWn36Sb85La87XvpK
      - POSTGRES_DATABASE=postgres
    volumes:
      - /srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/pg_data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 10s
      timeout: 5s
      retries: 5
  void:
    image: ghcr.io/alphanecron/void/void:v0
    ports:
      - '3001:3000'
    restart: unless-stopped
    volumes:
      - '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/uploads/:/void/uploads'
      - '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/public/:void/public'
      - '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/config.toml/:/void/config.toml'
    depends_on:
      - 'postgres'
volumes:
  pg_data:
xeorion commented 2 years ago

Can we call each other us on discord ?

AlphaNecron commented 2 years ago

Try this docker-compose.yml:


version: '3'
services:
  postgres:
    image: postgres
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=CYrv8PWn36Sb85La87XvpK
      - POSTGRES_DATABASE=postgres
    volumes:
      - pg_data:/var/lib/postgresql/data
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 10s
      timeout: 5s
      retries: 5
  void:
    image: ghcr.io/alphanecron/void/void:v0
    ports:
      - '3001:3000'
    restart: unless-stopped
    volumes:
      - '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/uploads:/void/uploads'
      - '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/public:/void/public'
      - '/srv/dev-disk-by-uuid-cc443bd6-ba0c-41aa-8bab-c22c9ece341a/void/config.toml:/void/config.toml'
    depends_on:
      - 'postgres'
volumes:
  pg_data:

Please check whether config.toml does exist in the specified path.

xeorion commented 2 years ago

Just tried it but always the same problem : the webUI is not working and there is the same problem on the logs :

yarn run v1.22.17
$ ts-node --compiler-options "{\"module\":\"commonjs\"}" server.ts
 12:47:23 PM  INFO/CONFIG  Reading config file
Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:617:3)
    at tryReadSync (fs.js:382:20)
    at readFileSync (fs.js:419:19)
    at readConfig (/void/src/lib/configReader.ts:40:29)
    at Object.<anonymous> (/void/src/lib/config.ts:4:47)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Module.m._compile (/void/node_modules/ts-node/src/index.ts:1475:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Object.require.extensions.<computed> [as .ts] (/void/node_modules/ts-node/src/index.ts:1478:12)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  errno: -21,
  syscall: 'read',
  code: 'EISDIR'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

And I have a question, in the config.toml file, is this line correct ? database_url = 'postgres://postgres:passwd@localhost:5432/portgres' # PostgreSQL database url'

Of course, I relpace passwd by the database password written on the docker-compose file.

AlphaNecron commented 2 years ago

That line should not be modified when using Docker.

AlphaNecron commented 2 years ago

DM me on Discord for further discussion: AlphaNecron#3312.

xeorion commented 2 years ago

You don't allow friend invitation on discord :/

xeorion commented 2 years ago

Invite me if you want