Skip to content

Latest commit

 

History

History
 
 

deploy-on-ubuntu

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Ubuntu Deployment

  1. 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
  1. 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;"
  1. 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
  1. Migrate the database
$ make deps
$ make migrate
  1. 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