An event management system for a yearly school event.
- Install Elixir
- Follow these instructions for configuring the app.
- Run
mix deps.get
to install dependencies - Run
mix phx.server
to start a local server!
⚠️ You need to have a PostgreSQL database running on your local machine.
Before installing dependencies, you need to properly configure the application. This is done by creating a dev.secret.exs
file in the config
directory of the project.
- Copy the
dev.secret.exs.example
file toconfig/dev.secret.exs
- Change the values in the file to match your local setup.
client_id
andclient_secret
are the OAuth credentials for the Google API. You can get them here. Make sure you select the right project.- There are also database credentials. You need to change them to match your local setup. If you're using Docker to host your local database, you can use the default values.
You can either deploy to fly.io (easy-ish) or self-host the entire project. If you don't have a server, then go for fly.io or contact Martin Rosenberg (nitram.rosenberg@gmail.com), he will lend you one.
Fly.io is a hosting service which makes it easy to deploy Elixir applications. It takes care of the entire deployment process, so you don't have to worry about it. The disadvantage is that it's not free — well, they do have a free tier, but it's not really suitable for this project.
To set up deployment to fly.io, you need to:
- Install the
flyctl
CLI tool. - Authenticate with
flyctl auth login
. - Launch the app with
flyctl launch
. This will create a new app on fly.io.- The CLI will ask you if you want to create a database. Answer
y
(yes). - IMPORTANT: When the CLI asks you if you want to deploy the app, answer
n
(no).
- The CLI will ask you if you want to create a database. Answer
- Set the needed environment variables with
flyctl env set <key>=<value>
. See this section for a list of environment variables which need to be set. - Deploy the app with
flyctl deploy
. - Go to the fly.io dashboard and click on the "Scale" menu item. The recomended settings are:
- TBD
To set up a custom domain, check out the following steps:
In this section, we will assume that you want to use the domain
plejady.alej.cz
for the app.
- Run
fly ips list
to get a list of available IPs.- This should return a list of 2 IPs – one for IPv4 and one for IPv6.
- Write an email to Mr. Horálek (or whoever is in charge of the domain) and ask him to add two DNS records for the domain.
- A record for the IPv4 address.
- AAAA record for the IPv6 address.
- Run
fly certs create plejady.alej.cz
to create a certificate for the domain.- This can take some time, so be patient. You can check on the progress using
fly certs show plejady.alej.cz
.
- This can take some time, so be patient. You can check on the progress using
To set the environment variables, use the flyctl env set <key>=<value>
command. The following variables need to be set:
GOOGLE_CLIENT_ID
- The OAuth client ID for the Google API.GOOGLE_CLIENT_SECRET
- The OAuth client secret for the Google API.
To deploy with Docker, use the provided docker-compose.yml to run the app with a separate PostgreSQL database.
See this section for a list of environment variables which need to be set.
When starting the Docker container (NOT building it), you need to set the following environment variables:
DATABASE_URL
- The URL to the PostgreSQL database. If you're using fly.io, this is automatically set.GOOGLE_CLIENT_ID
- The OAuth client ID for the Google API.GOOGLE_CLIENT_SECRET
- The OAuth client secret for the Google API.SECRET_KEY_BASE
- A secret key used for signing cookies. You can generate one withmix phx.gen.secret
.PHX_HOST
- The host of the application. In this case, it will be something likeplejady.alej.cz
. If you're using fly.io, this is automatically set.