• Ryaina [she/her]M
    ·
    3 years ago

    insted of running a local backend in theory, you can edit /src/env.ts

    https://git.chapo.chat/hexbear-collective/hexbear-frontend/src/branch/main/src/env.ts

    to point the api to a working backend.

    Currently, that location is always trying to point to the same url as the site but you could use either the dev site or even the live site if you really wanted to. The API doesn't care.

    pinging @vertexarray so she sees this too.

    • bottech [he/him]
      hexagon
      ·
      edit-2
      3 years ago

      When i proposed it she claimed that she doesnt recommend it as a development workflow

      • Ryaina [she/her]M
        ·
        edit-2
        3 years ago

        In general, it's probably not the best but getting a working database and local backend is a lot to ask of someone who is only working on the frontend anyway.

        We do have a dev site you can point to instead of the live site. that may be preferable so that you can test making posts and comments etc. Ask in the matrix room (linked in the sidebar) for the dev url.

        • bottech [he/him]
          hexagon
          ·
          3 years ago

          Could you show me how should i modify env.ts to make it connect with the dev site?

          • Ryaina [she/her]M
            ·
            3 years ago

            simply change the three constants that are exported host, port, and wsUri to point to the desired URL

              • Ryaina [she/her]M
                ·
                3 years ago

                ah, you may also need to edit

                the hostname function....

                https://git.chapo.chat/hexbear-collective/hexbear-frontend/src/branch/main/src/utils.ts#L1093

                • Ryaina [she/her]M
                  ·
                  3 years ago

                  Actualy, sorry

                  the API definition

                  https://git.chapo.chat/hexbear-collective/hexbear-frontend/src/branch/main/src/utils.ts#L1241

                • bottech [he/him]
                  hexagon
                  ·
                  3 years ago

                  I dont know exactly how to do that, could you just send me how exactly the files should look?

  • vertexarray [any]
    ·
    3 years ago

    Gotta run a local backend too, as well as the local database. For the backend, using docker will make it easier to get running but use more resources.

    • bottech [he/him]
      hexagon
      ·
      3 years ago

      I dont know how to do that, wouldnt it be easier to have my frontend connect to the server?

      • vertexarray [any]
        ·
        3 years ago

        I took a second to tool around with connecting my local frontend to the dev server, and it seems like it sort of works, but loading comments and making accounts didn't work. Can't recommend it as a development workflow.

        • bottech [he/him]
          hexagon
          ·
          3 years ago

          Alright then, could you help me set up local backend?

            • bottech [he/him]
              hexagon
              ·
              3 years ago

              Ok, so i followed the instructions, but when i run cargo run on the backend i get FATAL: password authentication failed for user "lemmy"

                      • vertexarray [any]
                        ·
                        3 years ago

                        It looks like you can just do ./db-init.sh in a terminal in the server directory

                        • bottech [he/him]
                          hexagon
                          ·
                          edit-2
                          3 years ago

                          FATAL: Peer authentication failed for user "postgres"

                          Also there wasnt server directory, that file was in scripts

                          • vertexarray [any]
                            ·
                            3 years ago

                            Hmm, I didn't encounter that on my end. I'm not on Linux so it might be an OS difference.

                            • bottech [he/him]
                              hexagon
                              ·
                              3 years ago

                              Which backend should i use?

                              https://git.chapo.chat/hexbear-collective/hexbear or

                              https://git.chapo.chat/hexbear-collective/lemmy-hexbear

                              • vertexarray [any]
                                ·
                                edit-2
                                3 years ago

                                https://git.chapo.chat/hexbear-collective/lemmy-hexbear is the rust backend, it's the one currently in production. Should use that. Also it has the frontend as a submodule.

                                • bottech [he/him]
                                  hexagon
                                  ·
                                  3 years ago

                                  I managed to execute ./db-init.sh and now that i run cargo run i get

                                  could not connect to server: Connection refused

                                  Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?

                                  • vertexarray [any]
                                    ·
                                    3 years ago

                                    hmm, maybe try restarting postgres? If you could run db-init using its default config, it should at least be on the right port already

                                    • bottech [he/him]
                                      hexagon
                                      ·
                                      edit-2
                                      3 years ago

                                      if by restarting you meant sudo service postgresql restart then it didnt work

                                        • bottech [he/him]
                                          hexagon
                                          ·
                                          edit-2
                                          3 years ago

                                          i figured how to fix that bug but now i have

                                          Specified path is not a directory: "../ui/dist/documentation"

                                          • vertexarray [any]
                                            ·
                                            3 years ago

                                            I ran into that one. I think I just had to do a release build of the ui.

                                              • vertexarray [any]
                                                ·
                                                3 years ago

                                                if you've pulled the submodules, you'll have the ui folder. do yarn build in there

                                                • bottech [he/him]
                                                  hexagon
                                                  ·
                                                  3 years ago

                                                  So, after i cloned frontend into ui and did yarn build there, there are still those errors

                                                • bottech [he/him]
                                                  hexagon
                                                  ·
                                                  edit-2
                                                  3 years ago

                                                  I havent, ui is empty, should i just pull the frontend into ui?

                            • bottech [he/him]
                              hexagon
                              ·
                              3 years ago

                              Actually these problems might be because i cloned the repository provided in documentation you sent me and not the hexbear backend, i will try these steps with it and see if it works