W
Wasp2y ago
wasper

How can I seed my production?

I cant seem to seed my production on deploy
13 Replies
shayne
shayne2y ago
Can you give us an idea what command you’re running and the error/expected output? Basically just any more context is helpful. Thanks
wasper
wasperOP2y ago
I want to db seed my production so im using this in my .env.server DATABASE_URL=<my-db-url> wasp db seed myProdSeed But it fails to parse it when building unexpected 'w' expecting end of input or end of line )
MEE6
MEE62y ago
Wohooo @wasper, you just became a Waspeteer level 1!
shayne
shayne2y ago
Oh ok. Yeah unfortunately that file is for environment variables only You will need to run that command from a terminal or some script for it to execute I’m referring to the wasp db seed part btw
wasper
wasperOP2y ago
So I have to have server access on my railway instance and execute it from there
shayne
shayne2y ago
Yeah some remote shell or scriptable access. I haven’t used Railway but @Vinny (@Wasp) does. Maybe he can chime in tomorrow after the holiday if he has run seeds there
Zeko369
Zeko3692y ago
if you're using railway You can install their CLI, connect to the project and then do railway run "whatver command you want" And that command will be run with servers ENV
wasper
wasperOP2y ago
Thanks, that did it. I was under the impression that you could specify it in the .env.server variable and will be automatically executed on deploy
Zeko369
Zeko3692y ago
Nope, .env.server is just an ENV file that your local server loads in dev
fossfighter
fossfighter2y ago
I've seeded railway db by setting it's connection string to local .env.server's DATABASE_URL and then running wasp db seed
martinsos
martinsos2y ago
Just to check, it can't be run from the local machine, with the URL of the Railway DB? Is Railyway protecting against that? If so, then yes, you will need to run it somewhere from Railway! @wasper btw seeding is somewhat new in Wasp, so if you have some ideas what to improve, we are happy to listen!
Zeko369
Zeko3692y ago
Pretty sure this was the error with how wasp was loading the envs? and not with railways URL since railway run esentially does the same thing
martinsos
martinsos2y ago
Yup, wrong usage of .env.server -> trying to give it a command, instead of just passing an env var value. I just wasn't sure if railway would allow accessing the production db from the outside, but based on what fossfighter said, seems it does, which makes this easier.
Want results from more Discord servers?
Add your server