lexiconhq / lexicon

Built with Expo, React Native, and GraphQL, Lexicon is a pre-built mobile discussions app that you can customize for your users.

Home Page:https://lexicon.is

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I deploy the GraphQL API?

Ashistalin06 opened this issue · comments

Describe the bug

I have followed every step mentioned in the lexicon doc. I am stuck at creating a build process from more than a month. I tried using the expo build: android command mentioned in docs but I would like to know, if my development machine is on then only it will fetch me things from server otherwise it won't work.

REQUIRED: Include the contents of api/.env and frontend/.env

If you are manually overriding any environment variables when running the package scripts, include those as well.

api/.env

PROSE_DISCOURSE_HOST=https://meta.discourse.org
PROSE_APP_HOSTNAME=0.0.0.0
PROSE_APP_PORT=8929

frontend/.env

MOBILE_PROSE_HOST=https://meta.discourse.org
MOBILE_PROSE_PORT=80

REQUIRED: answer the following questions:

  • If this is related to your mobile app:
    • Are you running it through Expo, or did you build it?

I was running through metro and I could see it was getting connected to the server and fetching all the channels, posts etc.

  • Is it running on your mobile device or on a simulator?

Mobile device.

To Reproduce

Steps to reproduce the behavior:

  1. Download and install all the dependencies of lexicon
  2. Run the installed lexicon app as it is, without any changes.
  3. In development machine it is working fine and displaying all the details of channels, posts users etc.
  4. When used expo build: android command, after installing the apk in mobile.. the app is able to run only when the development machine is turned on. According to expo team, they recommended me using eas build.
  5. I used eas build command and created an apk. After installing it in my mobile, it was no longer linked to my development machine as claimed by Expo team. But also I was not able to get connected to the server which were providing me channels, posts, users etc.
  6. Expo has mentioned something about .env variables into their eas.json file but I am not able to configure that and it not mentioned in your docs.

Expected behavior

I want the app to run like it is running in development machine so that I can edit it later and publish the same in play store.

Environments

Windows

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Crome
  • Version: 106.0.5249.119

Smartphone (please complete the following information):

  • Device: Nothing phone 1, Realme x2 pro
  • OS: NothingOS, ColorOS
  • Browser : Crome
  • Version : 106.0.5249.126

GraphQL API (please complete the following information):

Please indicate where the Prose GraphQL API is running.

  • 0.0.0.0:80

Are you only running it locally on your development machine?

  • development machine

Have you deployed it somewhere? If so, what domain or IP address did you deploy it at?

  • Using the same code. Did not make any changes. Will make changes after I am able to figure out the fetching process from the server.

Hello.

It seems there might be a misunderstanding about how Lexicon works.

You wrote:

if my development machine is on then only it will fetch me things from server otherwise it won't work.

You also filled out this part:

Have you deployed it somewhere? If so, what domain or IP address did you deploy it at?

Using the same code. Did not make any changes. Will make changes after I am able to figure out the fetching process from the server.

This is a hint to what's going wrong, since you specifically wrote that you didn't host the Prose GraphQL server (api/) anywhere. You have to deploy the Prose GraphQL server somewhere if you want it to work when your development machine is off.

I would recommend reading the documentation in a bit more detail to ensure you better understand the process.

This link illustrates that the mobile app must be able to connect your deploy Prose server in order for it to work.

This Github comment also goes into this a bit:

If your MOBILE_PROSE_HOST is pointed at localhost on your development machine, how could your mobile device ever access it? If someone tries to download your app from the Play Store, what are they connecting to? They wouldn't be able to connect to your local development machine.

To expand on that, if you turn off your development machine, and Prose is only running on your development machine, then it's expected that the app wouldn't work because it doesn't have anything to connect to. Additionally, if the app was published, no one else who downloaded the app would be able to use it, because they won't be connected to the same network that your development machine is on.

You need to deploy Prose somewhere publicly accessible if you want it to work without your development machine.

This link goes over the process of doing so.

the end goal of this section is to have a working Prose server accessible on the open internet.

And this link goes into the specifics of it.