Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to shorten links or upload images #26

Closed
tehniemer opened this issue Aug 23, 2020 · 9 comments
Closed

Unable to shorten links or upload images #26

tehniemer opened this issue Aug 23, 2020 · 9 comments

Comments

@tehniemer
Copy link

I get errors when I try to shorten links or upload images, I am able to add links to collections though.

This is the error from the server logs when I try to upload an image

req: ***.***.**.*** POST /api/image,
req: ***.***.**.*** POST /api/image  5f427aa90a39630017365047 500 EXDEV: cross-device link not permitted, rename '/tmp/5UZfoKaIBM5ZIDvmBLD1t4Yq.jpg' -> '/var/data/anchr/ChxdP.jpg' Error: EXDEV: cross-device link not permitted, rename '/tmp/5UZfoKaIBM5ZIDvmBLD1t4Yq.jpg' -> '/var/data/anchr/ChxdP.jpg'

and the error when I try to shorten a link

req: ***.***.**.*** POST /api/shortlink,
res:  ***.***.**.*** POST /api/shortlink  5f427aa90a39630017365047 500 Something went wrong.Error: Request failed with status code 403

IP removed for privacy.

@muety
Copy link
Owner

muety commented Aug 23, 2020

This is caused by the fact that your /tmp and /var are on different file systems / partitions. I have to get that fixed somehow. Thanks for bringing it up. Quick fix would be to set your upload path to some directory within the same file system as /tmp.

EDIT: Short explanation here

@muety muety added the bug label Aug 23, 2020
@muety
Copy link
Owner

muety commented Aug 23, 2020

The link shortening problem might be a configuration issue. Can you please tell me:

  1. Which version of Anchr are you using (see package.json)
  2. What did you set ANCHR_GOOGLE_API_KEY to in your .env file?

@muety
Copy link
Owner

muety commented Aug 23, 2020

I just fixed the image upload problem (see #27) in version 1.3.3.

@tehniemer
Copy link
Author

I've forked your repo and used it to build the docker image, so it should be the version that's in the Dockerfile. Here's my docker-compose snippet. I disabled signup after I created my user. The API key came from the developers console.

## Anchr - Toolbox for tiny tasks on the internet, including bookmark collections, URL shortening and (encrypted) image uploads
  anchr:
    image: tehniemer/anchr:latest
    container_name: anchr
    restart: always
    build: ./
    networks:
      - proxy
      - database
    depends_on:
      - mongo
    security_opt:
      - no-new-privileges:true
#    ports:
#      - '$ANCHR_PORT:9000'
    volumes:
      - '$DOCKER_DIR/anchr:/app/data'
      - '$CLOUD_DIR/Anchr:/var/data/anchr'
    environment:
      PORT: 9000
      ANCHR_DB_HOST: $MONGO_HOST
      ANCHR_DB_PORT: 27017
      ANCHR_DB_NAME: $ANCHR_MONGO
      ANCHR_DB_USER: $ANCHR_MONGO
      ANCHR_DB_PASSWORD: $ANCHR_MONGO_PASS
      ANCHR_GOOGLE_API_KEY: $ANCHR_GOOGLE_API_KEY
      ANCHR_GOOGLE_CLIENT_ID: $ANCHR_GOOGLE_CLIENT_ID
      ANCHR_GOOGLE_SECRET: $ANCHR_GOOGLE_SECRET
      LISTEN_ADDR: 0.0.0.0
      ANCHR_ALLOW_SIGNUP: 'false'
    labels:
      - 'traefik.enable=true'
      ## HTTP Routers
      - 'traefik.http.routers.anchr-rtr.entrypoints=https'
      - 'traefik.http.routers.anchr-rtr.rule=HostHeader(`anchr.$DOMAINNAME`)'
      - 'traefik.http.routers.anchr-rtr.tls=true'
      ## Middlewares
#      - 'traefik.http.routers.anchr-rtr.middlewares=chain-no-auth@file' #No Authentication
#      - 'traefik.http.routers.anchr-rtr.middlewares=chain-basic-auth@file' #Basic Authentication
#      - 'traefik.http.routers.anchr-rtr.middlewares=chain-oauth@file' #Google OAuth 2.0
#      - 'traefik.http.routers.anchr-rtr.middlewares=chain-organizr@file' #Organizr Authentication
      - 'traefik.http.routers.anchr-rtr.middlewares=chain-authelia@file' #Authelia Authentication
      ## HTTP Services
      - 'traefik.http.routers.anchr-rtr.service=anchr-svc'
      - 'traefik.http.services.anchr-svc.loadbalancer.server.port=9000'

## MongoDB - A general purpose, document-based, distributed database
  mongo:
    image: mongo:3.4
    container_name: mongo
    restart: always
    networks:
      - database
    security_opt:
      - no-new-privileges:true
    volumes:
      - '$DOCKER_DIR/mongo/db:/data/db'
      - '$DOCKER_DIR/mongo/configdb:/data/configdb'
      - '$DOCKER_DIR/mongo-init.sh:/docker-entrypoint-initdb.d/mongo-init.sh:ro'
    environment:
      - MONGO_INITDB_ROOT_USERNAME=$MONGO_USER
      - MONGO_INITDB_ROOT_PASSWORD=$MONGO_PASS
      - MONGO_INITDB_DATABASE=$ANCHR_MONGO
      - DB_USER=$ANCHR_MONGO
      - DB_PASSWORD=$ANCHR_MONGO_PASS

@tehniemer
Copy link
Author

tehniemer commented Aug 23, 2020

Image upload is working in the 1.3.3, but not link shortening.

@muety
Copy link
Owner

muety commented Aug 23, 2020

Please check the version and make sure it's 1.3.3. If it's not, please pull and rebuild the Docker images.

Also, before running the Docker Compose command, don't forget to do source env.sh.

I'm pretty sure the shortlink problem is related to Google Safe Browse API. Maybe just try to disable it by setting ANCHR_GOOGLE_API_KEY=''. Everytime you change something in .env, you have to do the source command again.

@tehniemer
Copy link
Author

Disabling the Google API fixed the link shortening issue.

@muety
Copy link
Owner

muety commented Aug 23, 2020

Alright, so do you mind if I close this issue then?

@tehniemer
Copy link
Author

Seems to be fixed, close it up.

@muety muety closed this as completed Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants