prest/prest

Documentation quick start scaffold not working for me

alisonjr opened this issue · 16 comments

when trying to use the application via docker-compose I can't create the minimum structure for jwt

Command:

 docker-compose exec prest prestd migrate up auth --url "postgres://prest:prest@postgres:5432/prest?sslmode=disable&sslcert=&sslkey=&sslrootcert="

Console messages:

2023/01/31 21:16:37 [warning] file './prest.toml' not found, falling back to default settings
2023/01/31 21:16:37 [warning] read env config error: Config File "prest" Not Found in "[/app]"
2023/01/31 21:16:37 [warning]
You are using v1 of prestd configs, please migrate to v2.

v1 will be deprecated soon.

View more at https://docs.prestd.com/prestd/deployment/server-configuration
pq: syntax error at or near "%"Error: pq: syntax error at or near "%"
Usage:
  prestd migrate up auth [flags]

Flags:
  -h, --help   help for auth

Global Flags:
      --path string   Migrations directory
      --url string    Database driver url (default "postgres://prest:prest@postgres:5432/prest?sslmode=disable&sslcert=&sslkey=&sslrootcert=")

pq: syntax error at or near "%"

I'm going to do a simple test, I don't want to make several configurations in files and etc.

Docker compose file:

version: "3"
services:
  postgres:
    image: postgres
    volumes:
      - "./data/postgres:/var/lib/postgresql/data"
    environment:
      - POSTGRES_USER=prest
      - POSTGRES_DB=prest
      - POSTGRES_PASSWORD=prest
    ports:
      - "5432:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready", "-U", "prest"]
      interval: 30s
      retries: 3
  prest:
    # use latest build - analyze the risk of using this version in production
    image: prest/prest:v1
    links:
      - "postgres:postgres"
    environment:
      - PREST_DEBUG=true
      - PREST_AUTH_ENABLED=false
      - PREST_PG_HOST=postgres
      - PREST_PG_USER=prest
      - PREST_PG_PASS=prest
      - PREST_PG_DATABASE=prest
      - PREST_PG_PORT=5432
      - PREST_SSL_MODE=disable
      - PREST_CACHE_ENABLED=false
      - PREST_CACHE=false
    depends_on:
      postgres:
        condition: service_healthy
    ports:
      - "3000:3000"

I have same issue on Ubuntu 22.04, but donot have this issue on WSL2.

Update: v1.1 workable.

@bulayee v1.1 is the docker image tag?

Now it worked for me. But I needed to change the docker image version.
I following this tutorial https://docs.prestd.com/prestd/docs/#test-using-docker
the only difference is after downloading the docker-compose.yml file, I change the prest image version of image: prest/prest for image: prest/prest:v1.1. And I changed the image version before starting de stack, that is the second instruction of this tutorial docker-compose up.

With this simple configuration it Worked!!

@alisonjr if you try with prest/prest:latest, it doesn't work?

@arxdsilva we might have a problem on the current image, then =/

@vmesel If I try with prest/prest:latest the command docker-compose exec prest prestd migrate up auth does not work. But I think that if create prest_users table manually will work. Is possible that the problem is only on the migrate up auth command

I try with docker on Windows only (docker desktop)

leaving recorded the conversation I had in private with @alisonjr

he managed to follow the tutorial with version v1.1 (generated 1 year ago), is there any bug from there to here

we need to revise the tutorial for the new version

tried locally, so from the error It seams to be related to the one I had here: #767

So it is probably also related to #762, will have a look at them.

tried locally, so from the error It seams to be related to the one I had here: #767

So it is probably also related to #762, will have a look at them.

@arxdsilva were you able to look at this problem?

@avelino I've created a branch to work on this but havent solved yet, will open a PR to fix the problems that I already found.

@alisonjr could you help us by testing the "dev" version of the docker image and see if it works, working we generated release with this hotfix

@avelino I already tested locally, as I stated in the PR, this issue still isnt fixed but I've addressed related errors that were found while trying to fix this.

@arxdsilva generate new version pls

@alisonjr @bulayee please verify that it was fixed in v1.2.3, this was just merged.