Self-hosting your Moralis server

I have solved this. It seems you need to specify exactly which Classes you want to connect live query to. so once i added the following code to my parse server options it now works!

  liveQuery: {
    classNames: ['Messages', 'UserTyping'],
  },
2 Likes

Hi guys , this is my app url on Heroku https://morali-host.herokuapp.com/

but i dont know why i get Cannot GET /
and this is my log which looks fine
at=info method=GET path="/" host=morali-host.herokuapp.com request_id=b7b97ce1-b200-4864-84a3-3981935706f9 fwd="151.197.170.246" dyno=web.1 connect=0ms service=1ms status=404 bytes=415 protocol=https

Post your parse server properties and express code file.

thanks for the response,I have posted the parse server properties,and I use react app .I have another app running but I can not figure out whatā€™s wrong with it. I did not quite understand the express code file Thu

It seems to be responsive if you go to http://morali-host.herokuapp.com/server. Have you followed these instructions?

3 Likes

I have self-hosted Moralis server up on my local machine, How can I connect it to my local hardhat/ganache chain to receive event and talk to it ? The docs section ā€œsync on-chain databaseā€ is not documented yet. Iā€™m also on waiting list for ā€œstream APIā€. Iā€™m assuming the old ā€œfrpcā€ is no longer needed since both are on the same machine.

The ā€œsync on-chain databaseā€ section in dos is not documented yet.

That feature isnā€™t ready yet.

1 Like

Man I am super confused. I am trying to set up the self-hosted server Iā€™ve followed along the video tutorial but I am using my own NEXT JS app instead of the parse-server-migration-react-client repo.

I am also incorporating RainbowKit and followed the instructions on how to set that up. So far no issues there. But when it comes to the self-server I donā€™t get any logged in or authenticated user on my mongoDB whenever I connect my metamask.

Iā€™m looking at the authenticationModal.tsx file in the parse-server-migration-react-client repo that the video tutorial uses and in it they are importing Moralis from ā€˜moralis-v1ā€™ package. Which is confusing because I thought you only use moralis-v1 package if you want to use the cloud servers instead of the self-hosted ones?

This whole thing is super confusing.

if you use next js and you only want to authenticate users you donā€™t have to use this tutorial for self hosting, this tutorial for self hosting if if you only want to self host a version of the server similar to how moralis server is working now (with parse server). If you want to make your own backend with next js and use moralis v2 then you can do what without following this tutorial, there is a specific tutorial in documentation on how to use next js for authentication

1 Like

After some tinkering I did in fact set up RainbowKit Provider plus Authentication for my self-hosted Moralis Parse server! Lots of tinkering but if you combine this tutorial for self-hosting and this tutorial for rainbowKit: https://docs.moralis.io/docs/sign-in-with-rainbowkit, you can get a RainbowKit wallet authentication for your self-hosted Moralis parse server. Very, very pleased with the results. : )

1 Like

thanks , if i want to see the dapp from https://morali-host.herokuapp.com/

should i push the react files to the heroku?

For a React app, I would recommend Netlify or Vercel instead - theyā€™re more suitable for deploying frontend apps.

Also Heroku wonā€™t have free plans soon.

1 Like

in this tutorial video https://youtu.be/l2qTyc-V9cM Heroku is used to host the server online, but according to Heroku official website itā€™s free severs ends in November 28 2022. are there any replaceable service I can use for now, at least to a point where I have deposable income to pay for pay services?

thanks

you could also host it locally for tests

1 Like

You can try host in https://render.com which has freemium model

other than that, you can also host in cloud provider such as GCP, AWS, or Azure, which is more complicated to setup, but usually will cost very cheap or even give you free credits in the first 12 months

1 Like

hi,
Yes I started it to host locally, which it works. but Iā€™d like to host it online so I could add it to my cv as a showcase, when Iā€™m ready to show some of the stuff that I learn.

just out of curious, Iā€™m taking the JavaScript course which built a DEx using html and javascript, will the steps for setting up the serves be the same as the video is shown? if itā€™s different, are there any documentations or tutorials I can follow to set it up?

thanks again.

1 Like

I donā€™t mind paying for services. but at this point cause Iā€™m just starting and have recently paid the moralis subscription, so I donā€™t feel ready enough to throw extra cash at it atm.

will look into render thanks

1 Like

It could be different setups as now we are starting to migrate to self hosted servers

hey,
I have another question, in v1 to implement the moralis server into my html page I include the following sdk call:

    <!-- Moralis SDK code -->
    <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
    <script src="https://unpkg.com/moralis-v1/dist/moralis.js"></script>

while in the self-hosting server tutorial video the react-client project code it has the following code to call the server

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(
  <React.StrictMode>
    <BrowserRouter>
      <ChakraProvider theme={theme}>
        <MoralisProvider
          serverUrl={process.env.REACT_APP_SERVER_URL ?? ''}
          appId={process.env.REACT_APP_APPLICATION_ID ?? ''}
        >
          <App />
        </MoralisProvider>
      </ChakraProvider>
    </BrowserRouter>
  </React.StrictMode>,
);

So Iā€™m wonder for self-hosting server, do I still use the same sdk code used for moralis v1 as shown above or do I use the react-client code? if neither, how should I rework the code to get it to work?

note: Iā€™m building a site using html and css, not react.

it should work the code that you used previously in vanilla js, that example for react is specific to react

1 Like