spinspire / pocketbase-sveltekit-starter

a starter project to build a SvelteKit frontend with PocketBase backend
MIT License
363 stars 62 forks source link

404 Not Found #6

Closed ghost closed 1 year ago

ghost commented 1 year ago

docker compose logs -f pss

infra-pss-1 | infra-pss-1 |
infra-pss-1 | / /\ | | | |) infra-pss-1 | //--\ || || _ , built with Go 1.19.4 infra-pss-1 | infra-pss-1 | mkdir /app/tmp infra-pss-1 | watching . infra-pss-1 | watching hooks infra-pss-1 | watching pb_migrations infra-pss-1 | !exclude tmp infra-pss-1 | building... infra-pss-1 | !exclude .cache infra-pss-1 | go: downloading github.com/pocketbase/pocketbase v0.10.3 infra-pss-1 | go: downloading github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198 infra-pss-1 | go: downloading github.com/fatih/color v1.13.0 infra-pss-1 | go: downloading github.com/mattn/go-sqlite3 v1.14.16 infra-pss-1 | go: downloading github.com/pocketbase/dbx v1.8.0 infra-pss-1 | go: downloading github.com/AlecAivazis/survey/v2 v2.3.6 infra-pss-1 | go: downloading github.com/spf13/cobra v1.6.1 infra-pss-1 | go: downloading github.com/dop251/goja v0.0.0-20221118162653-d4bf6fde1b86 infra-pss-1 | go: downloading github.com/dop251/goja_nodejs v0.0.0-20221009164102-3aa5028e57f6 infra-pss-1 | go: downloading github.com/go-ozzo/ozzo-validation/v4 v4.3.0 infra-pss-1 | go: downloading github.com/spf13/cast v1.5.0 infra-pss-1 | go: downloading golang.org/x/oauth2 v0.3.0 infra-pss-1 | go: downloading github.com/mattn/go-colorable v0.1.13 infra-pss-1 | go: downloading github.com/mattn/go-isatty v0.0.16 infra-pss-1 | go: downloading golang.org/x/sync v0.1.0 infra-pss-1 | go: downloading golang.org/x/crypto v0.4.0 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go v1.44.165 infra-pss-1 | go: downloading github.com/disintegration/imaging v1.6.2 infra-pss-1 | go: downloading github.com/gabriel-vasile/mimetype v1.4.1 infra-pss-1 | go: downloading gocloud.dev v0.27.0 infra-pss-1 | go: downloading github.com/domodwyer/mailyak/v3 v3.3.4 infra-pss-1 | go: downloading golang.org/x/net v0.4.0 infra-pss-1 | go: downloading github.com/ganigeorgiev/fexpr v0.1.1 infra-pss-1 | go: downloading github.com/spf13/pflag v1.0.5 infra-pss-1 | go: downloading github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 infra-pss-1 | go: downloading golang.org/x/term v0.3.0 infra-pss-1 | go: downloading github.com/valyala/fasttemplate v1.2.2 infra-pss-1 | go: downloading golang.org/x/time v0.3.0 infra-pss-1 | go: downloading github.com/golang-jwt/jwt/v4 v4.4.3 infra-pss-1 | go: downloading github.com/dlclark/regexp2 v1.7.0 infra-pss-1 | go: downloading golang.org/x/text v0.5.0 infra-pss-1 | go: downloading golang.org/x/sys v0.3.0 infra-pss-1 | go: downloading github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d infra-pss-1 | go: downloading golang.org/x/image v0.2.0 infra-pss-1 | go: downloading go.opencensus.io v0.24.0 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.29.6 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.46 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2 v1.17.3 infra-pss-1 | go: downloading github.com/aws/smithy-go v1.13.5 infra-pss-1 | go: downloading github.com/google/wire v0.5.0 infra-pss-1 | go: downloading github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d infra-pss-1 | go: downloading github.com/go-sourcemap/sourcemap v2.1.3+incompatible infra-pss-1 | go: downloading github.com/valyala/bytebufferpool v1.0.0 infra-pss-1 | go: downloading golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 infra-pss-1 | go: downloading google.golang.org/grpc v1.51.0 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.18 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.22 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/config v1.18.7 infra-pss-1 | go: downloading github.com/googleapis/gax-go/v2 v2.7.0 infra-pss-1 | go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da infra-pss-1 | go: downloading github.com/jmespath/go-jmespath v0.4.0 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/credentials v1.13.7 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/sso v1.11.28 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.11 infra-pss-1 | go: downloading github.com/aws/aws-sdk-go-v2/service/sts v1.17.7 infra-pss-1 | go: downloading google.golang.org/api v0.105.0 infra-pss-1 | go: downloading google.golang.org/protobuf v1.28.1 infra-pss-1 | go: downloading google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 infra-pss-1 | go: downloading github.com/golang/protobuf v1.5.2 infra-pss-1 | running... infra-pss-1 | !exclude pbdata infra-pss-1 | > Server started at: http://0.0.0.0:8090 infra-pss-1 | - REST API: http://0.0.0.0:8090/api/ infra-pss-1 | - Admin UI: http://0.0.0.0:8090//

ghost commented 1 year ago

Do I need to build the frontend after running docker-compose overridden? or docker-compose should also take care of the frontend build and run?

ghost commented 1 year ago

or maybe I should run another container for the frontend build/dev

Dockerfile:

FROM node:current-alpine

RUN npm install -g pnpm RUN mkdir -p /home/node/app WORKDIR /home/node/app COPY package*.json pnpm-lock.yaml ./ RUN pnpm install

ENV HOST=0.0.0.0 EXPOSE 5173:5173 CMD pnpm dev

jkdoshi commented 1 year ago

I'm sorry but this is not a well written issue report.

I have no idea what the problem is, therefore I don't know how to help you. Can you please replace the overly long description of the issue with something short, to-the-point and logical?

Do I need to build the frontend after running docker-compose overridden? or docker-compose should also take care of the frontend build and run?

In order for npm run dev in frontend to work, the backend must already be running. Also, the frontend must be correctly pointed to backend using the .env settings. All this is stated in the 3 README files.

Please follow the 3 README files and reopen the issue with a short-and-sweet description of the issues/setup.

jkdoshi commented 1 year ago

Please also see issue #7 and #8

jkdoshi commented 1 year ago

Yes, you do have to build SvelteKit app before you run PocketBase IF you want to serve the SvelteKit app statically with PocketBase. For this do npm run build in SvelteKit/frontend and then either copy frontend/build to backend/pb_public or run PocketBase with --publicDir ../frontend/build option.

But if you just want to use PocketBase for backend (and not serve the frontend), then you can run frontend separately as npm run dev after making sure frontend/.env has the correct setting for PUBLIC_BACKEND.