BookStackApp / api-scripts

MIGRATED TO CODEBERG -- Examples of BookStack API scripts
https://codeberg.org/bookstack/api-scripts
MIT License
87 stars 22 forks source link

powershell-files-to-pages on localhost #15

Closed pabloruizsoria closed 7 months ago

pabloruizsoria commented 7 months ago

Hello,

I am trying bookstack on localhost in order to try if I can use this wonderful tool with our existing documentation.

In the files-to-pages.ps1 I have:

$baseUrl = "http://localhost:6875" # $env:BS_URL

$tokenId = "my_token_ID" #$env:BS_TOKEN_ID

$tokenSecret = "My_token_secret_ID" #$env:BS_TOKEN_SECRET

And in the docker-compose I have:

---
version: "2"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=http://localhost:6875
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=password
      - DB_DATABASE=bookstackapp
    volumes:
      - ./bookstack_app_data:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=password
      - TZ=Europe/Madrid
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=password
    volumes:
      - ./bookstack_db_data:/config
    restart: unless-stopped
  powershell:
    image: mcr.microsoft.com/powershell:latest
    volumes:
        - .:/app
    working_dir: /app
    command: "pwsh ./files-to-pages.ps1 1" # ["pwsh"]

I have the bookstack working but when I execute docker-compose up powershell Im getting this error


Attaching to bookstack_powershell_1
powershell_1    | Invoke-RestMethod: /app/files-to-pages.ps1:43
powershell_1    | Line |
powershell_1    |   43 |      Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body  …
powershell_1    |      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
powershell_1    |      | Cannot assign requested address
powershell_1    | Invoke-RestMethod: /app/files-to-pages.ps1:43
powershell_1    | Line |
powershell_1    |   43 |      Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body  …
powershell_1    |      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
powershell_1    |      | Cannot assign requested address
bookstack_powershell_1 exited with code 0```

I think powershell cannot communicate with locahost

Sorry for my bad English
pabloruizsoria commented 7 months ago

I just had to remove the port and set the relative IP inside the container universe