https://github.com/fly-apps/hello_elixir_sqlite
An example for building and deploying an Elixir application to Fly using a Dockerfile and SQLite!
https://github.com/fly-apps/hello_elixir_sqlite
Last synced: about 1 year ago
JSON representation
An example for building and deploying an Elixir application to Fly using a Dockerfile and SQLite!
- Host: GitHub
- URL: https://github.com/fly-apps/hello_elixir_sqlite
- Owner: fly-apps
- License: apache-2.0
- Created: 2022-01-19T13:17:53.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-19T17:09:20.000Z (almost 4 years ago)
- Last Synced: 2025-03-29T19:11:14.654Z (over 1 year ago)
- Language: Elixir
- Size: 253 KB
- Stars: 10
- Watchers: 9
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hello Elixir SQLite!
Welcome to our Code Server for Phoenix Apps.
## Development
Right now this editor is running at ${FLY_CODE_URL}.
You need to start the development server to see yout app running at ${FLY_DEVELOPMENT_URL}.
```sh
mix phx.server
```
## Deploy
Looks like we're ready to deploy!
To deploy you just need to run `fly launch --no-deploy`, create your secret key and create a volume.
Run `fly launch --no-deploy` and make sure to say yes to copy the configuration file
to the new app so you wont have to do anything.
```sh
$ fly launch --no-deploy
An existing fly.toml file was found for app fly-elixir
? Would you like to copy its configuration to the new app? Yes
Creating app in /home/coder/project
Scanning source code
Detected a Dockerfile app
? App Name (leave blank to use an auto-generated name): your-app-name
? Select organization: Lubien (personal)
? Select region: gru (São Paulo)
Created app sqlite-tests in organization personal
Wrote config file fly.toml
Your app is ready. Deploy with `flyctl deploy`
```
Let's got create your secret key. Elixir has a mix task that can generate a new
Phoenix key base secret. Let's use that.
```bash
mix phx.gen.secret
```
It generates a long string of random text. Let's store that as a secret for our app.
When we run this command in our project folder, `flyctl` uses the `fly.toml`
file to know which app we are setting the value on.
```sh
$ fly secrets set SECRET_KEY_BASE=
Secrets are staged for the first deployment
```
Now time to create a volume for your SQLite database. You will need to run
`fly volumes create database_data --region REGION_NAME`. Pick the same region
you chose on the previous command.
```sh
$ fly volumes create database_data --size 1 --region gru
ID: vol_1g67340g9y9rydxw
Name: database_data
App: sqlite-tests
Region: gru
Zone: 2824
Size GB: 1
Encrypted: true
Created at: 18 Jan 22 11:18 UTC
```
Now go for the deploy!
```sh
$ fly deploy
```
... will bring up your app!