Skip to content

Commit

Permalink
Add readme file content
Browse files Browse the repository at this point in the history
  • Loading branch information
byhbt committed Jan 5, 2022
1 parent 31b3bb8 commit d8c4567
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
10 changes: 6 additions & 4 deletions lib/nimble_template/variants/phoenix/template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ defmodule NimbleTemplate.Phoenix.Template do
do: Addons.Github.apply(project, %{github_action_test: true})

generate_github_action_deploy_heroku? = generate_github_action_deploy_heroku?()
generate_github_action_deploy_aws_ecs? = generate_github_action_deploy_heroku?()

if generate_github_action_deploy_heroku?,
do: Addons.Github.apply(project, %{github_action_deploy_heroku: true})
Expand All @@ -61,16 +62,17 @@ defmodule NimbleTemplate.Phoenix.Template do
Addons.Github.apply(project, %{
github_workflows_readme: true,
with_test_workflow?: generate_github_action_test?,
with_deploy_to_heroku_workflow?: generate_github_action_deploy_heroku?
})
with_deploy_to_heroku_workflow?: generate_github_action_deploy_heroku?,
with_deploy_to_aws_ecs_workflow?: generate_github_action_deploy_aws_ecs?
})

if generate_github_wiki?(),
do: Addons.Github.apply(project, %{github_wiki: true})

if generate_github_action_deploy_heroku?(),
if generate_github_action_deploy_heroku?,
do: Addons.Github.apply(project, %{github_action_deploy_heroku: true})

if generate_github_action_deploy_aws_ecs?(),
if generate_github_action_deploy_aws_ecs?,
do: Addons.Github.apply(project, %{github_action_deploy_aws_ecs: true})

project
Expand Down
21 changes: 16 additions & 5 deletions priv/templates/nimble_template/.github/workflows/README.md.eex
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The following workflows are supported.

- A pre-generated [Heroku App](https://devcenter.heroku.com/articles/creating-apps)
- A Heroku API key. It can be generated under your [Account Settings](https://dashboard.heroku.com/account#api-key)
- Three Heroku config vars:
- Three Heroku config vars:
- **DATABASE_URL**: It will be created automatically when the [PostgreSQL add-on](https://elements.heroku.com/addons/heroku-postgresql) is added.
- **HOST_URL**: if your app name is `acme`, the value of this var is: `acme.herokuapp.com`
- **SECRET_KEY_BASE**: use the `mix phx.gen.secret` to get a new secret and set it as the value of this var.
Expand All @@ -26,7 +26,7 @@ The following workflows are supported.
- Defining two [Github secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) to hold the value of Heroku API key and Heroku app name:
- HEROKU_API_KEY
- HEROKU_APP_NAME
- Making some configuration changes to make the app ready for Heroku (read more in the [official documentation](https://hexdocs.pm/phoenix/heroku.html#making-our-project-ready-for-heroku)) that:
- Making some configuration changes to make the app ready for Heroku (read more in the [official documentation](https://hexdocs.pm/phoenix/heroku.html#making-our-project-ready-for-heroku)) that:
tell Phoenix to use Heroku URL and enforce the SSL usage. Also, bind to the port requested by Heroku in the `$PORT` environment variable.

Find the `url` configuration in your `config/prod.exs`:
Expand All @@ -42,13 +42,13 @@ The following workflows are supported.
url: [scheme: "https", host: System.get_env("HOST_URL"), port: 443],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
```

Enable SSL for production environment by uncomment it in the file `config/prod.secret.exs`:

```elixir
config :gscraper_web, GscraperWeb.Repo,
ssl: true,
...
...
```

If you plan on using WebSockets, the timeout for the WebSocket transport needs to be decreased in `lib/hello_web/endpoint.ex`.
Expand All @@ -57,8 +57,19 @@ The following workflows are supported.
socket "/socket", HelloWeb.UserSocket,
websocket: [timeout: 45_000],
longpoll: false
...
...
```

otherwise, leaving it set to `false` as default.
<% end %>


<%= if with_deploy_to_aws_ecs_workflow? do %>
- [Deploy to AWS ECS](#deploy-to-aws-ecs-workflow-usage-instruction)
<% end %>

<%= if with_deploy_to_aws_ecs_workflow? do %>
## Deploy to AWS ECS usage instruction

### Requirements
<% end %>

0 comments on commit d8c4567

Please sign in to comment.