Last active
December 1, 2018 23:56
-
-
Save mithereal/b2f10843356a655d12de4948c7d6b5d6 to your computer and use it in GitHub Desktop.
elixir phoenix init script for restarting from shell with ssl key generation and db reset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## place in the app root ie / | |
echo "This will reinit the db, create ssl keys and the main website" | |
PLATFORM_DIRECTORY=$(pwd) | |
PHOENIX_DIRECTORY="apps/api" | |
DB_DIRECTORY="apps/db" | |
sudo systemctl restart postgresql | |
cd "$PLATFORM_DIRECTORY" | |
cd "$DB_DIRECTORY" | |
mix ecto.reset | |
cd "$PLATFORM_DIRECTORY" | |
cd "$PHOENIX_DIRECTORY" | |
rm priv/server.key | |
rm priv/server.pem | |
openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=127.0.0.1" -keyout priv/server.key -out priv/server.pem | |
cd "$PLATFORM_DIRECTORY" | |
iex -S mix phx.server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment