Added uberspace deployment info to README.md
This commit is contained in:
122
README.md
122
README.md
@ -2,17 +2,123 @@
|
||||
|
||||
To start your Phoenix server:
|
||||
|
||||
* Run `mix setup` to install and setup dependencies
|
||||
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
|
||||
- Run `mix setup` to install and setup dependencies
|
||||
- Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
|
||||
|
||||
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
|
||||
|
||||
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
|
||||
|
||||
## Learn more
|
||||
# Deployment on new uberspace asteroid
|
||||
|
||||
* Official website: https://www.phoenixframework.org/
|
||||
* Guides: https://hexdocs.pm/phoenix/overview.html
|
||||
* Docs: https://hexdocs.pm/phoenix
|
||||
* Forum: https://elixirforum.com/c/phoenix-forum
|
||||
* Source: https://github.com/phoenixframework/phoenix
|
||||
## Initial deployment
|
||||
|
||||
### Add subdomain
|
||||
|
||||
uberspace web domain add beetround.example.com
|
||||
|
||||
### Init database
|
||||
|
||||
Follow guide to initialize postgresql database:
|
||||
https://lab.uberspace.de/guide_postgresql/
|
||||
|
||||
#### Configure database
|
||||
|
||||
createuser beetround_admin -P
|
||||
|
||||
createdb --encoding=UTF8 --owner=beetround_admin --template=template0 beetround_server
|
||||
|
||||
## Configure Elixir/Phoenix
|
||||
|
||||
uberspace tools version use erlang 27
|
||||
|
||||
## Build & run BeetRound
|
||||
|
||||
cd ~/
|
||||
|
||||
mkdir develop
|
||||
|
||||
git clone https://git.working-copy.org/bent/BeetRoundServer.git
|
||||
|
||||
cd develop
|
||||
|
||||
export MIX_ENV=prod
|
||||
|
||||
mix deps.get
|
||||
|
||||
mix phx.gen.secret
|
||||
|
||||
export SECRET_KEY_BASE=<SECRET_KEY>
|
||||
|
||||
export DATABASE_URL=ecto://beetround_admin:<DB_PASSWORD>@localhost/beetround_server
|
||||
|
||||
mix assets.deploy #throws "'mix tailwind beet_round_server --minify' exited with 1" error
|
||||
|
||||
Workaround: copy assets from develop machine
|
||||
|
||||
mix compile
|
||||
|
||||
PHX_HOST=beetround.example.com PORT=4005 mix ecto.migrate
|
||||
|
||||
### Create webbackend
|
||||
|
||||
uberspace web backend set beetround.example.com --http --port 4005
|
||||
|
||||
#### Test backend
|
||||
|
||||
PHX_HOST=beetround.example.com PORT=4005 mix phx.server
|
||||
|
||||
#### Create mix release
|
||||
|
||||
mix release
|
||||
|
||||
### Create service
|
||||
|
||||
nvim ~/etc/services.d/beetround_server.ini
|
||||
|
||||
```
|
||||
[program:beetround_server]
|
||||
command=%(ENV_HOME)s/develop/BeetRoundServer/_build/prod/rel/beet_round_server/bin/beet_round_server
|
||||
directory=%(ENV_HOME)s/develop/BeetRoundServer
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startsecs=60
|
||||
environment =
|
||||
MAIL_RELAY="<UBERSPACE_ASTEROID>.uberspace.de",
|
||||
MAIL_NAME="<MAIL_ADDRESS>",
|
||||
MAIL_PW="<MAIL_PASSWORD>",
|
||||
PHX_HOST="beetround.example.com",
|
||||
MIX_ENV=prod,
|
||||
PORT=4005,
|
||||
DATABASE_URL="ecto://beetround_admin:<DB_PASSWORD>@localhost/beetround_server",
|
||||
SECRET_KEY_BASE=<SECRET_KEY>
|
||||
```
|
||||
|
||||
supervisorctl reread
|
||||
|
||||
supervisorctl update
|
||||
|
||||
supervisorctl status
|
||||
|
||||
## Updates (TODO old content. needs to be adjusted/checked)
|
||||
|
||||
Steps on develop environment:
|
||||
|
||||
- create new release version (with git flow)
|
||||
- push main branch to repo
|
||||
|
||||
Steps on server:
|
||||
|
||||
- cd develop/SplitPot/
|
||||
- pull main branch
|
||||
- mix deps.get --only prod
|
||||
- MIX_ENV=prod mix assets.deploy
|
||||
- export BUILD_DATE="DD.MM.YYYY"
|
||||
- MIX_ENV=prod mix release
|
||||
- supervisorctl stop splitpot_server
|
||||
- DB migrations
|
||||
- export DATABASE_URL=...
|
||||
- export SECRET_BASE_KEY=...
|
||||
- MIX_ENV=prod mix ecto.migrate
|
||||
|
||||
- supervisorctl start splitpot_server
|
||||
|
||||
Reference in New Issue
Block a user