- Install elixir and
PostgreSQL
$ apt-get update
$ apt-get upgrade -y
$ apt-get install -y postgresql \
elixir \
erlang-dev \
make \
build-essential \
erlang-os-mon \
inotify-tools \
erlang-xmerl
- Setup
PostgreSQL
database, username and password
# Create PostgreSQL user with password
$ sudo -u postgres psql -c "CREATE USER lynx WITH PASSWORD 'lynx';"
$ sudo -u postgres psql -c "ALTER USER lynx CREATEDB;"
# Create database
$ sudo -u postgres psql -c "CREATE DATABASE lynx_dev OWNER lynx;"
- Configure Environment Variables: Set up the required environment variables from
.env.example
.
$ mkdir -p /etc/lynx
$ cd /etc/lynx
$ git clone https://github.com/Clivern/Lynx.git app
$ cd /etc/lynx/app
$ cp .env.example .env.local # Adjust the database configs
- Migrate the database
$ make deps
$ make migrate
- Create a systemd service file
/etc/systemd/system/lynx.service
[Unit]
Description=Lynx
[Service]
Type=simple
Environment=HOME=/root
EnvironmentFile=/etc/lynx/app/.env.local
WorkingDirectory=/etc/lynx/app
ExecStart=/usr/bin/mix phx.server
[Install]
WantedBy=multi-user.target
$ systemctl enable lynx.service
$ systemctl start lynx.service