fireproofsocks

fireproofsocks

In my mix.exs I have set up the following during development:

defp aliases do
  [
    "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
    "ecto.reset": ["ecto.drop", "ecto.setup"],
    test: ["ecto.drop", "ecto.create", "ecto.migrate", "run priv/repo/test_seeds.exs", "test"]
  ]
end

2 things to notice: 1) I drop my test database and re-create it for test runs because 2) I have a set of seeds that I use only for the tests. I know, I could have used fixtures to do that, but it got really onerous with highly-interrelated data, so I thought it would be easier to just have a seed file with my “curated” boilerplate test data.

Then I had this horrible thought: what if I tried to run tests on production? How does mix know which environment you’re in when running the mix tasks? Is what I’ve done bad form?

Thanks as always for pointers/feedback.

Showing Posts 1 to 2

i-n-g-m-a-r

i-n-g-m-a-r

Probably you don’t want to run anything “manually” on production.
To minimize the risk of making a (critical) mistake,
it’s better to automize deployment which includes testing on a machine other than production.
Github, Gitlab and others (Wercker, …) provide tools to accomplish this (CI/CD).
Together with Docker and Distillery:
https://github.com/bitwalker/distillery

It’s a very real concern you have.
You’ll sleep a lot better when you have the right tooling set up for your application.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

As noted by @i-n-g-m-a-r it’s real easy to not worry about it if you don’t even have mix in production. It’s also a good idea to revoke your production database user’s ability to delete databases in general.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews