Lorem Ipsum uses a framework to create, develop, and deploy an application on
localhost
with a specific service architecture using Docker containers, without the need to install anything other than Docker Desktop. Ensuring an application deployment just like it would run in a network-mounted production environment, with the exception that it is deployed on the local machine.
Once created the project, in order to start the server without the framework as normally, navigate to the./src
directory and consult the application README.md file.
To consult the application documentation, refer to the ./src/README.md file.
To consult the application changelogs, refer to the ./src/CHANGELOG.md file.
In order to use the framework, install Docker Desktop in your system and make sure the installed application is running.
Service | URL | Description | DEV enviroment only |
---|---|---|---|
app | localhost:4000 | API-REST server | |
app | localhost:4000/dev/dashboard | Phoenix Live Dashboard | ✔️ |
app | localhost:4000/dev/mailbox | Swoosh mailbox | ✔️ |
database | localhost:5432 | PostgreSQL database server | |
pgadmin | localhost:5050 | PGAdmin server |
-
Edit the
config.conf
to set the configuration of how the framework will behave and how the project will be created. This is not mandatory. -
Is needed to set a name for a new project. Run the following command replacing
PROJECT_NAME
with the desired name (Use capital casing with spaces):./app name PROJECT_NAME
-
In order to create a new Phoenix project, run the following command:
./app new
This will generate all the files and apply specific configurations. It can accept all option flags from the task
mix phx.new
like--no-html
or--no-esbuild
(Full task phx.new documentation). -
Edit the
schemas.sh
file in order to create a migration generation script. Once saved, run the following command:./app schemas
This generate schemas, changesets and contexts functions, tests and migration files and configures
servers.json
&pgpass
files with credentials for PGAdmin.
There is the possibility of deploying the service by executing custom server initialization commands. For example, to run the elixir interactive console: iex -S mix phx.server
.
Execute the following command, replacing [COMMAND...]
with the command(s) to be executed:
./app run [COMMAND...]
Set application version on src/mix.exs
file and README.md
version badge.
./app set-version 0.0.0
-
This step is only required when deploying the service for the first time, a database reset is needed or the database container is detroyed. This command drops the project database (if any), creates a new one and run a seeding script:
./app db-reset
-
Once having a configured database, run the following command to deploy the service along with its configured required services and tools in a (local) production enviroment.
./app up
-
Execute the same commands used in
prod
, just add the--dev
option to both commands:./app db-reset --dev ./app up --dev
By default, each enviroment have their own database. Remember it when changing enviroments.
In order to download private github registry images, you need to login to GitHub using a username and a token (classic, not fine-grained) and have access to the resource. To do this, execute the following command:
./app login GITHUB_USER ACCESS_TOKEN
How to generate token: Personal Access Token (classic)
Stops all containers and prune Docker.
./app prune