#Medusa on FreeBSD 13.1

1 messages · Page 1 of 1 (latest)

mystic lance
formal jasper
#

Is your CORS setup right. Did you check your browser console to see if there’s any errors displaying.

mystic lance
#

Yes

#

Both server and admin on the same VPS

formal jasper
#

But did you setup the CORS correctly.

mystic lance
#

Would you give it a try?

formal jasper
#

As in tell it where your backend is etc

#

And are you getting any errors in your browser debug JavaScript console

#

I deployed the backend on FreeBSD no problem.

mystic lance
#

How did you managed to the server? by rc.d script?

formal jasper
#

Manually for now with a shell script.

#

I’ll write an RC script later

mystic lance
#

I can help your with the script

#

I think you can improve it

formal jasper
#

Yeah no issues there. 20 year FreeBSD user here 😉

#

Double check your CORS config

#

Something is denying access

mental pulsar
#

Those errors always pop when you open the admin theme not logged in

#

What happens when you try to log in?

formal jasper
#

Yeah can you show me the logs after attempting to login

#

And did you seed the database

#

I’m on my phone right now.

#

I’ll try from my Mac later

mystic lance
mystic lance
mental pulsar
#

Is your node_env set to production?

#

Also yeah, you need to seed or add a medusa user

mystic lance
#

yes my NODE_ENV set to production

#

I've added users

formal jasper
#

I’ve had that problem before. Try seeding the database first.

mystic lance
#

do you mean medusa migrations run

formal jasper
#

Then add users after

#

No

#

You gotta run the initialisation

#

To seed the database

mystic lance
#

Please tell me how to seed it

mental pulsar
#

I don't think the seed is needed in production

formal jasper
#

Did you test it in dev mode first

#

To make sure it all works

formal jasper
mystic lance
#

Yes it was working but on localhost ports

formal jasper
#

Interesting

#

I’ll give it a look on my Mac in a bit and poke around to see if I can see anything

#

Are you running Medusa backend as is or are you proxying through caddy/nginx?

mystic lance
#

I am using NGINx

formal jasper
#

Can you show me your config

mystic lance
#

sure

#

server {
server_name medusa.amr.lc; # Add A record and point it to your server IP
location / { try_files $uri @medusa; }
location @medusa {
include uwsgi_params;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:9000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}

formal jasper
#

Are you proxying the admin as well

#

So i'm seeing zero products etc

#

You might wanna try seeding the DB

#

I think you might have a DB issue

mystic lance
#

I've seeded it but still the same

formal jasper
#

Which DB are you using?

#

PostgreSQL?

mystic lance
#

PostgreSQL

#

Now I've made a new store and it works

#

with SQlist

#

SQLITE

#

Do you like to try it

formal jasper
#

Sure

mystic lance
#

superamr

formal jasper
#

ok that works

#

I wonder if your database connection string is incorrect

#

can you show me? (X out passwords)

mystic lance
#

Give me a minute I am now migrating to PostgreSQL

#

I'll check what is the diff

formal jasper
#

Do you have products in the store?

#

For the first link you sent me

mystic lance
#

no

#

Hi the problem is not with the database it's just not working when your are in production mood

#

Any idea how to solve this

formal jasper
#

But what's the connect string you're using for production?

mystic lance
#

What do you mean by connect strip

#

string

formal jasper
#

in your config where you define the database connection string for medusa backend

mystic lance
#

database_url: DATABASE_URL,
database_type: "postgres",

formal jasper
#

where are you specifying the DATABASE_URL

#

in an env variable?

mystic lance
#

.env.production

formal jasper
#

show me what that looks like please (X out passwords)

#

Sounds like the connection string might be wrong if it works outside of production

#

or not passed at all

mystic lance
#

DATABASE_URL="postgres://medusa:medusa@localhost:5432/medusa"
REDIS_URL="redis://localhost:6379"
JWT_SECRET="somescret"
COOKIE_SECRET="somesecret"
#STRIPE_API_KEY=
#STRIPE_WEBHOOK_SECRET=
STORE_CORS="https://amr.lc,https://www.amr.lc"
ADMIN_CORS="https://admin.amr.lc"

#

it's not related to database belive me

formal jasper
#

Just wanna check all options to rule out

mystic lance
#

Ok