Skip to content

Commit

Permalink
Merge pull request #3 from jeryldev/car_rentals/release-configuration
Browse files Browse the repository at this point in the history
[Car Rentals] Add release configurations
  • Loading branch information
jeryldev authored Feb 15, 2024
2 parents cc916a6 + 3b395b5 commit 89c98ab
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if config_env() == :prod do
config :car_rentals, CarRentals.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "2"),
socket_options: maybe_ipv6

# The secret key base is used to sign/encrypt cookies and other secrets.
Expand Down
1 change: 1 addition & 0 deletions coveralls.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"skip_files": [
"lib/car_rentals/application.ex",
"lib/car_rentals/release.ex",
"lib/car_rentals_web.ex",
"lib/car_rentals_web/telemetry.ex",
"lib/car_rentals_web/router.ex",
Expand Down
28 changes: 28 additions & 0 deletions lib/car_rentals/release.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
defmodule CarRentals.Release do
@moduledoc """
Used for executing DB release tasks when run in production without Mix
installed.
"""
@app :car_rentals

def migrate do
load_app()

for repo <- repos() do
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true))
end
end

def rollback(repo, version) do
load_app()
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
end

defp repos do
Application.fetch_env!(@app, :ecto_repos)
end

defp load_app do
Application.load(@app)
end
end
Binary file not shown.
6 changes: 6 additions & 0 deletions priv/static/images/logo-06a11be1f2cdde2c851763d00bdd2e80.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added priv/static/images/logo.svg.gz
Binary file not shown.
5 changes: 5 additions & 0 deletions priv/static/robots-9e2c81b0855bbff2baa8371bc4a78186.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /
Binary file not shown.
Binary file added priv/static/robots.txt.gz
Binary file not shown.
5 changes: 5 additions & 0 deletions rel/overlays/bin/migrate
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu

cd -P -- "$(dirname -- "$0")"
exec ./car_rentals eval CarRentals.Release.migrate
1 change: 1 addition & 0 deletions rel/overlays/bin/migrate.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
call "%~dp0\car_rentals" eval CarRentals.Release.migrate
5 changes: 5 additions & 0 deletions rel/overlays/bin/server
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -eu

cd -P -- "$(dirname -- "$0")"
PHX_SERVER=true exec ./car_rentals start
2 changes: 2 additions & 0 deletions rel/overlays/bin/server.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set PHX_SERVER=true
call "%~dp0\car_rentals" start

0 comments on commit 89c98ab

Please sign in to comment.