Skip to main content

TIL: Running Seeds After Edeliver Deploy

Success is neither magical nor mysterious. Success is the natural consequence of consistently applying basic fundamentals.
— E. James Rohn.

Hi guys, after deploying your application to production or staging server, have you ever wondered on how you can import your seed data. This post is specifically targeted to elixir web apps only.

Assuming you haven’t already started the migration process and migrated all the tables. Go to the built edeliver release folder and run ./bin/my_app_name remote_console to access iex console for this web OTP (Open Telecom Platform) app.

When you’re inside the iex console, enter this command:

:code.priv_dir(:my_app_name)
|> Path.join("repo/seeds.exs") 
|> Code.require_file()

The command above will be evaluated by the console interpreter and run the seeds file. This would access the file from priv directory and execute seeds.exs. After that, check your database if all the migrations has been executed.

That’s all there is to it guys, check my other post for some additional tips and tricks. Hope you enjoyed this article!

Comments

Popular posts from this blog

TIL: Disable mDNS and SSDP Discovery in Google Chrome

We're born alone, we live alone, we die alone. Only through our love and friendship can we create the illusion for the moment that we're not alone. — Orson Welles.

TIL: Flutter Series - Custom Icons

Everyone thinks of changing the world, but no one thinks of changing himself. — Leo Tolstoy.

TIL: Gimp Automating Image Processing with Python Fu

What a large volume of adventures may be grasped within the span of his little life by him who interests his heart in everything. — Laurence Sterne.

TOP: Three DNS Providers That Provides Good Service in SEA (Southeast Asia)

If you give a hacker a new toy, the first thing he'll do is take it apart to figure out how it works. — Jamie Zawinski.