From dc0020bd5d83641dd4964165507201cc25871fd9 Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 09:56:56 -0300 Subject: [PATCH 01/10] Fix phoenix release env --- scanner/phoenix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scanner/phoenix.go b/scanner/phoenix.go index a0d4ebf2a7..2b9fe0c95e 100644 --- a/scanner/phoenix.go +++ b/scanner/phoenix.go @@ -142,7 +142,7 @@ export ERL_AFLAGS="-proto_dist inet6_tcp" export ECTO_IPV6="true" export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal" export RELEASE_DISTRIBUTION="name" -export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}" +export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*[:'-']}@${FLY_PRIVATE_IP}" # Uncomment to send crash dumps to stderr # This can be useful for debugging, but may log sensitive information From 8e1a22a7bda253f677e08f08b0c5bfd999cca595 Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 09:58:06 -0300 Subject: [PATCH 02/10] Support custom tool-versions for phoenix --- deployer.Dockerfile | 2 +- scanner/phoenix.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/deployer.Dockerfile b/deployer.Dockerfile index 941598e470..4942e0df97 100644 --- a/deployer.Dockerfile +++ b/deployer.Dockerfile @@ -55,10 +55,10 @@ RUN git clone https://github.com/asdf-vm/asdf.git $HOME/.asdf --branch v0.14.0 & asdf install nodejs $DEFAULT_NODE_VERSION && asdf global nodejs $DEFAULT_NODE_VERSION && \ # elixir asdf plugin-add erlang https://github.com/michallepicki/asdf-erlang-prebuilt-ubuntu-20.04.git && \ - echo -e "local.hex\nlocal.rebar" > $HOME/.default-mix-commands && \ asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git && \ asdf install erlang $DEFAULT_ERLANG_VERSION && asdf global erlang $DEFAULT_ERLANG_VERSION && \ asdf install elixir $DEFAULT_ELIXIR_VERSION && asdf global elixir $DEFAULT_ELIXIR_VERSION && \ + mix local.hex --force && mix local.rebar --force && \ # bun asdf plugin add bun https://github.com/cometkim/asdf-bun.git && \ asdf install bun $DEFAULT_BUN_VERSION && asdf global bun $DEFAULT_BUN_VERSION diff --git a/scanner/phoenix.go b/scanner/phoenix.go index 2b9fe0c95e..30c98888b7 100644 --- a/scanner/phoenix.go +++ b/scanner/phoenix.go @@ -73,6 +73,34 @@ func configurePhoenix(sourceDir string, config *ScannerConfig) (*SourceInfo, err }, } + // This adds support on launch UI for repos with different .tool-versions + deployTrigger := os.Getenv("DEPLOY_TRIGGER") + if deployTrigger == "launch" && helpers.FileExists(filepath.Join(sourceDir, ".tool-versions")) { + cmd := exec.Command("asdf", "install") + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err := cmd.Run() + if err != nil { + return nil, errors.Wrap(err, "We identified .tool-versions but after running `asdf install` we ran into some errors. Please check that your `asdf install` builds successfully and try again.") + } + + cmd = exec.Command("mix", "local.hex", "--force") + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err = cmd.Run() + if err != nil { + return nil, errors.Wrap(err, "After installing your elixir version with asdf we found an error while running `mix local.hex --force`. Please confirm that running this command works locally and try again.") + } + + cmd = exec.Command("mix", "local.rebar", "--force") + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + err = cmd.Run() + if err != nil { + return nil, errors.Wrap(err, "After installing your elixir version with asdf we found an error while running `mix local.rebar --force`. Please confirm that running this command works locally and try again.") + } + } + // We found Phoenix, so check if the project compiles. cmd := exec.Command("mix", "do", "deps.get,", "compile") cmd.Stdout = os.Stdout From e51c58352622f0bdc0f1afd51693d35c88cbb758 Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 09:58:21 -0300 Subject: [PATCH 03/10] Always gen files at launch --- deploy.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy.rb b/deploy.rb index 9d851e280e..3edede90ba 100755 --- a/deploy.rb +++ b/deploy.rb @@ -24,6 +24,7 @@ CREATE_AND_PUSH_BRANCH = !get_env("DEPLOY_CREATE_AND_PUSH_BRANCH").nil? FLYIO_BRANCH_NAME = "flyio-new-files" +DEPLOY_TRIGGER = get_env("DEPLOY_TRIGGER") DEPLOYER_FLY_CONFIG_PATH = get_env("DEPLOYER_FLY_CONFIG_PATH") DEPLOYER_SOURCE_CWD = get_env("DEPLOYER_SOURCE_CWD") DEPLOY_APP_NAME = get_env("DEPLOY_APP_NAME") @@ -268,7 +269,7 @@ ORG_SLUG = manifest["plan"]["org"] APP_REGION = manifest["plan"]["region"] - DO_GEN_REQS = !DEPLOY_COPY_CONFIG || !HAS_FLY_CONFIG + DO_GEN_REQS = DEPLOY_TRIGGER == "launch" debug("generate reqs? #{DO_GEN_REQS}") From ccaa35bfa27989f3272e284ed468b9ebfbe074e6 Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 10:17:50 -0300 Subject: [PATCH 04/10] Test phoenix --- test/deployer/deployer_test.go | 24 +++ .../.dockerignore | 45 ++++ .../.formatter.exs | 5 + .../.gitignore | 36 ++++ .../.tool-versions | 2 + .../Dockerfile | 95 +++++++++ .../LICENSE | 201 ++++++++++++++++++ .../README.md | 82 +++++++ .../assets/css/app.css | 89 ++++++++ .../assets/css/phoenix.css | 101 +++++++++ .../assets/js/app.js | 44 ++++ .../assets/vendor/topbar.js | 157 ++++++++++++++ .../config/config.exs | 51 +++++ .../config/dev.exs | 71 +++++++ .../config/prod.exs | 51 +++++ .../config/runtime.exs | 85 ++++++++ .../config/test.exs | 30 +++ .../entrypoint.sh | 9 + .../fly.toml | 40 ++++ .../lib/hello_elixir.ex | 9 + .../lib/hello_elixir/application.ex | 36 ++++ .../lib/hello_elixir/mailer.ex | 3 + .../lib/hello_elixir/release.ex | 28 +++ .../lib/hello_elixir/repo.ex | 5 + .../lib/hello_elixir_web.ex | 102 +++++++++ .../controllers/page_controller.ex | 7 + .../lib/hello_elixir_web/endpoint.ex | 50 +++++ .../lib/hello_elixir_web/gettext.ex | 24 +++ .../lib/hello_elixir_web/router.ex | 55 +++++ .../lib/hello_elixir_web/telemetry.ex | 71 +++++++ .../templates/layout/app.html.heex | 5 + .../templates/layout/live.html.heex | 11 + .../templates/layout/root.html.heex | 30 +++ .../templates/page/index.html.heex | 41 ++++ .../hello_elixir_web/views/error_helpers.ex | 47 ++++ .../lib/hello_elixir_web/views/error_view.ex | 16 ++ .../lib/hello_elixir_web/views/layout_view.ex | 7 + .../lib/hello_elixir_web/views/page_view.ex | 3 + .../mix.exs | 70 ++++++ .../mix.lock | 38 ++++ .../priv/gettext/en/LC_MESSAGES/errors.po | 112 ++++++++++ .../priv/gettext/errors.pot | 95 +++++++++ .../priv/repo/migrations/.formatter.exs | 4 + ...210505214438_create_a_migration_to_run.exs | 9 + .../priv/repo/seeds.exs | 11 + .../priv/static/favicon.ico | Bin 0 -> 1258 bytes .../priv/static/images/phoenix.png | Bin 0 -> 13900 bytes .../priv/static/robots.txt | 5 + .../controllers/page_controller_test.exs | 8 + .../views/error_view_test.exs | 14 ++ .../views/layout_view_test.exs | 8 + .../hello_elixir_web/views/page_view_test.exs | 3 + .../test/support/channel_case.ex | 36 ++++ .../test/support/conn_case.ex | 39 ++++ .../test/support/data_case.ex | 51 +++++ .../test/test_helper.exs | 2 + test/testlib/deployer.go | 1 + 57 files changed, 2274 insertions(+) create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.dockerignore create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.formatter.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.gitignore create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.tool-versions create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/Dockerfile create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/LICENSE create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/README.md create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/app.css create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/phoenix.css create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/js/app.js create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/vendor/topbar.js create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/config.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/dev.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/prod.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/runtime.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/test.exs create mode 100755 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/entrypoint.sh create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/application.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/mailer.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/release.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/repo.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/controllers/page_controller.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/endpoint.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/gettext.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/router.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/telemetry.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/app.html.heex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/live.html.heex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/root.html.heex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/page/index.html.heex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_helpers.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_view.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/layout_view.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/page_view.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.lock create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/en/LC_MESSAGES/errors.po create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/errors.pot create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/.formatter.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/20210505214438_create_a_migration_to_run.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/seeds.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/favicon.ico create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/images/phoenix.png create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/robots.txt create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/controllers/page_controller_test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/error_view_test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/layout_view_test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/page_view_test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/channel_case.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/conn_case.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/data_case.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/test_helper.exs diff --git a/test/deployer/deployer_test.go b/test/deployer/deployer_test.go index c3fad57fe8..43f105aa13 100644 --- a/test/deployer/deployer_test.go +++ b/test/deployer/deployer_test.go @@ -396,6 +396,30 @@ func TestLaunchStatic(t *testing.T) { require.Contains(t, string(body), "Hello World") } +func TestDeployPhoenixSqliteWithCustomToolVersions(t *testing.T) { + deploy := testDeployer(t, + withFixtureApp("deploy-phoenix-sqlite-custom-tool-versions"), + createRandomApp, + withOverwrittenConfig(func(d *testlib.DeployTestRun) map[string]any { + return map[string]any{ + "app": d.Extra["appName"], + "region": d.PrimaryRegion(), + "env": map[string]string{ + "TEST_ID": d.ID(), + }, + } + }), + testlib.DeployOnly, + testlib.DeployNow, + withWorkDirAppSource, + ) + + body, err := testlib.RunHealthCheck(fmt.Sprintf("https://%s.fly.dev", deploy.Extra["appName"].(string))) + require.NoError(t, err) + + require.Contains(t, string(body), "Phoenix") +} + func createRandomApp(d *testlib.DeployTestRun) { appName := d.CreateRandomAppName() require.NotEmpty(d, appName) diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.dockerignore b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.dockerignore new file mode 100644 index 0000000000..61a73933c8 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.dockerignore @@ -0,0 +1,45 @@ +# This file excludes paths from the Docker build context. +# +# By default, Docker's build context includes all files (and folders) in the +# current directory. Even if a file isn't copied into the container it is still sent to +# the Docker daemon. +# +# There are multiple reasons to exclude files from the build context: +# +# 1. Prevent nested folders from being copied into the container (ex: exclude +# /assets/node_modules when copying /assets) +# 2. Reduce the size of the build context and improve build time (ex. /build, /deps, /doc) +# 3. Avoid sending files containing sensitive information +# +# More information on using .dockerignore is available here: +# https://docs.docker.com/engine/reference/builder/#dockerignore-file + +.dockerignore + +# Ignore git, but keep git HEAD and refs to access current commit hash if needed: +# +# $ cat .git/HEAD | awk '{print ".git/"$2}' | xargs cat +# d0b8727759e1e0e7aa3d41707d12376e373d5ecc +.git +!.git/HEAD +!.git/refs + +# Common development/test artifacts +/cover/ +/doc/ +/test/ +/tmp/ +.elixir_ls + +# Mix artifacts +/_build/ +/deps/ +*.ez + +# Generated on crash by the VM +erl_crash.dump + +# Static artifacts - These should be fetched and built inside the Docker image +/assets/node_modules/ +/priv/static/assets/ +/priv/static/cache_manifest.json diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.formatter.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.formatter.exs new file mode 100644 index 0000000000..8a6391c6a6 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.formatter.exs @@ -0,0 +1,5 @@ +[ + import_deps: [:ecto, :phoenix], + inputs: ["*.{ex,exs}", "priv/*/seeds.exs", "{config,lib,test}/**/*.{ex,exs}"], + subdirectories: ["priv/*/migrations"] +] diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.gitignore b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.gitignore new file mode 100644 index 0000000000..ed6f936b80 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.gitignore @@ -0,0 +1,36 @@ +# The directory Mix will write compiled artifacts to. +/_build/ +/.elixir_ls/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where 3rd-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez + +# Ignore package tarball (built via "mix hex.build"). +hello_elixir-*.tar + +# Ignore assets that are produced by build tools. +/priv/static/assets/ + +# Ignore digested assets cache. +/priv/static/cache_manifest.json + +# In case you use Node.js/npm, you want to ignore these. +npm-debug.log +/assets/node_modules/ + +hello_elixir_dev.db* \ No newline at end of file diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.tool-versions b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.tool-versions new file mode 100644 index 0000000000..6dfe7625d7 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/.tool-versions @@ -0,0 +1,2 @@ +erlang 24.3.4.9 +elixir 1.12.3-otp-24 diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/Dockerfile b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/Dockerfile new file mode 100644 index 0000000000..fabe7c5c85 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/Dockerfile @@ -0,0 +1,95 @@ +# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian instead of +# Alpine to avoid DNS resolution issues in production. +# +# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu +# https://hub.docker.com/_/ubuntu?tab=tags +# +# +# This file is based on these images: +# +# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image +# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20210902-slim - for the release image +# - https://pkgs.org/ - resource for finding needed packages +# - Ex: hexpm/elixir:1.13.3-erlang-24.0.5-debian-bullseye-20210902-slim +# +ARG ELIXIR_VERSION=1.13.3 +ARG OTP_VERSION=24.0.5 +ARG DEBIAN_VERSION=bullseye-20210902-slim + +ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}" +ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}" + +FROM ${BUILDER_IMAGE} as builder + +# install build dependencies +RUN apt-get update -y && apt-get install -y build-essential git \ + && apt-get clean && rm -f /var/lib/apt/lists/*_* + +# prepare build dir +WORKDIR /app + +# install hex + rebar +RUN mix local.hex --force && \ + mix local.rebar --force + +# set build ENV +ENV MIX_ENV="prod" + +# install mix dependencies +COPY mix.exs mix.lock ./ +RUN mix deps.get --only $MIX_ENV +RUN mkdir config + +# copy compile-time config files before we compile dependencies +# to ensure any relevant config change will trigger the dependencies +# to be re-compiled. +COPY config/config.exs config/${MIX_ENV}.exs config/ +RUN mix deps.compile + +COPY priv priv + +COPY lib lib + +COPY assets assets + +# compile assets +RUN mix assets.deploy + +# Compile the release +RUN mix compile + +# Changes to config/runtime.exs don't require recompiling the code +COPY config/runtime.exs config/ + +COPY rel rel +RUN mix release + +# start a new build stage so that the final image will only contain +# the compiled release and other runtime necessities +FROM ${RUNNER_IMAGE} + +RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales sqlite3 \ + && apt-get clean && rm -f /var/lib/apt/lists/*_* + +# Set the locale +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen + +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +WORKDIR "/app" +RUN chown nobody /app + +# set runner ENV +ENV MIX_ENV="prod" + +# Only copy the final release from the build stage +COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/hello_elixir ./ + +USER nobody + +CMD ["/app/bin/server"] +# Appended by flyctl +ENV ECTO_IPV6 true +ENV ERL_AFLAGS "-proto_dist inet6_tcp" diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/LICENSE b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/README.md b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/README.md new file mode 100644 index 0000000000..20a1ae1d48 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/README.md @@ -0,0 +1,82 @@ +# 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! \ No newline at end of file diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/app.css b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/app.css new file mode 100644 index 0000000000..24920cf1ae --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/app.css @@ -0,0 +1,89 @@ +/* This file is for your main application CSS */ +@import "./phoenix.css"; + +/* Alerts and form errors used by phx.new */ +.alert { + padding: 15px; + margin-bottom: 20px; + border: 1px solid transparent; + border-radius: 4px; +} +.alert-info { + color: #31708f; + background-color: #d9edf7; + border-color: #bce8f1; +} +.alert-warning { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +.alert-danger { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; +} +.alert p { + margin-bottom: 0; +} +.alert:empty { + display: none; +} +.invalid-feedback { + color: #a94442; + display: block; + margin: -1rem 0 2rem; +} + +/* LiveView specific classes for your customization */ +.phx-no-feedback.invalid-feedback, +.phx-no-feedback .invalid-feedback { + display: none; +} + +.phx-click-loading { + opacity: 0.5; + transition: opacity 1s ease-out; +} + +.phx-disconnected{ + cursor: wait; +} +.phx-disconnected *{ + pointer-events: none; +} + +.phx-modal { + opacity: 1!important; + position: fixed; + z-index: 1; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgb(0,0,0); + background-color: rgba(0,0,0,0.4); +} + +.phx-modal-content { + background-color: #fefefe; + margin: 15vh auto; + padding: 20px; + border: 1px solid #888; + width: 80%; +} + +.phx-modal-close { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.phx-modal-close:hover, +.phx-modal-close:focus { + color: black; + text-decoration: none; + cursor: pointer; +} diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/phoenix.css b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/phoenix.css new file mode 100644 index 0000000000..0d59050f89 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/css/phoenix.css @@ -0,0 +1,101 @@ +/* Includes some default style for the starter application. + * This can be safely deleted to start fresh. + */ + +/* Milligram v1.4.1 https://milligram.github.io + * Copyright (c) 2020 CJ Patoilo Licensed under the MIT license + */ + +*,*:after,*:before{box-sizing:inherit}html{box-sizing:border-box;font-size:62.5%}body{color:#000000;font-family:'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;font-size:1.6em;font-weight:300;letter-spacing:.01em;line-height:1.6}blockquote{border-left:0.3rem solid #d1d1d1;margin-left:0;margin-right:0;padding:1rem 1.5rem}blockquote *:last-child{margin-bottom:0}.button,button,input[type='button'],input[type='reset'],input[type='submit']{background-color:#0069d9;border:0.1rem solid #0069d9;border-radius:.4rem;color:#fff;cursor:pointer;display:inline-block;font-size:1.1rem;font-weight:700;height:3.8rem;letter-spacing:.1rem;line-height:3.8rem;padding:0 3.0rem;text-align:center;text-decoration:none;text-transform:uppercase;white-space:nowrap}.button:focus,.button:hover,button:focus,button:hover,input[type='button']:focus,input[type='button']:hover,input[type='reset']:focus,input[type='reset']:hover,input[type='submit']:focus,input[type='submit']:hover{background-color:#606c76;border-color:#606c76;color:#fff;outline:0}.button[disabled],button[disabled],input[type='button'][disabled],input[type='reset'][disabled],input[type='submit'][disabled]{cursor:default;opacity:.5}.button[disabled]:focus,.button[disabled]:hover,button[disabled]:focus,button[disabled]:hover,input[type='button'][disabled]:focus,input[type='button'][disabled]:hover,input[type='reset'][disabled]:focus,input[type='reset'][disabled]:hover,input[type='submit'][disabled]:focus,input[type='submit'][disabled]:hover{background-color:#0069d9;border-color:#0069d9}.button.button-outline,button.button-outline,input[type='button'].button-outline,input[type='reset'].button-outline,input[type='submit'].button-outline{background-color:transparent;color:#0069d9}.button.button-outline:focus,.button.button-outline:hover,button.button-outline:focus,button.button-outline:hover,input[type='button'].button-outline:focus,input[type='button'].button-outline:hover,input[type='reset'].button-outline:focus,input[type='reset'].button-outline:hover,input[type='submit'].button-outline:focus,input[type='submit'].button-outline:hover{background-color:transparent;border-color:#606c76;color:#606c76}.button.button-outline[disabled]:focus,.button.button-outline[disabled]:hover,button.button-outline[disabled]:focus,button.button-outline[disabled]:hover,input[type='button'].button-outline[disabled]:focus,input[type='button'].button-outline[disabled]:hover,input[type='reset'].button-outline[disabled]:focus,input[type='reset'].button-outline[disabled]:hover,input[type='submit'].button-outline[disabled]:focus,input[type='submit'].button-outline[disabled]:hover{border-color:inherit;color:#0069d9}.button.button-clear,button.button-clear,input[type='button'].button-clear,input[type='reset'].button-clear,input[type='submit'].button-clear{background-color:transparent;border-color:transparent;color:#0069d9}.button.button-clear:focus,.button.button-clear:hover,button.button-clear:focus,button.button-clear:hover,input[type='button'].button-clear:focus,input[type='button'].button-clear:hover,input[type='reset'].button-clear:focus,input[type='reset'].button-clear:hover,input[type='submit'].button-clear:focus,input[type='submit'].button-clear:hover{background-color:transparent;border-color:transparent;color:#606c76}.button.button-clear[disabled]:focus,.button.button-clear[disabled]:hover,button.button-clear[disabled]:focus,button.button-clear[disabled]:hover,input[type='button'].button-clear[disabled]:focus,input[type='button'].button-clear[disabled]:hover,input[type='reset'].button-clear[disabled]:focus,input[type='reset'].button-clear[disabled]:hover,input[type='submit'].button-clear[disabled]:focus,input[type='submit'].button-clear[disabled]:hover{color:#0069d9}code{background:#f4f5f6;border-radius:.4rem;font-size:86%;margin:0 .2rem;padding:.2rem .5rem;white-space:nowrap}pre{background:#f4f5f6;border-left:0.3rem solid #0069d9;overflow-y:hidden}pre>code{border-radius:0;display:block;padding:1rem 1.5rem;white-space:pre}hr{border:0;border-top:0.1rem solid #f4f5f6;margin:3.0rem 0}input[type='color'],input[type='date'],input[type='datetime'],input[type='datetime-local'],input[type='email'],input[type='month'],input[type='number'],input[type='password'],input[type='search'],input[type='tel'],input[type='text'],input[type='url'],input[type='week'],input:not([type]),textarea,select{-webkit-appearance:none;background-color:transparent;border:0.1rem solid #d1d1d1;border-radius:.4rem;box-shadow:none;box-sizing:inherit;height:3.8rem;padding:.6rem 1.0rem .7rem;width:100%}input[type='color']:focus,input[type='date']:focus,input[type='datetime']:focus,input[type='datetime-local']:focus,input[type='email']:focus,input[type='month']:focus,input[type='number']:focus,input[type='password']:focus,input[type='search']:focus,input[type='tel']:focus,input[type='text']:focus,input[type='url']:focus,input[type='week']:focus,input:not([type]):focus,textarea:focus,select:focus{border-color:#0069d9;outline:0}select{background:url('data:image/svg+xml;utf8,') center right no-repeat;padding-right:3.0rem}select:focus{background-image:url('data:image/svg+xml;utf8,')}select[multiple]{background:none;height:auto}textarea{min-height:6.5rem}label,legend{display:block;font-size:1.6rem;font-weight:700;margin-bottom:.5rem}fieldset{border-width:0;padding:0}input[type='checkbox'],input[type='radio']{display:inline}.label-inline{display:inline-block;font-weight:normal;margin-left:.5rem}.container{margin:0 auto;max-width:112.0rem;padding:0 2.0rem;position:relative;width:100%}.row{display:flex;flex-direction:column;padding:0;width:100%}.row.row-no-padding{padding:0}.row.row-no-padding>.column{padding:0}.row.row-wrap{flex-wrap:wrap}.row.row-top{align-items:flex-start}.row.row-bottom{align-items:flex-end}.row.row-center{align-items:center}.row.row-stretch{align-items:stretch}.row.row-baseline{align-items:baseline}.row .column{display:block;flex:1 1 auto;margin-left:0;max-width:100%;width:100%}.row .column.column-offset-10{margin-left:10%}.row .column.column-offset-20{margin-left:20%}.row .column.column-offset-25{margin-left:25%}.row .column.column-offset-33,.row .column.column-offset-34{margin-left:33.3333%}.row .column.column-offset-40{margin-left:40%}.row .column.column-offset-50{margin-left:50%}.row .column.column-offset-60{margin-left:60%}.row .column.column-offset-66,.row .column.column-offset-67{margin-left:66.6666%}.row .column.column-offset-75{margin-left:75%}.row .column.column-offset-80{margin-left:80%}.row .column.column-offset-90{margin-left:90%}.row .column.column-10{flex:0 0 10%;max-width:10%}.row .column.column-20{flex:0 0 20%;max-width:20%}.row .column.column-25{flex:0 0 25%;max-width:25%}.row .column.column-33,.row .column.column-34{flex:0 0 33.3333%;max-width:33.3333%}.row .column.column-40{flex:0 0 40%;max-width:40%}.row .column.column-50{flex:0 0 50%;max-width:50%}.row .column.column-60{flex:0 0 60%;max-width:60%}.row .column.column-66,.row .column.column-67{flex:0 0 66.6666%;max-width:66.6666%}.row .column.column-75{flex:0 0 75%;max-width:75%}.row .column.column-80{flex:0 0 80%;max-width:80%}.row .column.column-90{flex:0 0 90%;max-width:90%}.row .column .column-top{align-self:flex-start}.row .column .column-bottom{align-self:flex-end}.row .column .column-center{align-self:center}@media (min-width: 40rem){.row{flex-direction:row;margin-left:-1.0rem;width:calc(100% + 2.0rem)}.row .column{margin-bottom:inherit;padding:0 1.0rem}}a{color:#0069d9;text-decoration:none}a:focus,a:hover{color:#606c76}dl,ol,ul{list-style:none;margin-top:0;padding-left:0}dl dl,dl ol,dl ul,ol dl,ol ol,ol ul,ul dl,ul ol,ul ul{font-size:90%;margin:1.5rem 0 1.5rem 3.0rem}ol{list-style:decimal inside}ul{list-style:circle inside}.button,button,dd,dt,li{margin-bottom:1.0rem}fieldset,input,select,textarea{margin-bottom:1.5rem}blockquote,dl,figure,form,ol,p,pre,table,ul{margin-bottom:2.5rem}table{border-spacing:0;display:block;overflow-x:auto;text-align:left;width:100%}td,th{border-bottom:0.1rem solid #e1e1e1;padding:1.2rem 1.5rem}td:first-child,th:first-child{padding-left:0}td:last-child,th:last-child{padding-right:0}@media (min-width: 40rem){table{display:table;overflow-x:initial}}b,strong{font-weight:bold}p{margin-top:0}h1,h2,h3,h4,h5,h6{font-weight:300;letter-spacing:-.1rem;margin-bottom:2.0rem;margin-top:0}h1{font-size:4.6rem;line-height:1.2}h2{font-size:3.6rem;line-height:1.25}h3{font-size:2.8rem;line-height:1.3}h4{font-size:2.2rem;letter-spacing:-.08rem;line-height:1.35}h5{font-size:1.8rem;letter-spacing:-.05rem;line-height:1.5}h6{font-size:1.6rem;letter-spacing:0;line-height:1.4}img{max-width:100%}.clearfix:after{clear:both;content:' ';display:table}.float-left{float:left}.float-right{float:right} + +/* General style */ +h1{font-size: 3.6rem; line-height: 1.25} +h2{font-size: 2.8rem; line-height: 1.3} +h3{font-size: 2.2rem; letter-spacing: -.08rem; line-height: 1.35} +h4{font-size: 1.8rem; letter-spacing: -.05rem; line-height: 1.5} +h5{font-size: 1.6rem; letter-spacing: 0; line-height: 1.4} +h6{font-size: 1.4rem; letter-spacing: 0; line-height: 1.2} +pre{padding: 1em;} + +.container{ + margin: 0 auto; + max-width: 80.0rem; + padding: 0 2.0rem; + position: relative; + width: 100% +} +select { + width: auto; +} + +/* Phoenix promo and logo */ +.phx-hero { + text-align: center; + border-bottom: 1px solid #e3e3e3; + background: #eee; + border-radius: 6px; + padding: 3em 3em 1em; + margin-bottom: 3rem; + font-weight: 200; + font-size: 120%; +} +.phx-hero input { + background: #ffffff; +} +.phx-logo { + min-width: 300px; + margin: 1rem; + display: block; +} +.phx-logo img { + width: auto; + display: block; +} + +/* Headers */ +header { + width: 100%; + background: #fdfdfd; + border-bottom: 1px solid #eaeaea; + margin-bottom: 2rem; +} +header section { + align-items: center; + display: flex; + flex-direction: column; + justify-content: space-between; +} +header section :first-child { + order: 2; +} +header section :last-child { + order: 1; +} +header nav ul, +header nav li { + margin: 0; + padding: 0; + display: block; + text-align: right; + white-space: nowrap; +} +header nav ul { + margin: 1rem; + margin-top: 0; +} +header nav a { + display: block; +} + +@media (min-width: 40.0rem) { /* Small devices (landscape phones, 576px and up) */ + header section { + flex-direction: row; + } + header nav ul { + margin: 1rem; + } + .phx-logo { + flex-basis: 527px; + margin: 2rem 1rem; + } +} diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/js/app.js b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/js/app.js new file mode 100644 index 0000000000..9eabcff9d3 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/js/app.js @@ -0,0 +1,44 @@ +// We import the CSS which is extracted to its own file by esbuild. +// Remove this line if you add a your own CSS build pipeline (e.g postcss). +import "../css/app.css" + +// If you want to use Phoenix channels, run `mix help phx.gen.channel` +// to get started and then uncomment the line below. +// import "./user_socket.js" + +// You can include dependencies in two ways. +// +// The simplest option is to put them in assets/vendor and +// import them using relative paths: +// +// import "./vendor/some-package.js" +// +// Alternatively, you can `npm install some-package` and import +// them using a path starting with the package name: +// +// import "some-package" +// + +// Include phoenix_html to handle method=PUT/DELETE in forms and buttons. +import "phoenix_html" +// Establish Phoenix Socket and LiveView configuration. +import {Socket} from "phoenix" +import {LiveSocket} from "phoenix_live_view" +import topbar from "../vendor/topbar" + +let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content") +let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}}) + +// Show progress bar on live navigation and form submits +topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"}) +window.addEventListener("phx:page-loading-start", info => topbar.show()) +window.addEventListener("phx:page-loading-stop", info => topbar.hide()) + +// connect if there are any LiveViews on the page +liveSocket.connect() + +// expose liveSocket on window for web console debug logs and latency simulation: +// >> liveSocket.enableDebug() +// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session +// >> liveSocket.disableLatencySim() +window.liveSocket = liveSocket diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/vendor/topbar.js b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/vendor/topbar.js new file mode 100644 index 0000000000..ff7fbb6709 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/assets/vendor/topbar.js @@ -0,0 +1,157 @@ +/** + * @license MIT + * topbar 1.0.0, 2021-01-06 + * http://buunguyen.github.io/topbar + * Copyright (c) 2021 Buu Nguyen + */ +(function (window, document) { + "use strict"; + + // https://gist.github.com/paulirish/1579671 + (function () { + var lastTime = 0; + var vendors = ["ms", "moz", "webkit", "o"]; + for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { + window.requestAnimationFrame = + window[vendors[x] + "RequestAnimationFrame"]; + window.cancelAnimationFrame = + window[vendors[x] + "CancelAnimationFrame"] || + window[vendors[x] + "CancelRequestAnimationFrame"]; + } + if (!window.requestAnimationFrame) + window.requestAnimationFrame = function (callback, element) { + var currTime = new Date().getTime(); + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); + var id = window.setTimeout(function () { + callback(currTime + timeToCall); + }, timeToCall); + lastTime = currTime + timeToCall; + return id; + }; + if (!window.cancelAnimationFrame) + window.cancelAnimationFrame = function (id) { + clearTimeout(id); + }; + })(); + + var canvas, + progressTimerId, + fadeTimerId, + currentProgress, + showing, + addEvent = function (elem, type, handler) { + if (elem.addEventListener) elem.addEventListener(type, handler, false); + else if (elem.attachEvent) elem.attachEvent("on" + type, handler); + else elem["on" + type] = handler; + }, + options = { + autoRun: true, + barThickness: 3, + barColors: { + 0: "rgba(26, 188, 156, .9)", + ".25": "rgba(52, 152, 219, .9)", + ".50": "rgba(241, 196, 15, .9)", + ".75": "rgba(230, 126, 34, .9)", + "1.0": "rgba(211, 84, 0, .9)", + }, + shadowBlur: 10, + shadowColor: "rgba(0, 0, 0, .6)", + className: null, + }, + repaint = function () { + canvas.width = window.innerWidth; + canvas.height = options.barThickness * 5; // need space for shadow + + var ctx = canvas.getContext("2d"); + ctx.shadowBlur = options.shadowBlur; + ctx.shadowColor = options.shadowColor; + + var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0); + for (var stop in options.barColors) + lineGradient.addColorStop(stop, options.barColors[stop]); + ctx.lineWidth = options.barThickness; + ctx.beginPath(); + ctx.moveTo(0, options.barThickness / 2); + ctx.lineTo( + Math.ceil(currentProgress * canvas.width), + options.barThickness / 2 + ); + ctx.strokeStyle = lineGradient; + ctx.stroke(); + }, + createCanvas = function () { + canvas = document.createElement("canvas"); + var style = canvas.style; + style.position = "fixed"; + style.top = style.left = style.right = style.margin = style.padding = 0; + style.zIndex = 100001; + style.display = "none"; + if (options.className) canvas.classList.add(options.className); + document.body.appendChild(canvas); + addEvent(window, "resize", repaint); + }, + topbar = { + config: function (opts) { + for (var key in opts) + if (options.hasOwnProperty(key)) options[key] = opts[key]; + }, + show: function () { + if (showing) return; + showing = true; + if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId); + if (!canvas) createCanvas(); + canvas.style.opacity = 1; + canvas.style.display = "block"; + topbar.progress(0); + if (options.autoRun) { + (function loop() { + progressTimerId = window.requestAnimationFrame(loop); + topbar.progress( + "+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2) + ); + })(); + } + }, + progress: function (to) { + if (typeof to === "undefined") return currentProgress; + if (typeof to === "string") { + to = + (to.indexOf("+") >= 0 || to.indexOf("-") >= 0 + ? currentProgress + : 0) + parseFloat(to); + } + currentProgress = to > 1 ? 1 : to; + repaint(); + return currentProgress; + }, + hide: function () { + if (!showing) return; + showing = false; + if (progressTimerId != null) { + window.cancelAnimationFrame(progressTimerId); + progressTimerId = null; + } + (function loop() { + if (topbar.progress("+.1") >= 1) { + canvas.style.opacity -= 0.05; + if (canvas.style.opacity <= 0.05) { + canvas.style.display = "none"; + fadeTimerId = null; + return; + } + } + fadeTimerId = window.requestAnimationFrame(loop); + })(); + }, + }; + + if (typeof module === "object" && typeof module.exports === "object") { + module.exports = topbar; + } else if (typeof define === "function" && define.amd) { + define(function () { + return topbar; + }); + } else { + this.topbar = topbar; + } +}.call(this, window, document)); diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/config.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/config.exs new file mode 100644 index 0000000000..4a1915fd83 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/config.exs @@ -0,0 +1,51 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Config module. +# +# This configuration file is loaded before any dependency and +# is restricted to this project. + +# General application configuration +import Config + +config :hello_elixir, + ecto_repos: [HelloElixir.Repo] + +# Configures the endpoint +config :hello_elixir, HelloElixirWeb.Endpoint, + url: [host: "localhost"], + render_errors: [view: HelloElixirWeb.ErrorView, accepts: ~w(html json), layout: false], + pubsub_server: HelloElixir.PubSub, + live_view: [signing_salt: "O1MdfPrK"] + +# Configures the mailer +# +# By default it uses the "Local" adapter which stores the emails +# locally. You can see the emails in your browser, at "/dev/mailbox". +# +# For production it's recommended to configure a different adapter +# at the `config/runtime.exs`. +config :hello_elixir, HelloElixir.Mailer, adapter: Swoosh.Adapters.Local + +# Swoosh API client is needed for adapters other than SMTP. +config :swoosh, :api_client, false + +# Configure esbuild (the version is required) +config :esbuild, + version: "0.12.18", + default: [ + args: ~w(js/app.js --bundle --target=es2016 --outdir=../priv/static/assets), + cd: Path.expand("../assets", __DIR__), + env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)} + ] + +# Configures Elixir's Logger +config :logger, :console, + format: "$time $metadata[$level] $message\n", + metadata: [:request_id] + +# Use Jason for JSON parsing in Phoenix +config :phoenix, :json_library, Jason + +# Import environment specific config. This must remain at the bottom +# of this file so it overrides the configuration defined above. +import_config "#{config_env()}.exs" diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/dev.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/dev.exs new file mode 100644 index 0000000000..0b4dcc3ff4 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/dev.exs @@ -0,0 +1,71 @@ +import Config + +# Configure your database +config :hello_elixir, HelloElixir.Repo, + database: Path.expand("../hello_elixir_dev.db", Path.dirname(__ENV__.file)), + pool_size: 5, + show_sensitive_data_on_connection_error: true + +# For development, we disable any cache and enable +# debugging and code reloading. +# +# The watchers configuration can be used to run external +# watchers to your application. For example, we use it +# with esbuild to bundle .js and .css sources. +config :hello_elixir, HelloElixirWeb.Endpoint, + # Binding to loopback ipv4 address prevents access from other machines. + # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. + http: [ip: {0, 0, 0, 0, 0, 0, 0, 0}, port: 4000], + check_origin: false, + code_reloader: true, + debug_errors: true, + secret_key_base: "04klpwfSfXhaJdwtinv6ScP9dT78hgU+8NxRzgjDi52celjU3UtqeVy9Sv057XH6", + watchers: [ + # Start the esbuild watcher by calling Esbuild.install_and_run(:default, args) + esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]} + ] + +# ## SSL Support +# +# In order to use HTTPS in development, a self-signed +# certificate can be generated by running the following +# Mix task: +# +# mix phx.gen.cert +# +# Note that this task requires Erlang/OTP 20 or later. +# Run `mix help phx.gen.cert` for more information. +# +# The `http:` config above can be replaced with: +# +# https: [ +# port: 4001, +# cipher_suite: :strong, +# keyfile: "priv/cert/selfsigned_key.pem", +# certfile: "priv/cert/selfsigned.pem" +# ], +# +# If desired, both `http:` and `https:` keys can be +# configured to run both http and https servers on +# different ports. + +# Watch static and templates for browser reloading. +config :hello_elixir, HelloElixirWeb.Endpoint, + live_reload: [ + patterns: [ + ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$", + ~r"priv/gettext/.*(po)$", + ~r"lib/hello_elixir_web/(live|views)/.*(ex)$", + ~r"lib/hello_elixir_web/templates/.*(eex)$" + ] + ] + +# Do not include metadata nor timestamps in development logs +config :logger, :console, format: "[$level] $message\n" + +# Set a higher stacktrace during development. Avoid configuring such +# in production as building large stacktraces may be expensive. +config :phoenix, :stacktrace_depth, 20 + +# Initialize plugs at runtime for faster development compilation +config :phoenix, :plug_init_mode, :runtime diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/prod.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/prod.exs new file mode 100644 index 0000000000..bbe0c46f5a --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/prod.exs @@ -0,0 +1,51 @@ +import Config + +# For production, don't forget to configure the url host +# to something meaningful, Phoenix uses this information +# when generating URLs. +# +# Note we also include the path to a cache manifest +# containing the digested version of static files. This +# manifest is generated by the `mix phx.digest` task, +# which you should run after static files are built and +# before starting your production server. +config :hello_elixir, HelloElixirWeb.Endpoint, + url: [host: "example.com", port: 80], + cache_static_manifest: "priv/static/cache_manifest.json" + +# Do not print debug messages in production +config :logger, level: :info + +# ## SSL Support +# +# To get SSL working, you will need to add the `https` key +# to the previous section and set your `:url` port to 443: +# +# config :hello_elixir, HelloElixirWeb.Endpoint, +# ..., +# url: [host: "example.com", port: 443], +# https: [ +# ..., +# port: 443, +# cipher_suite: :strong, +# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"), +# certfile: System.get_env("SOME_APP_SSL_CERT_PATH") +# ] +# +# The `cipher_suite` is set to `:strong` to support only the +# latest and more secure SSL ciphers. This means old browsers +# and clients may not be supported. You can set it to +# `:compatible` for wider support. +# +# `:keyfile` and `:certfile` expect an absolute path to the key +# and cert in disk or a relative path inside priv, for example +# "priv/ssl/server.key". For all supported SSL configuration +# options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1 +# +# We also recommend setting `force_ssl` in your endpoint, ensuring +# no data is ever sent via http, always redirecting to https: +# +# config :hello_elixir, HelloElixirWeb.Endpoint, +# force_ssl: [hsts: true] +# +# Check `Plug.SSL` for all available options in `force_ssl`. diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/runtime.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/runtime.exs new file mode 100644 index 0000000000..c3f2bd1924 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/runtime.exs @@ -0,0 +1,85 @@ +import Config + +# config/runtime.exs is executed for all environments, including +# during releases. It is executed after compilation and before the +# system starts, so it is typically used to load production configuration +# and secrets from environment variables or elsewhere. Do not define +# any compile-time configuration in here, as it won't be applied. +# The block below contains prod specific runtime configuration. +if config_env() == :prod do + database_path = + System.get_env("DATABASE_PATH") || + raise """ + environment variable DATABASE_PATH is missing. + For example: /etc/hello_elixir/hello_elixir.db + """ + + config :hello_elixir, HelloElixir.Repo, + database: database_path, + pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5") + + # The secret key base is used to sign/encrypt cookies and other secrets. + # A default value is used in config/dev.exs and config/test.exs but you + # want to use a different value for prod and you most likely don't want + # to check this value into version control, so we use an environment + # variable instead. + secret_key_base = + System.get_env("SECRET_KEY_BASE") || + raise """ + environment variable SECRET_KEY_BASE is missing. + You can generate one by calling: mix phx.gen.secret + """ + + app_name = + System.get_env("FLY_APP_NAME") || + raise "FLY_APP_NAME not available" + host = "#{app_name}.fly.dev" + port = String.to_integer(System.get_env("PORT") || "4000") + + config :hello_elixir, HelloElixirWeb.Endpoint, + url: [host: "#{app_name}.fly.dev", port: port], + http: [ + # Enable IPv6 and bind on all interfaces. + # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access. + # See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html + # for details about using IPv6 vs IPv4 and loopback vs public addresses. + ip: {0, 0, 0, 0, 0, 0, 0, 0}, + port: String.to_integer(System.get_env("PORT") || "4000") + ], + secret_key_base: secret_key_base + + # ## Using releases + # + # If you are doing OTP releases, you need to instruct Phoenix + # to start each relevant endpoint: + # + config :hello_elixir, HelloElixirWeb.Endpoint, server: true + + # ## Configuring the mailer + # + # In production you need to configure the mailer to use a different adapter. + # Also, you may need to configure the Swoosh API client of your choice if you + # are not using SMTP. Here is an example of the configuration: + # + # config :hello_elixir, HelloElixir.Mailer, + # adapter: Swoosh.Adapters.Mailgun, + # api_key: System.get_env("MAILGUN_API_KEY"), + # domain: System.get_env("MAILGUN_DOMAIN") + # + # For this example you need include a HTTP client required by Swoosh API client. + # Swoosh supports Hackney and Finch out of the box: + # + # config :swoosh, :api_client, Swoosh.ApiClient.Hackney + # + # See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details. +end + +if config_env() == :dev do + database_url = System.get_env("DATABASE_URL") + + if database_url != nil do + config :hello_elixir, HelloElixir.Repo, + url: database_url, + socket_options: [:inet6] + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/test.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/test.exs new file mode 100644 index 0000000000..edc3766467 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/config/test.exs @@ -0,0 +1,30 @@ +import Config + +# Configure your database +# +# The MIX_TEST_PARTITION environment variable can be used +# to provide built-in test partitioning in CI environment. +# Run `mix help test` for more information. +config :hello_elixir, HelloElixir.Repo, + username: "postgres", + password: "postgres", + database: "hello_elixir_test#{System.get_env("MIX_TEST_PARTITION")}", + hostname: "localhost", + pool: Ecto.Adapters.SQL.Sandbox, + pool_size: 10 + +# We don't run a server during test. If one is required, +# you can enable the server option below. +config :hello_elixir, HelloElixirWeb.Endpoint, + http: [ip: {127, 0, 0, 1}, port: 4002], + secret_key_base: "ZSboDtvMYxxeMHqCOlTGvFkIAXNXUONkHC3mt3CE+34iYHClSKlJ1FMxA3/oK8lG", + server: false + +# In test we don't send emails. +config :hello_elixir, HelloElixir.Mailer, adapter: Swoosh.Adapters.Test + +# Print only warnings and errors during test +config :logger, level: :warn + +# Initialize plugs at runtime for faster test compilation +config :phoenix, :plug_init_mode, :runtime diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/entrypoint.sh b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/entrypoint.sh new file mode 100755 index 0000000000..d4def0a0b8 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ ! -f /data/prod.db ]; then + echo "Creating database file" + sqlite3 /data/prod.db +fi + +/app/entry eval HelloElixir.Release.migrate && \ + /app/entry start \ No newline at end of file diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml new file mode 100644 index 0000000000..08034cd905 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml @@ -0,0 +1,40 @@ +kill_signal = "SIGTERM" +kill_timeout = 5 +processes = [] + +[env] + DATABASE_PATH = "/data/prod.db" + PORT = "8080" + +[experimental] + allowed_public_ports = [] + auto_rollback = true + +[mounts] + destination = "/data" + source = "database_data" + +[[services]] + http_checks = [] + internal_port = 8080 + processes = ["app"] + protocol = "tcp" + script_checks = [] + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" + + [[services.ports]] + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + + [[services.tcp_checks]] + grace_period = "30s" + interval = "15s" + restart_limit = 0 + timeout = "2s" diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir.ex new file mode 100644 index 0000000000..b45535df51 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir.ex @@ -0,0 +1,9 @@ +defmodule HelloElixir do + @moduledoc """ + HelloElixir keeps the contexts that define your domain + and business logic. + + Contexts are also responsible for managing your data, regardless + if it comes from the database, an external API or others. + """ +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/application.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/application.ex new file mode 100644 index 0000000000..e98c8a7e89 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/application.ex @@ -0,0 +1,36 @@ +defmodule HelloElixir.Application do + # See https://hexdocs.pm/elixir/Application.html + # for more information on OTP Applications + @moduledoc false + + use Application + + @impl true + def start(_type, _args) do + children = [ + # Start the Ecto repository + HelloElixir.Repo, + # Start the Telemetry supervisor + HelloElixirWeb.Telemetry, + # Start the PubSub system + {Phoenix.PubSub, name: HelloElixir.PubSub}, + # Start the Endpoint (http/https) + HelloElixirWeb.Endpoint + # Start a worker by calling: HelloElixir.Worker.start_link(arg) + # {HelloElixir.Worker, arg} + ] + + # See https://hexdocs.pm/elixir/Supervisor.html + # for other strategies and supported options + opts = [strategy: :one_for_one, name: HelloElixir.Supervisor] + Supervisor.start_link(children, opts) + end + + # Tell Phoenix to update the endpoint configuration + # whenever the application is updated. + @impl true + def config_change(changed, _new, removed) do + HelloElixirWeb.Endpoint.config_change(changed, removed) + :ok + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/mailer.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/mailer.ex new file mode 100644 index 0000000000..12967a7ed3 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/mailer.ex @@ -0,0 +1,3 @@ +defmodule HelloElixir.Mailer do + use Swoosh.Mailer, otp_app: :hello_elixir +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/release.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/release.ex new file mode 100644 index 0000000000..9208e1cc87 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/release.ex @@ -0,0 +1,28 @@ +defmodule HelloElixir.Release do + @moduledoc """ + Used for executing DB release tasks when run in production without Mix + installed. + """ + @app :hello_elixir + + def migrate do + load_app() + + for repo <- repos() do + {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true)) + end + end + + def rollback(repo, version) do + load_app() + {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version)) + end + + defp repos do + Application.fetch_env!(@app, :ecto_repos) + end + + defp load_app do + Application.load(@app) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/repo.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/repo.ex new file mode 100644 index 0000000000..8d5e8e7da5 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir/repo.ex @@ -0,0 +1,5 @@ +defmodule HelloElixir.Repo do + use Ecto.Repo, + otp_app: :hello_elixir, + adapter: Ecto.Adapters.SQLite3 +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web.ex new file mode 100644 index 0000000000..f7a1ca26ff --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web.ex @@ -0,0 +1,102 @@ +defmodule HelloElixirWeb do + @moduledoc """ + The entrypoint for defining your web interface, such + as controllers, views, channels and so on. + + This can be used in your application as: + + use HelloElixirWeb, :controller + use HelloElixirWeb, :view + + The definitions below will be executed for every view, + controller, etc, so keep them short and clean, focused + on imports, uses and aliases. + + Do NOT define functions inside the quoted expressions + below. Instead, define any helper function in modules + and import those modules here. + """ + + def controller do + quote do + use Phoenix.Controller, namespace: HelloElixirWeb + + import Plug.Conn + import HelloElixirWeb.Gettext + alias HelloElixirWeb.Router.Helpers, as: Routes + end + end + + def view do + quote do + use Phoenix.View, + root: "lib/hello_elixir_web/templates", + namespace: HelloElixirWeb + + # Import convenience functions from controllers + import Phoenix.Controller, + only: [get_flash: 1, get_flash: 2, view_module: 1, view_template: 1] + + # Include shared imports and aliases for views + unquote(view_helpers()) + end + end + + def live_view do + quote do + use Phoenix.LiveView, + layout: {HelloElixirWeb.LayoutView, "live.html"} + + unquote(view_helpers()) + end + end + + def live_component do + quote do + use Phoenix.LiveComponent + + unquote(view_helpers()) + end + end + + def router do + quote do + use Phoenix.Router + + import Plug.Conn + import Phoenix.Controller + import Phoenix.LiveView.Router + end + end + + def channel do + quote do + use Phoenix.Channel + import HelloElixirWeb.Gettext + end + end + + defp view_helpers do + quote do + # Use all HTML functionality (forms, tags, etc) + use Phoenix.HTML + + # Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc) + import Phoenix.LiveView.Helpers + + # Import basic rendering functionality (render, render_layout, etc) + import Phoenix.View + + import HelloElixirWeb.ErrorHelpers + import HelloElixirWeb.Gettext + alias HelloElixirWeb.Router.Helpers, as: Routes + end + end + + @doc """ + When used, dispatch to the appropriate controller/view/etc. + """ + defmacro __using__(which) when is_atom(which) do + apply(__MODULE__, which, []) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/controllers/page_controller.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/controllers/page_controller.ex new file mode 100644 index 0000000000..a989f86306 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/controllers/page_controller.ex @@ -0,0 +1,7 @@ +defmodule HelloElixirWeb.PageController do + use HelloElixirWeb, :controller + + def index(conn, _params) do + render(conn, "index.html") + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/endpoint.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/endpoint.ex new file mode 100644 index 0000000000..d2fba4562e --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/endpoint.ex @@ -0,0 +1,50 @@ +defmodule HelloElixirWeb.Endpoint do + use Phoenix.Endpoint, otp_app: :hello_elixir + + # The session will be stored in the cookie and signed, + # this means its contents can be read but not tampered with. + # Set :encryption_salt if you would also like to encrypt it. + @session_options [ + store: :cookie, + key: "_hello_elixir_key", + signing_salt: "eCMCnkFM" + ] + + socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]] + + # Serve at "/" the static files from "priv/static" directory. + # + # You should set gzip to true if you are running phx.digest + # when deploying your static files in production. + plug Plug.Static, + at: "/", + from: :hello_elixir, + gzip: false, + only: ~w(assets fonts images favicon.ico robots.txt) + + # Code reloading can be explicitly enabled under the + # :code_reloader configuration of your endpoint. + if code_reloading? do + socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket + plug Phoenix.LiveReloader + plug Phoenix.CodeReloader + plug Phoenix.Ecto.CheckRepoStatus, otp_app: :hello_elixir + end + + plug Phoenix.LiveDashboard.RequestLogger, + param_key: "request_logger", + cookie_key: "request_logger" + + plug Plug.RequestId + plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint] + + plug Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + pass: ["*/*"], + json_decoder: Phoenix.json_library() + + plug Plug.MethodOverride + plug Plug.Head + plug Plug.Session, @session_options + plug HelloElixirWeb.Router +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/gettext.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/gettext.ex new file mode 100644 index 0000000000..9c7b951acf --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/gettext.ex @@ -0,0 +1,24 @@ +defmodule HelloElixirWeb.Gettext do + @moduledoc """ + A module providing Internationalization with a gettext-based API. + + By using [Gettext](https://hexdocs.pm/gettext), + your module gains a set of macros for translations, for example: + + import HelloElixirWeb.Gettext + + # Simple translation + gettext("Here is the string to translate") + + # Plural translation + ngettext("Here is the string to translate", + "Here are the strings to translate", + 3) + + # Domain-based translation + dgettext("errors", "Here is the error message to translate") + + See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. + """ + use Gettext, otp_app: :hello_elixir +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/router.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/router.ex new file mode 100644 index 0000000000..7d36000513 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/router.ex @@ -0,0 +1,55 @@ +defmodule HelloElixirWeb.Router do + use HelloElixirWeb, :router + + pipeline :browser do + plug :accepts, ["html"] + plug :fetch_session + plug :fetch_live_flash + plug :put_root_layout, {HelloElixirWeb.LayoutView, :root} + plug :protect_from_forgery + plug :put_secure_browser_headers + end + + pipeline :api do + plug :accepts, ["json"] + end + + scope "/", HelloElixirWeb do + pipe_through :browser + + get "/", PageController, :index + end + + # Other scopes may use custom stacks. + # scope "/api", HelloElixirWeb do + # pipe_through :api + # end + + # Enables LiveDashboard only for development + # + # If you want to use the LiveDashboard in production, you should put + # it behind authentication and allow only admins to access it. + # If your application does not have an admins-only section yet, + # you can use Plug.BasicAuth to set up some basic authentication + # as long as you are also using SSL (which you should anyway). + if Mix.env() in [:dev, :test] do + import Phoenix.LiveDashboard.Router + + scope "/" do + pipe_through :browser + live_dashboard "/dashboard", metrics: HelloElixirWeb.Telemetry + end + end + + # Enables the Swoosh mailbox preview in development. + # + # Note that preview only shows emails that were sent by the same + # node running the Phoenix server. + if Mix.env() == :dev do + scope "/dev" do + pipe_through :browser + + forward "/mailbox", Plug.Swoosh.MailboxPreview + end + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/telemetry.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/telemetry.ex new file mode 100644 index 0000000000..55a252c0df --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/telemetry.ex @@ -0,0 +1,71 @@ +defmodule HelloElixirWeb.Telemetry do + use Supervisor + import Telemetry.Metrics + + def start_link(arg) do + Supervisor.start_link(__MODULE__, arg, name: __MODULE__) + end + + @impl true + def init(_arg) do + children = [ + # Telemetry poller will execute the given period measurements + # every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics + {:telemetry_poller, measurements: periodic_measurements(), period: 10_000} + # Add reporters as children of your supervision tree. + # {Telemetry.Metrics.ConsoleReporter, metrics: metrics()} + ] + + Supervisor.init(children, strategy: :one_for_one) + end + + def metrics do + [ + # Phoenix Metrics + summary("phoenix.endpoint.stop.duration", + unit: {:native, :millisecond} + ), + summary("phoenix.router_dispatch.stop.duration", + tags: [:route], + unit: {:native, :millisecond} + ), + + # Database Metrics + summary("hello_elixir.repo.query.total_time", + unit: {:native, :millisecond}, + description: "The sum of the other measurements" + ), + summary("hello_elixir.repo.query.decode_time", + unit: {:native, :millisecond}, + description: "The time spent decoding the data received from the database" + ), + summary("hello_elixir.repo.query.query_time", + unit: {:native, :millisecond}, + description: "The time spent executing the query" + ), + summary("hello_elixir.repo.query.queue_time", + unit: {:native, :millisecond}, + description: "The time spent waiting for a database connection" + ), + summary("hello_elixir.repo.query.idle_time", + unit: {:native, :millisecond}, + description: + "The time the connection spent waiting before being checked out for the query" + ), + + # VM Metrics + summary("vm.memory.total", unit: {:byte, :kilobyte}), + summary("vm.total_run_queue_lengths.total"), + summary("vm.total_run_queue_lengths.cpu"), + summary("vm.total_run_queue_lengths.io") + ] + end + + defp periodic_measurements do + [ + # A module, function and arguments to be invoked periodically. + # This function must call :telemetry.execute/3 and a metric must be added above. + # {HelloElixirWeb, :count_users, []} + ] + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/app.html.heex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/app.html.heex new file mode 100644 index 0000000000..169aed9569 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/app.html.heex @@ -0,0 +1,5 @@ +
+ + + <%= @inner_content %> +
diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/live.html.heex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/live.html.heex new file mode 100644 index 0000000000..a29d604480 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/live.html.heex @@ -0,0 +1,11 @@ +
+ + + + + <%= @inner_content %> +
diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/root.html.heex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/root.html.heex new file mode 100644 index 0000000000..9fd12947d8 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/layout/root.html.heex @@ -0,0 +1,30 @@ + + + + + + + <%= csrf_meta_tag() %> + <%= live_title_tag assigns[:page_title] || "HelloElixir", suffix: " · Phoenix Framework" %> + + + + +
+
+ + +
+
+ <%= @inner_content %> + + diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/page/index.html.heex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/page/index.html.heex new file mode 100644 index 0000000000..f844bd8d7a --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/templates/page/index.html.heex @@ -0,0 +1,41 @@ +
+

<%= gettext "Welcome to %{name}!", name: "Phoenix" %>

+

Peace of mind from prototype to production

+
+ +
+ + +
diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_helpers.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_helpers.ex new file mode 100644 index 0000000000..00f2e5e770 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_helpers.ex @@ -0,0 +1,47 @@ +defmodule HelloElixirWeb.ErrorHelpers do + @moduledoc """ + Conveniences for translating and building error messages. + """ + + use Phoenix.HTML + + @doc """ + Generates tag for inlined form input errors. + """ + def error_tag(form, field) do + Enum.map(Keyword.get_values(form.errors, field), fn error -> + content_tag(:span, translate_error(error), + class: "invalid-feedback", + phx_feedback_for: input_name(form, field) + ) + end) + end + + @doc """ + Translates an error message using gettext. + """ + def translate_error({msg, opts}) do + # When using gettext, we typically pass the strings we want + # to translate as a static argument: + # + # # Translate "is invalid" in the "errors" domain + # dgettext("errors", "is invalid") + # + # # Translate the number of files with plural rules + # dngettext("errors", "1 file", "%{count} files", count) + # + # Because the error messages we show in our forms and APIs + # are defined inside Ecto, we need to translate them dynamically. + # This requires us to call the Gettext module passing our gettext + # backend as first argument. + # + # Note we use the "errors" domain, which means translations + # should be written to the errors.po file. The :count option is + # set by Ecto and indicates we should also apply plural rules. + if count = opts[:count] do + Gettext.dngettext(HelloElixirWeb.Gettext, "errors", msg, msg, count, opts) + else + Gettext.dgettext(HelloElixirWeb.Gettext, "errors", msg, opts) + end + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_view.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_view.ex new file mode 100644 index 0000000000..2641b6f961 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/error_view.ex @@ -0,0 +1,16 @@ +defmodule HelloElixirWeb.ErrorView do + use HelloElixirWeb, :view + + # If you want to customize a particular status code + # for a certain format, you may uncomment below. + # def render("500.html", _assigns) do + # "Internal Server Error" + # end + + # By default, Phoenix returns the status message from + # the template name. For example, "404.html" becomes + # "Not Found". + def template_not_found(template, _assigns) do + Phoenix.Controller.status_message_from_template(template) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/layout_view.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/layout_view.ex new file mode 100644 index 0000000000..afa45f3d0f --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/layout_view.ex @@ -0,0 +1,7 @@ +defmodule HelloElixirWeb.LayoutView do + use HelloElixirWeb, :view + + # Phoenix LiveDashboard is available only in development by default, + # so we instruct Elixir to not warn if the dashboard route is missing. + @compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}} +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/page_view.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/page_view.ex new file mode 100644 index 0000000000..76043f1154 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/lib/hello_elixir_web/views/page_view.ex @@ -0,0 +1,3 @@ +defmodule HelloElixirWeb.PageView do + use HelloElixirWeb, :view +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.exs new file mode 100644 index 0000000000..e7602f8892 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.exs @@ -0,0 +1,70 @@ +defmodule HelloElixir.MixProject do + use Mix.Project + + def project do + [ + app: :hello_elixir, + version: "0.1.0", + elixir: "~> 1.12", + elixirc_paths: elixirc_paths(Mix.env()), + compilers: [:gettext] ++ Mix.compilers(), + start_permanent: Mix.env() == :prod, + aliases: aliases(), + deps: deps() + ] + end + + # Configuration for the OTP application. + # + # Type `mix help compile.app` for more information. + def application do + [ + mod: {HelloElixir.Application, []}, + extra_applications: [:logger, :runtime_tools] + ] + end + + # Specifies which paths to compile per environment. + defp elixirc_paths(:test), do: ["lib", "test/support"] + defp elixirc_paths(_), do: ["lib"] + + # Specifies your project dependencies. + # + # Type `mix help deps` for examples and options. + defp deps do + [ + {:phoenix, "~> 1.6.11"}, + {:phoenix_ecto, "~> 4.4"}, + {:ecto_sql, "~> 3.6"}, + {:ecto_sqlite3, ">= 0.0.0"}, + {:phoenix_html, "~> 3.0"}, + {:phoenix_live_reload, "~> 1.2", only: :dev}, + {:phoenix_live_view, "~> 0.16.0"}, + {:floki, ">= 0.30.0", only: :test}, + {:phoenix_live_dashboard, "~> 0.5"}, + {:esbuild, "~> 0.2", runtime: Mix.env() == :dev}, + {:swoosh, "~> 1.3"}, + {:telemetry_metrics, "~> 0.6"}, + {:telemetry_poller, "~> 1.0"}, + {:gettext, "~> 0.18"}, + {:jason, "~> 1.2"}, + {:plug_cowboy, "~> 2.5"} + ] + end + + # Aliases are shortcuts or tasks specific to the current project. + # For example, to install project dependencies and perform other setup tasks, run: + # + # $ mix setup + # + # See the documentation for `Mix` for more info on aliases. + defp aliases do + [ + setup: ["deps.get", "ecto.setup"], + "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"], + "ecto.reset": ["ecto.drop", "ecto.setup"], + test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"], + "assets.deploy": ["esbuild default --minify", "phx.digest"] + ] + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.lock b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.lock new file mode 100644 index 0000000000..dac6ff8500 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/mix.lock @@ -0,0 +1,38 @@ +%{ + "castore": {:hex, :castore, "0.1.13", "ccf3ab251ffaebc4319f41d788ce59a6ab3f42b6c27e598ad838ffecee0b04f9", [:mix], [], "hexpm", "a14a7eecfec7e20385493dbb92b0d12c5d77ecfd6307de10102d58c94e8c49c0"}, + "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, + "cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"}, + "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"}, + "cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"}, + "db_connection": {:hex, :db_connection, "2.4.1", "6411f6e23f1a8b68a82fa3a36366d4881f21f47fc79a9efb8c615e62050219da", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ea36d226ec5999781a9a8ad64e5d8c4454ecedc7a4d643e4832bf08efca01f00"}, + "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, + "ecto": {:hex, :ecto, "3.7.1", "a20598862351b29f80f285b21ec5297da1181c0442687f9b8329f0445d228892", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d36e5b39fc479e654cffd4dbe1865d9716e4a9b6311faff799b6f90ab81b8638"}, + "ecto_sql": {:hex, :ecto_sql, "3.7.1", "8de624ef50b2a8540252d8c60506379fbbc2707be1606853df371cf53df5d053", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.4.0 or ~> 0.5.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2b42a32e2ce92f64aba5c88617891ab3b0ba34f3f3a503fa20009eae1a401c81"}, + "ecto_sqlite3": {:hex, :ecto_sqlite3, "0.7.2", "667338c1e0f7af13f75ab9eec13afcea216eb71dac9daf7897c8f0acc8b5722b", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.7", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:exqlite, "~> 0.6", [hex: :exqlite, repo: "hexpm", optional: false]}], "hexpm", "b003804132f183d1d6dc759f6c2ccc60c1fb5d62e1db4aa4fe0d38577096f7c4"}, + "elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"}, + "esbuild": {:hex, :esbuild, "0.3.4", "416203c642eb84b207f882cf7953a1fd7bb71e23f5f86554f983bb7bad18b897", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "c472e38b37e9547113776b1e4b64b44ec540bcc7056dd252c2c3ffba41aa9793"}, + "exqlite": {:hex, :exqlite, "0.8.5", "f4b38c56019d9582de800c7a4057dc228c60eff51212fd17dea60152ab1fb95a", [:make, :mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "a4a0a34b4f1306852fb951a86d44a5ee48a251c464de8e968e8e2b3fb982fe3c"}, + "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "floki": {:hex, :floki, "0.32.0", "f915dc15258bc997d49be1f5ef7d3992f8834d6f5695270acad17b41f5bcc8e2", [:mix], [{:html_entities, "~> 0.5.0", [hex: :html_entities, repo: "hexpm", optional: false]}], "hexpm", "1c5a91cae1fd8931c26a4826b5e2372c284813904c8bacb468b5de39c7ececbd"}, + "gettext": {:hex, :gettext, "0.18.2", "7df3ea191bb56c0309c00a783334b288d08a879f53a7014341284635850a6e55", [:mix], [], "hexpm", "f9f537b13d4fdd30f3039d33cb80144c3aa1f8d9698e47d7bcbcc8df93b1f5c5"}, + "html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"}, + "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, + "mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"}, + "phoenix": {:hex, :phoenix, "1.6.11", "29f3c0fd12fa1fc4d4b05e341578e55bc78d96ea83a022587a7e276884d397e4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "1664e34f80c25ea4918fbadd957f491225ef601c0e00b4e644b1a772864bfbc2"}, + "phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"}, + "phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"}, + "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.5.3", "ff153c46aee237dd7244f07e9b98d557fe0d1de7a5916438e634c3be2d13c607", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:phoenix_live_view, "~> 0.16.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "e36e62b1f61c19b645853af78290a5e7900f7cae1e676714ff69f9836e2f2e76"}, + "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "0.16.4", "5692edd0bac247a9a816eee7394e32e7a764959c7d0cf9190662fc8b0cd24c97", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.5.9 or ~> 1.6.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "754ba49aa2e8601afd4f151492c93eb72df69b0b9856bab17711b8397e43bba0"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"}, + "phoenix_view": {:hex, :phoenix_view, "1.1.2", "1b82764a065fb41051637872c7bd07ed2fdb6f5c3bd89684d4dca6e10115c95a", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "7ae90ad27b09091266f6adbb61e1d2516a7c3d7062c6789d46a7554ec40f3a56"}, + "plug": {:hex, :plug, "1.13.6", "187beb6b67c6cec50503e940f0434ea4692b19384d47e5fdfd701e93cadb4cc2", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "02b9c6b9955bce92c829f31d6284bf53c591ca63c4fb9ff81dfd0418667a34ff"}, + "plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"}, + "plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"}, + "postgrex": {:hex, :postgrex, "0.15.13", "7794e697481799aee8982688c261901de493eb64451feee6ea58207d7266d54a", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "3ffb76e1a97cfefe5c6a95632a27ffb67f28871c9741fb585f9d1c3cd2af70f1"}, + "ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"}, + "swoosh": {:hex, :swoosh, "1.5.1", "ec1b3fa6a092597ac02444c36c6e3c2bc90c89c02e4e0cb262725d07d610c989", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "867395cbf0d764b24b6bf3c375137b98432cedb8c7f91ef9bd1c379cf626ac42"}, + "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, + "telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"}, + "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, +} diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/en/LC_MESSAGES/errors.po b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/en/LC_MESSAGES/errors.po new file mode 100644 index 0000000000..844c4f5cea --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/en/LC_MESSAGES/errors.po @@ -0,0 +1,112 @@ +## `msgid`s in this file come from POT (.pot) files. +## +## Do not add, change, or remove `msgid`s manually here as +## they're tied to the ones in the corresponding POT file +## (with the same domain). +## +## Use `mix gettext.extract --merge` or `mix gettext.merge` +## to merge POT files into PO files. +msgid "" +msgstr "" +"Language: en\n" + +## From Ecto.Changeset.cast/4 +msgid "can't be blank" +msgstr "" + +## From Ecto.Changeset.unique_constraint/3 +msgid "has already been taken" +msgstr "" + +## From Ecto.Changeset.put_change/3 +msgid "is invalid" +msgstr "" + +## From Ecto.Changeset.validate_acceptance/3 +msgid "must be accepted" +msgstr "" + +## From Ecto.Changeset.validate_format/3 +msgid "has invalid format" +msgstr "" + +## From Ecto.Changeset.validate_subset/3 +msgid "has an invalid entry" +msgstr "" + +## From Ecto.Changeset.validate_exclusion/3 +msgid "is reserved" +msgstr "" + +## From Ecto.Changeset.validate_confirmation/3 +msgid "does not match confirmation" +msgstr "" + +## From Ecto.Changeset.no_assoc_constraint/3 +msgid "is still associated with this entry" +msgstr "" + +msgid "are still associated with this entry" +msgstr "" + +## From Ecto.Changeset.validate_length/3 +msgid "should have %{count} item(s)" +msgid_plural "should have %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be %{count} character(s)" +msgid_plural "should be %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be %{count} byte(s)" +msgid_plural "should be %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at least %{count} item(s)" +msgid_plural "should have at least %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} character(s)" +msgid_plural "should be at least %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} byte(s)" +msgid_plural "should be at least %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at most %{count} item(s)" +msgid_plural "should have at most %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} character(s)" +msgid_plural "should be at most %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} byte(s)" +msgid_plural "should be at most %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +## From Ecto.Changeset.validate_number/3 +msgid "must be less than %{number}" +msgstr "" + +msgid "must be greater than %{number}" +msgstr "" + +msgid "must be less than or equal to %{number}" +msgstr "" + +msgid "must be greater than or equal to %{number}" +msgstr "" + +msgid "must be equal to %{number}" +msgstr "" diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/errors.pot b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/errors.pot new file mode 100644 index 0000000000..39a220be35 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/gettext/errors.pot @@ -0,0 +1,95 @@ +## This is a PO Template file. +## +## `msgid`s here are often extracted from source code. +## Add new translations manually only if they're dynamic +## translations that can't be statically extracted. +## +## Run `mix gettext.extract` to bring this file up to +## date. Leave `msgstr`s empty as changing them here has no +## effect: edit them in PO (`.po`) files instead. + +## From Ecto.Changeset.cast/4 +msgid "can't be blank" +msgstr "" + +## From Ecto.Changeset.unique_constraint/3 +msgid "has already been taken" +msgstr "" + +## From Ecto.Changeset.put_change/3 +msgid "is invalid" +msgstr "" + +## From Ecto.Changeset.validate_acceptance/3 +msgid "must be accepted" +msgstr "" + +## From Ecto.Changeset.validate_format/3 +msgid "has invalid format" +msgstr "" + +## From Ecto.Changeset.validate_subset/3 +msgid "has an invalid entry" +msgstr "" + +## From Ecto.Changeset.validate_exclusion/3 +msgid "is reserved" +msgstr "" + +## From Ecto.Changeset.validate_confirmation/3 +msgid "does not match confirmation" +msgstr "" + +## From Ecto.Changeset.no_assoc_constraint/3 +msgid "is still associated with this entry" +msgstr "" + +msgid "are still associated with this entry" +msgstr "" + +## From Ecto.Changeset.validate_length/3 +msgid "should be %{count} character(s)" +msgid_plural "should be %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have %{count} item(s)" +msgid_plural "should have %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} character(s)" +msgid_plural "should be at least %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at least %{count} item(s)" +msgid_plural "should have at least %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} character(s)" +msgid_plural "should be at most %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at most %{count} item(s)" +msgid_plural "should have at most %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +## From Ecto.Changeset.validate_number/3 +msgid "must be less than %{number}" +msgstr "" + +msgid "must be greater than %{number}" +msgstr "" + +msgid "must be less than or equal to %{number}" +msgstr "" + +msgid "must be greater than or equal to %{number}" +msgstr "" + +msgid "must be equal to %{number}" +msgstr "" diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/.formatter.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/.formatter.exs new file mode 100644 index 0000000000..49f9151ed2 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/.formatter.exs @@ -0,0 +1,4 @@ +[ + import_deps: [:ecto_sql], + inputs: ["*.exs"] +] diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/20210505214438_create_a_migration_to_run.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/20210505214438_create_a_migration_to_run.exs new file mode 100644 index 0000000000..f54f5a50aa --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/migrations/20210505214438_create_a_migration_to_run.exs @@ -0,0 +1,9 @@ +defmodule HelloElixir.Repo.Migrations.CreateAMigrationToRun do + use Ecto.Migration + + def change do + create table(:testing) do + add :name, :string + end + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/seeds.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/seeds.exs new file mode 100644 index 0000000000..d86886fce4 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/repo/seeds.exs @@ -0,0 +1,11 @@ +# Script for populating the database. You can run it as: +# +# mix run priv/repo/seeds.exs +# +# Inside the script, you can read and write to any of your +# repositories directly: +# +# HelloElixir.Repo.insert!(%HelloElixir.SomeSchema{}) +# +# We recommend using the bang functions (`insert!`, `update!` +# and so on) as they will fail if something goes wrong. diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/favicon.ico b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..73de524aaadcf60fbe9d32881db0aa86b58b5cb9 GIT binary patch literal 1258 zcmbtUO>fgM7{=qN=;Mz_82;lvPEdVaxv-<-&=sZLwab?3I zBP>U*&(Hv<5n@9ZQ$vhg#|u$Zmtq8BV;+W*7(?jOx-{r?#TE&$Sdq77MbdJjD5`-q zMm_z(jLv3t>5NhzK{%aG(Yudfpjd3AFdKe2U7&zdepTe>^s(@!&0X8TJ`h+-I?84Ml# literal 0 HcmV?d00001 diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/images/phoenix.png b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/images/phoenix.png new file mode 100644 index 0000000000000000000000000000000000000000..9c81075f63d2151e6f40e9aa66f665749a87cc6a GIT binary patch literal 13900 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 UWxWXg`G1#+f~I_}taaG`2PLnS&Hw-a literal 0 HcmV?d00001 diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/robots.txt b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/robots.txt new file mode 100644 index 0000000000..3c9c7c01f3 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/priv/static/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/controllers/page_controller_test.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/controllers/page_controller_test.exs new file mode 100644 index 0000000000..9d038702dc --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/controllers/page_controller_test.exs @@ -0,0 +1,8 @@ +defmodule HelloElixirWeb.PageControllerTest do + use HelloElixirWeb.ConnCase + + test "GET /", %{conn: conn} do + conn = get(conn, "/") + assert html_response(conn, 200) =~ "Welcome to Phoenix!" + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/error_view_test.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/error_view_test.exs new file mode 100644 index 0000000000..5fd9a978e5 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/error_view_test.exs @@ -0,0 +1,14 @@ +defmodule HelloElixirWeb.ErrorViewTest do + use HelloElixirWeb.ConnCase, async: true + + # Bring render/3 and render_to_string/3 for testing custom views + import Phoenix.View + + test "renders 404.html" do + assert render_to_string(HelloElixirWeb.ErrorView, "404.html", []) == "Not Found" + end + + test "renders 500.html" do + assert render_to_string(HelloElixirWeb.ErrorView, "500.html", []) == "Internal Server Error" + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/layout_view_test.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/layout_view_test.exs new file mode 100644 index 0000000000..d2f4dde964 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/layout_view_test.exs @@ -0,0 +1,8 @@ +defmodule HelloElixirWeb.LayoutViewTest do + use HelloElixirWeb.ConnCase, async: true + + # When testing helpers, you may want to import Phoenix.HTML and + # use functions such as safe_to_string() to convert the helper + # result into an HTML string. + # import Phoenix.HTML +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/page_view_test.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/page_view_test.exs new file mode 100644 index 0000000000..56f7b3f364 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/hello_elixir_web/views/page_view_test.exs @@ -0,0 +1,3 @@ +defmodule HelloElixirWeb.PageViewTest do + use HelloElixirWeb.ConnCase, async: true +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/channel_case.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/channel_case.ex new file mode 100644 index 0000000000..bd43e84840 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/channel_case.ex @@ -0,0 +1,36 @@ +defmodule HelloElixirWeb.ChannelCase do + @moduledoc """ + This module defines the test case to be used by + channel tests. + + Such tests rely on `Phoenix.ChannelTest` and also + import other functionality to make it easier + to build common data structures and query the data layer. + + Finally, if the test case interacts with the database, + we enable the SQL sandbox, so changes done to the database + are reverted at the end of every test. If you are using + PostgreSQL, you can even run database tests asynchronously + by setting `use HelloElixirWeb.ChannelCase, async: true`, although + this option is not recommended for other databases. + """ + + use ExUnit.CaseTemplate + + using do + quote do + # Import conveniences for testing with channels + import Phoenix.ChannelTest + import HelloElixirWeb.ChannelCase + + # The default endpoint for testing + @endpoint HelloElixirWeb.Endpoint + end + end + + setup tags do + pid = Ecto.Adapters.SQL.Sandbox.start_owner!(HelloElixir.Repo, shared: not tags[:async]) + on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) + :ok + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/conn_case.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/conn_case.ex new file mode 100644 index 0000000000..bb54608c26 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/conn_case.ex @@ -0,0 +1,39 @@ +defmodule HelloElixirWeb.ConnCase do + @moduledoc """ + This module defines the test case to be used by + tests that require setting up a connection. + + Such tests rely on `Phoenix.ConnTest` and also + import other functionality to make it easier + to build common data structures and query the data layer. + + Finally, if the test case interacts with the database, + we enable the SQL sandbox, so changes done to the database + are reverted at the end of every test. If you are using + PostgreSQL, you can even run database tests asynchronously + by setting `use HelloElixirWeb.ConnCase, async: true`, although + this option is not recommended for other databases. + """ + + use ExUnit.CaseTemplate + + using do + quote do + # Import conveniences for testing with connections + import Plug.Conn + import Phoenix.ConnTest + import HelloElixirWeb.ConnCase + + alias HelloElixirWeb.Router.Helpers, as: Routes + + # The default endpoint for testing + @endpoint HelloElixirWeb.Endpoint + end + end + + setup tags do + pid = Ecto.Adapters.SQL.Sandbox.start_owner!(HelloElixir.Repo, shared: not tags[:async]) + on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) + {:ok, conn: Phoenix.ConnTest.build_conn()} + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/data_case.ex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/data_case.ex new file mode 100644 index 0000000000..ec92db34bc --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/support/data_case.ex @@ -0,0 +1,51 @@ +defmodule HelloElixir.DataCase do + @moduledoc """ + This module defines the setup for tests requiring + access to the application's data layer. + + You may define functions here to be used as helpers in + your tests. + + Finally, if the test case interacts with the database, + we enable the SQL sandbox, so changes done to the database + are reverted at the end of every test. If you are using + PostgreSQL, you can even run database tests asynchronously + by setting `use HelloElixir.DataCase, async: true`, although + this option is not recommended for other databases. + """ + + use ExUnit.CaseTemplate + + using do + quote do + alias HelloElixir.Repo + + import Ecto + import Ecto.Changeset + import Ecto.Query + import HelloElixir.DataCase + end + end + + setup tags do + pid = Ecto.Adapters.SQL.Sandbox.start_owner!(HelloElixir.Repo, shared: not tags[:async]) + on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) + :ok + end + + @doc """ + A helper that transforms changeset errors into a map of messages. + + assert {:error, changeset} = Accounts.create_user(%{password: "short"}) + assert "password is too short" in errors_on(changeset).password + assert %{password: ["password is too short"]} = errors_on(changeset) + + """ + def errors_on(changeset) do + Ecto.Changeset.traverse_errors(changeset, fn {message, opts} -> + Regex.replace(~r"%{(\w+)}", message, fn _, key -> + opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string() + end) + end) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/test_helper.exs b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/test_helper.exs new file mode 100644 index 0000000000..f69e09f589 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/test/test_helper.exs @@ -0,0 +1,2 @@ +ExUnit.start() +Ecto.Adapters.SQL.Sandbox.mode(HelloElixir.Repo, :manual) diff --git a/test/testlib/deployer.go b/test/testlib/deployer.go index 04637e85fa..ca34434312 100644 --- a/test/testlib/deployer.go +++ b/test/testlib/deployer.go @@ -205,6 +205,7 @@ func (d *DeployTestRun) Start(ctx context.Context) error { env := []string{ fmt.Sprintf("FLY_API_TOKEN=%s", d.apiToken), fmt.Sprintf("DEPLOY_ORG_SLUG=%s", d.orgSlug), + fmt.Sprintf("DEPLOY_TRIGGER=%s", "launch"), } if d.appName != "" { From a030e105654900ff3eb7308911763ea25324dd64 Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 10:22:30 -0300 Subject: [PATCH 05/10] Fix lint refer to https://github.com/superfly/flyctl/actions/runs/12236467772/job/34129993067?pr=4113 --- internal/command/launch/launch.go | 9 --------- scanner/rails.go | 4 ---- 2 files changed, 13 deletions(-) diff --git a/internal/command/launch/launch.go b/internal/command/launch/launch.go index ed8c4982d3..52bc26f687 100644 --- a/internal/command/launch/launch.go +++ b/internal/command/launch/launch.go @@ -231,12 +231,3 @@ func (state *launchState) createApp(ctx context.Context) (*fly.App, error) { return app, nil } - -func (state *launchState) getApp(ctx context.Context) (*fly.App, error) { - apiClient := flyutil.ClientFromContext(ctx) - app, err := apiClient.GetApp(ctx, state.Plan.AppName) - if err != nil { - return nil, err - } - return app, nil -} diff --git a/scanner/rails.go b/scanner/rails.go index 0adeeea69b..43554fe4a4 100644 --- a/scanner/rails.go +++ b/scanner/rails.go @@ -444,10 +444,6 @@ The following comand can be used to update your Dockerfile: } } - if srcInfo.DatabaseDesired == DatabaseKindSqlite { - - } - // add HealthCheck (if found) srcInfo.HttpCheckPath = <-healthcheck_channel if srcInfo.HttpCheckPath != "" { From ca670c4c2a0e72cf57778ace32f4888e2e961c39 Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 11:07:46 -0300 Subject: [PATCH 06/10] Fix phoenix test --- .../fly.toml | 65 ++++++++++++------- .../rel/env.sh.eex | 13 ++++ .../rel/overlays/bin/migrate | 3 + .../rel/overlays/bin/migrate.bat | 1 + .../rel/overlays/bin/server | 3 + .../rel/overlays/bin/server.bat | 2 + 6 files changed, 62 insertions(+), 25 deletions(-) create mode 100755 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex create mode 100755 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate create mode 100755 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate.bat create mode 100755 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server create mode 100755 test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server.bat diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml index 08034cd905..59c9ae6da5 100644 --- a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/fly.toml @@ -1,40 +1,55 @@ -kill_signal = "SIGTERM" -kill_timeout = 5 -processes = [] -[env] - DATABASE_PATH = "/data/prod.db" - PORT = "8080" +kill_signal = 'SIGTERM' +kill_timeout = '5s' [experimental] - allowed_public_ports = [] auto_rollback = true -[mounts] - destination = "/data" - source = "database_data" +[build] + +[env] + DATABASE_PATH = '/mnt/name/name.db' + PHX_HOST = 'deploy-phoenix-sqlite-custom-tool-versions.fly.dev' + PORT = '8080' + SECRET_KEY_BASE = '/28BVC30oMsrUtq0VMBmfxF7zQhjEELRUoNtJOvyEOj7P5YbB7FN6S47KkWyQNcv' + +[[mounts]] + source = 'name' + destination = '/mnt/name' + +[http_service] + internal_port = 8080 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + + [http_service.concurrency] + type = 'connections' + hard_limit = 1000 + soft_limit = 1000 [[services]] - http_checks = [] + protocol = 'tcp' internal_port = 8080 - processes = ["app"] - protocol = "tcp" - script_checks = [] - [services.concurrency] - hard_limit = 25 - soft_limit = 20 - type = "connections" + processes = ['app'] [[services.ports]] - handlers = ["http"] port = 80 + handlers = ['http'] [[services.ports]] - handlers = ["tls", "http"] port = 443 + handlers = ['tls', 'http'] + + [services.concurrency] + type = 'connections' + hard_limit = 25 + soft_limit = 20 - [[services.tcp_checks]] - grace_period = "30s" - interval = "15s" - restart_limit = 0 - timeout = "2s" +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 + memory_mb = 1024 diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex new file mode 100755 index 0000000000..5b24b1e55a --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex @@ -0,0 +1,13 @@ +#!/bin/sh + +# configure node for distributed erlang with IPV6 support +export ERL_AFLAGS="-proto_dist inet6_tcp" +export ECTO_IPV6="true" +export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal" +export RELEASE_DISTRIBUTION="name" +export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*[:'-']}@${FLY_PRIVATE_IP}" + +# Uncomment to send crash dumps to stderr +# This can be useful for debugging, but may log sensitive information +# export ERL_CRASH_DUMP=/dev/stderr +# export ERL_CRASH_DUMP_BYTES=4096 diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate new file mode 100755 index 0000000000..5ff0ede193 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate @@ -0,0 +1,3 @@ +#!/bin/sh +cd -P -- "$(dirname -- "$0")" +exec ./hello_elixir eval HelloElixir.Release.migrate diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate.bat b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate.bat new file mode 100755 index 0000000000..e67fbfcc57 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/migrate.bat @@ -0,0 +1 @@ +call "%~dp0\hello_elixir" eval HelloElixir.Release.migrate diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server new file mode 100755 index 0000000000..2584ba6518 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server @@ -0,0 +1,3 @@ +#!/bin/sh +cd -P -- "$(dirname -- "$0")" +PHX_SERVER=true exec ./hello_elixir start diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server.bat b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server.bat new file mode 100755 index 0000000000..d28959474b --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/overlays/bin/server.bat @@ -0,0 +1,2 @@ +set PHX_SERVER=true +call "%~dp0\hello_elixir" start From c9b180fce608ee33bfb11796a0281ba664313331 Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 11:19:24 -0300 Subject: [PATCH 07/10] this is actually useless --- test/testlib/deployer.go | 1 - 1 file changed, 1 deletion(-) diff --git a/test/testlib/deployer.go b/test/testlib/deployer.go index ca34434312..04637e85fa 100644 --- a/test/testlib/deployer.go +++ b/test/testlib/deployer.go @@ -205,7 +205,6 @@ func (d *DeployTestRun) Start(ctx context.Context) error { env := []string{ fmt.Sprintf("FLY_API_TOKEN=%s", d.apiToken), fmt.Sprintf("DEPLOY_ORG_SLUG=%s", d.orgSlug), - fmt.Sprintf("DEPLOY_TRIGGER=%s", "launch"), } if d.appName != "" { From 07fd9436df17f37e7d3eab8ded30422ceb063e0e Mon Sep 17 00:00:00 2001 From: lubien Date: Mon, 9 Dec 2024 11:25:29 -0300 Subject: [PATCH 08/10] Add TestDeployPhoenixSqlite --- test/deployer/deployer_test.go | 24 + .../deploy-phoenix-sqlite/.dockerignore | 45 ++ .../deploy-phoenix-sqlite/.formatter.exs | 6 + .../fixtures/deploy-phoenix-sqlite/.gitignore | 41 ++ .../fixtures/deploy-phoenix-sqlite/Dockerfile | 97 +++ test/fixtures/deploy-phoenix-sqlite/README.md | 18 + .../deploy-phoenix-sqlite/assets/css/app.css | 5 + .../deploy-phoenix-sqlite/assets/js/app.js | 44 ++ .../assets/tailwind.config.js | 74 ++ .../assets/vendor/topbar.js | 165 +++++ .../deploy-phoenix-sqlite/config/config.exs | 66 ++ .../deploy-phoenix-sqlite/config/dev.exs | 83 +++ .../deploy-phoenix-sqlite/config/prod.exs | 21 + .../deploy-phoenix-sqlite/config/runtime.exs | 113 +++ .../deploy-phoenix-sqlite/config/test.exs | 34 + test/fixtures/deploy-phoenix-sqlite/fly.toml | 37 + .../lib/deploy_phoenix_sqlite.ex | 9 + .../lib/deploy_phoenix_sqlite/application.ex | 44 ++ .../lib/deploy_phoenix_sqlite/mailer.ex | 3 + .../lib/deploy_phoenix_sqlite/release.ex | 28 + .../lib/deploy_phoenix_sqlite/repo.ex | 5 + .../lib/deploy_phoenix_sqlite_web.ex | 113 +++ .../components/core_components.ex | 676 ++++++++++++++++++ .../components/layouts.ex | 14 + .../components/layouts/app.html.heex | 32 + .../components/layouts/root.html.heex | 17 + .../controllers/error_html.ex | 24 + .../controllers/error_json.ex | 21 + .../controllers/page_controller.ex | 9 + .../controllers/page_html.ex | 10 + .../controllers/page_html/home.html.heex | 222 ++++++ .../lib/deploy_phoenix_sqlite_web/endpoint.ex | 53 ++ .../lib/deploy_phoenix_sqlite_web/gettext.ex | 24 + .../lib/deploy_phoenix_sqlite_web/router.ex | 44 ++ .../deploy_phoenix_sqlite_web/telemetry.ex | 92 +++ test/fixtures/deploy-phoenix-sqlite/mix.exs | 85 +++ test/fixtures/deploy-phoenix-sqlite/mix.lock | 44 ++ .../priv/gettext/en/LC_MESSAGES/errors.po | 112 +++ .../priv/gettext/errors.pot | 109 +++ .../priv/repo/migrations/.formatter.exs | 4 + .../deploy-phoenix-sqlite/priv/repo/seeds.exs | 11 + .../priv/static/favicon.ico | Bin 0 -> 152 bytes .../priv/static/images/logo.svg | 6 + .../priv/static/robots.txt | 5 + .../deploy-phoenix-sqlite/rel/env.sh.eex | 13 + .../rel/overlays/bin/migrate | 5 + .../rel/overlays/bin/migrate.bat | 1 + .../rel/overlays/bin/server | 5 + .../rel/overlays/bin/server.bat | 2 + .../controllers/error_html_test.exs | 14 + .../controllers/error_json_test.exs | 12 + .../controllers/page_controller_test.exs | 8 + .../test/support/conn_case.ex | 38 + .../test/support/data_case.ex | 58 ++ .../test/test_helper.exs | 2 + 55 files changed, 2847 insertions(+) create mode 100644 test/fixtures/deploy-phoenix-sqlite/.dockerignore create mode 100644 test/fixtures/deploy-phoenix-sqlite/.formatter.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/.gitignore create mode 100644 test/fixtures/deploy-phoenix-sqlite/Dockerfile create mode 100644 test/fixtures/deploy-phoenix-sqlite/README.md create mode 100644 test/fixtures/deploy-phoenix-sqlite/assets/css/app.css create mode 100644 test/fixtures/deploy-phoenix-sqlite/assets/js/app.js create mode 100644 test/fixtures/deploy-phoenix-sqlite/assets/tailwind.config.js create mode 100644 test/fixtures/deploy-phoenix-sqlite/assets/vendor/topbar.js create mode 100644 test/fixtures/deploy-phoenix-sqlite/config/config.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/config/dev.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/config/prod.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/config/runtime.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/config/test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/fly.toml create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/application.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/mailer.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/release.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/repo.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/core_components.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/app.html.heex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/root.html.heex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_html.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_json.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_controller.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html/home.html.heex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/endpoint.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/gettext.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/router.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/telemetry.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/mix.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/mix.lock create mode 100644 test/fixtures/deploy-phoenix-sqlite/priv/gettext/en/LC_MESSAGES/errors.po create mode 100644 test/fixtures/deploy-phoenix-sqlite/priv/gettext/errors.pot create mode 100644 test/fixtures/deploy-phoenix-sqlite/priv/repo/migrations/.formatter.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/priv/repo/seeds.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/priv/static/favicon.ico create mode 100644 test/fixtures/deploy-phoenix-sqlite/priv/static/images/logo.svg create mode 100644 test/fixtures/deploy-phoenix-sqlite/priv/static/robots.txt create mode 100755 test/fixtures/deploy-phoenix-sqlite/rel/env.sh.eex create mode 100755 test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate create mode 100755 test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate.bat create mode 100755 test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server create mode 100755 test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server.bat create mode 100644 test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_html_test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_json_test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/page_controller_test.exs create mode 100644 test/fixtures/deploy-phoenix-sqlite/test/support/conn_case.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/test/support/data_case.ex create mode 100644 test/fixtures/deploy-phoenix-sqlite/test/test_helper.exs diff --git a/test/deployer/deployer_test.go b/test/deployer/deployer_test.go index 43f105aa13..f90420989c 100644 --- a/test/deployer/deployer_test.go +++ b/test/deployer/deployer_test.go @@ -396,6 +396,30 @@ func TestLaunchStatic(t *testing.T) { require.Contains(t, string(body), "Hello World") } +func TestDeployPhoenixSqlite(t *testing.T) { + deploy := testDeployer(t, + withFixtureApp("deploy-phoenix-sqlite"), + createRandomApp, + withOverwrittenConfig(func(d *testlib.DeployTestRun) map[string]any { + return map[string]any{ + "app": d.Extra["appName"], + "region": d.PrimaryRegion(), + "env": map[string]string{ + "TEST_ID": d.ID(), + }, + } + }), + testlib.DeployOnly, + testlib.DeployNow, + withWorkDirAppSource, + ) + + body, err := testlib.RunHealthCheck(fmt.Sprintf("https://%s.fly.dev", deploy.Extra["appName"].(string))) + require.NoError(t, err) + + require.Contains(t, string(body), "Phoenix") +} + func TestDeployPhoenixSqliteWithCustomToolVersions(t *testing.T) { deploy := testDeployer(t, withFixtureApp("deploy-phoenix-sqlite-custom-tool-versions"), diff --git a/test/fixtures/deploy-phoenix-sqlite/.dockerignore b/test/fixtures/deploy-phoenix-sqlite/.dockerignore new file mode 100644 index 0000000000..61a73933c8 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/.dockerignore @@ -0,0 +1,45 @@ +# This file excludes paths from the Docker build context. +# +# By default, Docker's build context includes all files (and folders) in the +# current directory. Even if a file isn't copied into the container it is still sent to +# the Docker daemon. +# +# There are multiple reasons to exclude files from the build context: +# +# 1. Prevent nested folders from being copied into the container (ex: exclude +# /assets/node_modules when copying /assets) +# 2. Reduce the size of the build context and improve build time (ex. /build, /deps, /doc) +# 3. Avoid sending files containing sensitive information +# +# More information on using .dockerignore is available here: +# https://docs.docker.com/engine/reference/builder/#dockerignore-file + +.dockerignore + +# Ignore git, but keep git HEAD and refs to access current commit hash if needed: +# +# $ cat .git/HEAD | awk '{print ".git/"$2}' | xargs cat +# d0b8727759e1e0e7aa3d41707d12376e373d5ecc +.git +!.git/HEAD +!.git/refs + +# Common development/test artifacts +/cover/ +/doc/ +/test/ +/tmp/ +.elixir_ls + +# Mix artifacts +/_build/ +/deps/ +*.ez + +# Generated on crash by the VM +erl_crash.dump + +# Static artifacts - These should be fetched and built inside the Docker image +/assets/node_modules/ +/priv/static/assets/ +/priv/static/cache_manifest.json diff --git a/test/fixtures/deploy-phoenix-sqlite/.formatter.exs b/test/fixtures/deploy-phoenix-sqlite/.formatter.exs new file mode 100644 index 0000000000..ef8840ce6f --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/.formatter.exs @@ -0,0 +1,6 @@ +[ + import_deps: [:ecto, :ecto_sql, :phoenix], + subdirectories: ["priv/*/migrations"], + plugins: [Phoenix.LiveView.HTMLFormatter], + inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"] +] diff --git a/test/fixtures/deploy-phoenix-sqlite/.gitignore b/test/fixtures/deploy-phoenix-sqlite/.gitignore new file mode 100644 index 0000000000..84ddde453e --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/.gitignore @@ -0,0 +1,41 @@ +# The directory Mix will write compiled artifacts to. +/_build/ + +# If you run "mix test --cover", coverage assets end up here. +/cover/ + +# The directory Mix downloads your dependencies sources to. +/deps/ + +# Where 3rd-party dependencies like ExDoc output generated docs. +/doc/ + +# Ignore .fetch files in case you like to edit your project deps locally. +/.fetch + +# If the VM crashes, it generates a dump, let's ignore it too. +erl_crash.dump + +# Also ignore archive artifacts (built via "mix archive.build"). +*.ez + +# Temporary files, for example, from tests. +/tmp/ + +# Ignore package tarball (built via "mix hex.build"). +deploy_phoenix_sqlite-*.tar + +# Ignore assets that are produced by build tools. +/priv/static/assets/ + +# Ignore digested assets cache. +/priv/static/cache_manifest.json + +# In case you use Node.js/npm, you want to ignore these. +npm-debug.log +/assets/node_modules/ + +# Database files +*.db +*.db-* + diff --git a/test/fixtures/deploy-phoenix-sqlite/Dockerfile b/test/fixtures/deploy-phoenix-sqlite/Dockerfile new file mode 100644 index 0000000000..bd94820b61 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/Dockerfile @@ -0,0 +1,97 @@ +# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian +# instead of Alpine to avoid DNS resolution issues in production. +# +# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu +# https://hub.docker.com/_/ubuntu?tab=tags +# +# This file is based on these images: +# +# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image +# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20240904-slim - for the release image +# - https://pkgs.org/ - resource for finding needed packages +# - Ex: hexpm/elixir:1.16.3-erlang-26.2.5.2-debian-bullseye-20240904-slim +# +ARG ELIXIR_VERSION=1.16.3 +ARG OTP_VERSION=26.2.5.2 +ARG DEBIAN_VERSION=bullseye-20240904-slim + +ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}" +ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}" + +FROM ${BUILDER_IMAGE} as builder + +# install build dependencies +RUN apt-get update -y && apt-get install -y build-essential git \ + && apt-get clean && rm -f /var/lib/apt/lists/*_* + +# prepare build dir +WORKDIR /app + +# install hex + rebar +RUN mix local.hex --force && \ + mix local.rebar --force + +# set build ENV +ENV MIX_ENV="prod" + +# install mix dependencies +COPY mix.exs mix.lock ./ +RUN mix deps.get --only $MIX_ENV +RUN mkdir config + +# copy compile-time config files before we compile dependencies +# to ensure any relevant config change will trigger the dependencies +# to be re-compiled. +COPY config/config.exs config/${MIX_ENV}.exs config/ +RUN mix deps.compile + +COPY priv priv + +COPY lib lib + +COPY assets assets + +# compile assets +RUN mix assets.deploy + +# Compile the release +RUN mix compile + +# Changes to config/runtime.exs don't require recompiling the code +COPY config/runtime.exs config/ + +COPY rel rel +RUN mix release + +# start a new build stage so that the final image will only contain +# the compiled release and other runtime necessities +FROM ${RUNNER_IMAGE} + +RUN apt-get update -y && \ + apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \ + && apt-get clean && rm -f /var/lib/apt/lists/*_* + +# Set the locale +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen + +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +WORKDIR "/app" +RUN chown nobody /app + +# set runner ENV +ENV MIX_ENV="prod" + +# Only copy the final release from the build stage +COPY --from=builder --chown=nobody:root /app/_build/${MIX_ENV}/rel/deploy_phoenix_sqlite ./ + +USER nobody + +# If using an environment that doesn't automatically reap zombie processes, it is +# advised to add an init process such as tini via `apt-get install` +# above and adding an entrypoint. See https://github.com/krallin/tini for details +# ENTRYPOINT ["/tini", "--"] + +CMD ["/app/bin/server"] diff --git a/test/fixtures/deploy-phoenix-sqlite/README.md b/test/fixtures/deploy-phoenix-sqlite/README.md new file mode 100644 index 0000000000..e884a20a52 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/README.md @@ -0,0 +1,18 @@ +# DeployPhoenixSqlite + +To start your Phoenix server: + + * Run `mix setup` to install and setup dependencies + * Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server` + +Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. + +Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html). + +## Learn more + + * Official website: https://www.phoenixframework.org/ + * Guides: https://hexdocs.pm/phoenix/overview.html + * Docs: https://hexdocs.pm/phoenix + * Forum: https://elixirforum.com/c/phoenix-forum + * Source: https://github.com/phoenixframework/phoenix diff --git a/test/fixtures/deploy-phoenix-sqlite/assets/css/app.css b/test/fixtures/deploy-phoenix-sqlite/assets/css/app.css new file mode 100644 index 0000000000..378c8f9056 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/assets/css/app.css @@ -0,0 +1,5 @@ +@import "tailwindcss/base"; +@import "tailwindcss/components"; +@import "tailwindcss/utilities"; + +/* This file is for your main application CSS */ diff --git a/test/fixtures/deploy-phoenix-sqlite/assets/js/app.js b/test/fixtures/deploy-phoenix-sqlite/assets/js/app.js new file mode 100644 index 0000000000..d5e278afe5 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/assets/js/app.js @@ -0,0 +1,44 @@ +// If you want to use Phoenix channels, run `mix help phx.gen.channel` +// to get started and then uncomment the line below. +// import "./user_socket.js" + +// You can include dependencies in two ways. +// +// The simplest option is to put them in assets/vendor and +// import them using relative paths: +// +// import "../vendor/some-package.js" +// +// Alternatively, you can `npm install some-package --prefix assets` and import +// them using a path starting with the package name: +// +// import "some-package" +// + +// Include phoenix_html to handle method=PUT/DELETE in forms and buttons. +import "phoenix_html" +// Establish Phoenix Socket and LiveView configuration. +import {Socket} from "phoenix" +import {LiveSocket} from "phoenix_live_view" +import topbar from "../vendor/topbar" + +let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content") +let liveSocket = new LiveSocket("/live", Socket, { + longPollFallbackMs: 2500, + params: {_csrf_token: csrfToken} +}) + +// Show progress bar on live navigation and form submits +topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"}) +window.addEventListener("phx:page-loading-start", _info => topbar.show(300)) +window.addEventListener("phx:page-loading-stop", _info => topbar.hide()) + +// connect if there are any LiveViews on the page +liveSocket.connect() + +// expose liveSocket on window for web console debug logs and latency simulation: +// >> liveSocket.enableDebug() +// >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session +// >> liveSocket.disableLatencySim() +window.liveSocket = liveSocket + diff --git a/test/fixtures/deploy-phoenix-sqlite/assets/tailwind.config.js b/test/fixtures/deploy-phoenix-sqlite/assets/tailwind.config.js new file mode 100644 index 0000000000..5cc1428a83 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/assets/tailwind.config.js @@ -0,0 +1,74 @@ +// See the Tailwind configuration guide for advanced usage +// https://tailwindcss.com/docs/configuration + +const plugin = require("tailwindcss/plugin") +const fs = require("fs") +const path = require("path") + +module.exports = { + content: [ + "./js/**/*.js", + "../lib/deploy_phoenix_sqlite_web.ex", + "../lib/deploy_phoenix_sqlite_web/**/*.*ex" + ], + theme: { + extend: { + colors: { + brand: "#FD4F00", + } + }, + }, + plugins: [ + require("@tailwindcss/forms"), + // Allows prefixing tailwind classes with LiveView classes to add rules + // only when LiveView classes are applied, for example: + // + //
+ // + plugin(({addVariant}) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])), + plugin(({addVariant}) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])), + plugin(({addVariant}) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])), + + // Embeds Heroicons (https://heroicons.com) into your app.css bundle + // See your `CoreComponents.icon/1` for more information. + // + plugin(function({matchComponents, theme}) { + let iconsDir = path.join(__dirname, "../deps/heroicons/optimized") + let values = {} + let icons = [ + ["", "/24/outline"], + ["-solid", "/24/solid"], + ["-mini", "/20/solid"], + ["-micro", "/16/solid"] + ] + icons.forEach(([suffix, dir]) => { + fs.readdirSync(path.join(iconsDir, dir)).forEach(file => { + let name = path.basename(file, ".svg") + suffix + values[name] = {name, fullPath: path.join(iconsDir, dir, file)} + }) + }) + matchComponents({ + "hero": ({name, fullPath}) => { + let content = fs.readFileSync(fullPath).toString().replace(/\r?\n|\r/g, "") + let size = theme("spacing.6") + if (name.endsWith("-mini")) { + size = theme("spacing.5") + } else if (name.endsWith("-micro")) { + size = theme("spacing.4") + } + return { + [`--hero-${name}`]: `url('data:image/svg+xml;utf8,${content}')`, + "-webkit-mask": `var(--hero-${name})`, + "mask": `var(--hero-${name})`, + "mask-repeat": "no-repeat", + "background-color": "currentColor", + "vertical-align": "middle", + "display": "inline-block", + "width": size, + "height": size + } + } + }, {values}) + }) + ] +} diff --git a/test/fixtures/deploy-phoenix-sqlite/assets/vendor/topbar.js b/test/fixtures/deploy-phoenix-sqlite/assets/vendor/topbar.js new file mode 100644 index 0000000000..41957274d7 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/assets/vendor/topbar.js @@ -0,0 +1,165 @@ +/** + * @license MIT + * topbar 2.0.0, 2023-02-04 + * https://buunguyen.github.io/topbar + * Copyright (c) 2021 Buu Nguyen + */ +(function (window, document) { + "use strict"; + + // https://gist.github.com/paulirish/1579671 + (function () { + var lastTime = 0; + var vendors = ["ms", "moz", "webkit", "o"]; + for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { + window.requestAnimationFrame = + window[vendors[x] + "RequestAnimationFrame"]; + window.cancelAnimationFrame = + window[vendors[x] + "CancelAnimationFrame"] || + window[vendors[x] + "CancelRequestAnimationFrame"]; + } + if (!window.requestAnimationFrame) + window.requestAnimationFrame = function (callback, element) { + var currTime = new Date().getTime(); + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); + var id = window.setTimeout(function () { + callback(currTime + timeToCall); + }, timeToCall); + lastTime = currTime + timeToCall; + return id; + }; + if (!window.cancelAnimationFrame) + window.cancelAnimationFrame = function (id) { + clearTimeout(id); + }; + })(); + + var canvas, + currentProgress, + showing, + progressTimerId = null, + fadeTimerId = null, + delayTimerId = null, + addEvent = function (elem, type, handler) { + if (elem.addEventListener) elem.addEventListener(type, handler, false); + else if (elem.attachEvent) elem.attachEvent("on" + type, handler); + else elem["on" + type] = handler; + }, + options = { + autoRun: true, + barThickness: 3, + barColors: { + 0: "rgba(26, 188, 156, .9)", + ".25": "rgba(52, 152, 219, .9)", + ".50": "rgba(241, 196, 15, .9)", + ".75": "rgba(230, 126, 34, .9)", + "1.0": "rgba(211, 84, 0, .9)", + }, + shadowBlur: 10, + shadowColor: "rgba(0, 0, 0, .6)", + className: null, + }, + repaint = function () { + canvas.width = window.innerWidth; + canvas.height = options.barThickness * 5; // need space for shadow + + var ctx = canvas.getContext("2d"); + ctx.shadowBlur = options.shadowBlur; + ctx.shadowColor = options.shadowColor; + + var lineGradient = ctx.createLinearGradient(0, 0, canvas.width, 0); + for (var stop in options.barColors) + lineGradient.addColorStop(stop, options.barColors[stop]); + ctx.lineWidth = options.barThickness; + ctx.beginPath(); + ctx.moveTo(0, options.barThickness / 2); + ctx.lineTo( + Math.ceil(currentProgress * canvas.width), + options.barThickness / 2 + ); + ctx.strokeStyle = lineGradient; + ctx.stroke(); + }, + createCanvas = function () { + canvas = document.createElement("canvas"); + var style = canvas.style; + style.position = "fixed"; + style.top = style.left = style.right = style.margin = style.padding = 0; + style.zIndex = 100001; + style.display = "none"; + if (options.className) canvas.classList.add(options.className); + document.body.appendChild(canvas); + addEvent(window, "resize", repaint); + }, + topbar = { + config: function (opts) { + for (var key in opts) + if (options.hasOwnProperty(key)) options[key] = opts[key]; + }, + show: function (delay) { + if (showing) return; + if (delay) { + if (delayTimerId) return; + delayTimerId = setTimeout(() => topbar.show(), delay); + } else { + showing = true; + if (fadeTimerId !== null) window.cancelAnimationFrame(fadeTimerId); + if (!canvas) createCanvas(); + canvas.style.opacity = 1; + canvas.style.display = "block"; + topbar.progress(0); + if (options.autoRun) { + (function loop() { + progressTimerId = window.requestAnimationFrame(loop); + topbar.progress( + "+" + 0.05 * Math.pow(1 - Math.sqrt(currentProgress), 2) + ); + })(); + } + } + }, + progress: function (to) { + if (typeof to === "undefined") return currentProgress; + if (typeof to === "string") { + to = + (to.indexOf("+") >= 0 || to.indexOf("-") >= 0 + ? currentProgress + : 0) + parseFloat(to); + } + currentProgress = to > 1 ? 1 : to; + repaint(); + return currentProgress; + }, + hide: function () { + clearTimeout(delayTimerId); + delayTimerId = null; + if (!showing) return; + showing = false; + if (progressTimerId != null) { + window.cancelAnimationFrame(progressTimerId); + progressTimerId = null; + } + (function loop() { + if (topbar.progress("+.1") >= 1) { + canvas.style.opacity -= 0.05; + if (canvas.style.opacity <= 0.05) { + canvas.style.display = "none"; + fadeTimerId = null; + return; + } + } + fadeTimerId = window.requestAnimationFrame(loop); + })(); + }, + }; + + if (typeof module === "object" && typeof module.exports === "object") { + module.exports = topbar; + } else if (typeof define === "function" && define.amd) { + define(function () { + return topbar; + }); + } else { + this.topbar = topbar; + } +}.call(this, window, document)); diff --git a/test/fixtures/deploy-phoenix-sqlite/config/config.exs b/test/fixtures/deploy-phoenix-sqlite/config/config.exs new file mode 100644 index 0000000000..94e9540868 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/config/config.exs @@ -0,0 +1,66 @@ +# This file is responsible for configuring your application +# and its dependencies with the aid of the Config module. +# +# This configuration file is loaded before any dependency and +# is restricted to this project. + +# General application configuration +import Config + +config :deploy_phoenix_sqlite, + ecto_repos: [DeployPhoenixSqlite.Repo], + generators: [timestamp_type: :utc_datetime] + +# Configures the endpoint +config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + url: [host: "localhost"], + adapter: Bandit.PhoenixAdapter, + render_errors: [ + formats: [html: DeployPhoenixSqliteWeb.ErrorHTML, json: DeployPhoenixSqliteWeb.ErrorJSON], + layout: false + ], + pubsub_server: DeployPhoenixSqlite.PubSub, + live_view: [signing_salt: "Hyy5zhX4"] + +# Configures the mailer +# +# By default it uses the "Local" adapter which stores the emails +# locally. You can see the emails in your browser, at "/dev/mailbox". +# +# For production it's recommended to configure a different adapter +# at the `config/runtime.exs`. +config :deploy_phoenix_sqlite, DeployPhoenixSqlite.Mailer, adapter: Swoosh.Adapters.Local + +# Configure esbuild (the version is required) +config :esbuild, + version: "0.17.11", + deploy_phoenix_sqlite: [ + args: + ~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*), + cd: Path.expand("../assets", __DIR__), + env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)} + ] + +# Configure tailwind (the version is required) +config :tailwind, + version: "3.4.3", + deploy_phoenix_sqlite: [ + args: ~w( + --config=tailwind.config.js + --input=css/app.css + --output=../priv/static/assets/app.css + ), + cd: Path.expand("../assets", __DIR__) + ] + +# Configures Elixir's Logger +config :logger, :console, + format: "$time $metadata[$level] $message\n", + metadata: [:request_id] + +# Use Jason for JSON parsing in Phoenix +config :phoenix, :json_library, Jason + +# Import environment specific config. This must remain at the bottom +# of this file so it overrides the configuration defined above. +import_config "#{config_env()}.exs" diff --git a/test/fixtures/deploy-phoenix-sqlite/config/dev.exs b/test/fixtures/deploy-phoenix-sqlite/config/dev.exs new file mode 100644 index 0000000000..f4c700fa29 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/config/dev.exs @@ -0,0 +1,83 @@ +import Config + +# Configure your database +config :deploy_phoenix_sqlite, DeployPhoenixSqlite.Repo, + database: Path.expand("../deploy_phoenix_sqlite_dev.db", __DIR__), + pool_size: 5, + stacktrace: true, + show_sensitive_data_on_connection_error: true + +# For development, we disable any cache and enable +# debugging and code reloading. +# +# The watchers configuration can be used to run external +# watchers to your application. For example, we can use it +# to bundle .js and .css sources. +config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + # Binding to loopback ipv4 address prevents access from other machines. + # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. + http: [ip: {127, 0, 0, 1}, port: 4000], + check_origin: false, + code_reloader: true, + debug_errors: true, + secret_key_base: "+Q20TRJg/2MPOY/hSP7py5ijAj3Rfbi5QjJx/p76zsGhIoYaCUb02X98p7Fj1DOK", + watchers: [ + esbuild: + {Esbuild, :install_and_run, [:deploy_phoenix_sqlite, ~w(--sourcemap=inline --watch)]}, + tailwind: {Tailwind, :install_and_run, [:deploy_phoenix_sqlite, ~w(--watch)]} + ] + +# ## SSL Support +# +# In order to use HTTPS in development, a self-signed +# certificate can be generated by running the following +# Mix task: +# +# mix phx.gen.cert +# +# Run `mix help phx.gen.cert` for more information. +# +# The `http:` config above can be replaced with: +# +# https: [ +# port: 4001, +# cipher_suite: :strong, +# keyfile: "priv/cert/selfsigned_key.pem", +# certfile: "priv/cert/selfsigned.pem" +# ], +# +# If desired, both `http:` and `https:` keys can be +# configured to run both http and https servers on +# different ports. + +# Watch static and templates for browser reloading. +config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + live_reload: [ + patterns: [ + ~r"priv/static/(?!uploads/).*(js|css|png|jpeg|jpg|gif|svg)$", + ~r"priv/gettext/.*(po)$", + ~r"lib/deploy_phoenix_sqlite_web/(controllers|live|components)/.*(ex|heex)$" + ] + ] + +# Enable dev routes for dashboard and mailbox +config :deploy_phoenix_sqlite, dev_routes: true + +# Do not include metadata nor timestamps in development logs +config :logger, :console, format: "[$level] $message\n" + +# Set a higher stacktrace during development. Avoid configuring such +# in production as building large stacktraces may be expensive. +config :phoenix, :stacktrace_depth, 20 + +# Initialize plugs at runtime for faster development compilation +config :phoenix, :plug_init_mode, :runtime + +config :phoenix_live_view, + # Include HEEx debug annotations as HTML comments in rendered markup + debug_heex_annotations: true, + # Enable helpful, but potentially expensive runtime checks + enable_expensive_runtime_checks: true + +# Disable swoosh api client as it is only required for production adapters. +config :swoosh, :api_client, false diff --git a/test/fixtures/deploy-phoenix-sqlite/config/prod.exs b/test/fixtures/deploy-phoenix-sqlite/config/prod.exs new file mode 100644 index 0000000000..3f98fb85a6 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/config/prod.exs @@ -0,0 +1,21 @@ +import Config + +# Note we also include the path to a cache manifest +# containing the digested version of static files. This +# manifest is generated by the `mix assets.deploy` task, +# which you should run after static files are built and +# before starting your production server. +config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + cache_static_manifest: "priv/static/cache_manifest.json" + +# Configures Swoosh API Client +config :swoosh, api_client: Swoosh.ApiClient.Finch, finch_name: DeployPhoenixSqlite.Finch + +# Disable Swoosh Local Memory Storage +config :swoosh, local: false + +# Do not print debug messages in production +config :logger, level: :info + +# Runtime production configuration, including reading +# of environment variables, is done on config/runtime.exs. diff --git a/test/fixtures/deploy-phoenix-sqlite/config/runtime.exs b/test/fixtures/deploy-phoenix-sqlite/config/runtime.exs new file mode 100644 index 0000000000..639e851271 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/config/runtime.exs @@ -0,0 +1,113 @@ +import Config + +# config/runtime.exs is executed for all environments, including +# during releases. It is executed after compilation and before the +# system starts, so it is typically used to load production configuration +# and secrets from environment variables or elsewhere. Do not define +# any compile-time configuration in here, as it won't be applied. +# The block below contains prod specific runtime configuration. + +# ## Using releases +# +# If you use `mix release`, you need to explicitly enable the server +# by passing the PHX_SERVER=true when you start it: +# +# PHX_SERVER=true bin/deploy_phoenix_sqlite start +# +# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server` +# script that automatically sets the env var above. +if System.get_env("PHX_SERVER") do + config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, server: true +end + +if config_env() == :prod do + database_path = + System.get_env("DATABASE_PATH") || + raise """ + environment variable DATABASE_PATH is missing. + For example: /etc/deploy_phoenix_sqlite/deploy_phoenix_sqlite.db + """ + + config :deploy_phoenix_sqlite, DeployPhoenixSqlite.Repo, + database: database_path, + pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5") + + # The secret key base is used to sign/encrypt cookies and other secrets. + # A default value is used in config/dev.exs and config/test.exs but you + # want to use a different value for prod and you most likely don't want + # to check this value into version control, so we use an environment + # variable instead. + secret_key_base = + System.get_env("SECRET_KEY_BASE") || + raise """ + environment variable SECRET_KEY_BASE is missing. + You can generate one by calling: mix phx.gen.secret + """ + + host = System.get_env("PHX_HOST") || "example.com" + port = String.to_integer(System.get_env("PORT") || "4000") + + config :deploy_phoenix_sqlite, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY") + + config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + url: [host: host, port: 443, scheme: "https"], + http: [ + # Enable IPv6 and bind on all interfaces. + # Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access. + # See the documentation on https://hexdocs.pm/bandit/Bandit.html#t:options/0 + # for details about using IPv6 vs IPv4 and loopback vs public addresses. + ip: {0, 0, 0, 0, 0, 0, 0, 0}, + port: port + ], + secret_key_base: secret_key_base + + # ## SSL Support + # + # To get SSL working, you will need to add the `https` key + # to your endpoint configuration: + # + # config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + # https: [ + # ..., + # port: 443, + # cipher_suite: :strong, + # keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"), + # certfile: System.get_env("SOME_APP_SSL_CERT_PATH") + # ] + # + # The `cipher_suite` is set to `:strong` to support only the + # latest and more secure SSL ciphers. This means old browsers + # and clients may not be supported. You can set it to + # `:compatible` for wider support. + # + # `:keyfile` and `:certfile` expect an absolute path to the key + # and cert in disk or a relative path inside priv, for example + # "priv/ssl/server.key". For all supported SSL configuration + # options, see https://hexdocs.pm/plug/Plug.SSL.html#configure/1 + # + # We also recommend setting `force_ssl` in your config/prod.exs, + # ensuring no data is ever sent via http, always redirecting to https: + # + # config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + # force_ssl: [hsts: true] + # + # Check `Plug.SSL` for all available options in `force_ssl`. + + # ## Configuring the mailer + # + # In production you need to configure the mailer to use a different adapter. + # Also, you may need to configure the Swoosh API client of your choice if you + # are not using SMTP. Here is an example of the configuration: + # + # config :deploy_phoenix_sqlite, DeployPhoenixSqlite.Mailer, + # adapter: Swoosh.Adapters.Mailgun, + # api_key: System.get_env("MAILGUN_API_KEY"), + # domain: System.get_env("MAILGUN_DOMAIN") + # + # For this example you need include a HTTP client required by Swoosh API client. + # Swoosh supports Hackney and Finch out of the box: + # + # config :swoosh, :api_client, Swoosh.ApiClient.Hackney + # + # See https://hexdocs.pm/swoosh/Swoosh.html#module-installation for details. +end diff --git a/test/fixtures/deploy-phoenix-sqlite/config/test.exs b/test/fixtures/deploy-phoenix-sqlite/config/test.exs new file mode 100644 index 0000000000..f89079f50f --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/config/test.exs @@ -0,0 +1,34 @@ +import Config + +# Configure your database +# +# The MIX_TEST_PARTITION environment variable can be used +# to provide built-in test partitioning in CI environment. +# Run `mix help test` for more information. +config :deploy_phoenix_sqlite, DeployPhoenixSqlite.Repo, + database: Path.expand("../deploy_phoenix_sqlite_test.db", __DIR__), + pool_size: 5, + pool: Ecto.Adapters.SQL.Sandbox + +# We don't run a server during test. If one is required, +# you can enable the server option below. +config :deploy_phoenix_sqlite, DeployPhoenixSqliteWeb.Endpoint, + http: [ip: {127, 0, 0, 1}, port: 4002], + secret_key_base: "5u0cTq865n2ADnxzovY4YTPMuAoh2ed/bd7cagcv5jkADli701+c4tcl/H7Hqmp3", + server: false + +# In test we don't send emails +config :deploy_phoenix_sqlite, DeployPhoenixSqlite.Mailer, adapter: Swoosh.Adapters.Test + +# Disable swoosh api client as it is only required for production adapters +config :swoosh, :api_client, false + +# Print only warnings and errors during test +config :logger, level: :warning + +# Initialize plugs at runtime for faster test compilation +config :phoenix, :plug_init_mode, :runtime + +# Enable helpful, but potentially expensive runtime checks +config :phoenix_live_view, + enable_expensive_runtime_checks: true diff --git a/test/fixtures/deploy-phoenix-sqlite/fly.toml b/test/fixtures/deploy-phoenix-sqlite/fly.toml new file mode 100644 index 0000000000..3677b7bbf3 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/fly.toml @@ -0,0 +1,37 @@ +# fly.toml app configuration file generated for deploy-phoenix-sqlite on 2024-12-09T11:23:11-03:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +kill_signal = 'SIGTERM' + +[build] + +[env] + DATABASE_PATH = '/mnt/name/name.db' + PHX_HOST = 'deploy-phoenix-sqlite.fly.dev' + PORT = '8080' + SECRET_KEY_BASE = '/28BVC30oMsrUtq0VMBmfxF7zQhjEELRUoNtJOvyEOj7P5YbB7FN6S47KkWyQNcv' + +[[mounts]] + source = 'name' + destination = '/mnt/name' + +[http_service] + internal_port = 8080 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + + [http_service.concurrency] + type = 'connections' + hard_limit = 1000 + soft_limit = 1000 + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 + memory_mb = 1024 diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite.ex new file mode 100644 index 0000000000..eb4cc3ea9d --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite.ex @@ -0,0 +1,9 @@ +defmodule DeployPhoenixSqlite do + @moduledoc """ + DeployPhoenixSqlite keeps the contexts that define your domain + and business logic. + + Contexts are also responsible for managing your data, regardless + if it comes from the database, an external API or others. + """ +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/application.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/application.ex new file mode 100644 index 0000000000..1f75b26149 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/application.ex @@ -0,0 +1,44 @@ +defmodule DeployPhoenixSqlite.Application do + # See https://hexdocs.pm/elixir/Application.html + # for more information on OTP Applications + @moduledoc false + + use Application + + @impl true + def start(_type, _args) do + children = [ + DeployPhoenixSqliteWeb.Telemetry, + DeployPhoenixSqlite.Repo, + {Ecto.Migrator, + repos: Application.fetch_env!(:deploy_phoenix_sqlite, :ecto_repos), + skip: skip_migrations?()}, + {DNSCluster, query: Application.get_env(:deploy_phoenix_sqlite, :dns_cluster_query) || :ignore}, + {Phoenix.PubSub, name: DeployPhoenixSqlite.PubSub}, + # Start the Finch HTTP client for sending emails + {Finch, name: DeployPhoenixSqlite.Finch}, + # Start a worker by calling: DeployPhoenixSqlite.Worker.start_link(arg) + # {DeployPhoenixSqlite.Worker, arg}, + # Start to serve requests, typically the last entry + DeployPhoenixSqliteWeb.Endpoint + ] + + # See https://hexdocs.pm/elixir/Supervisor.html + # for other strategies and supported options + opts = [strategy: :one_for_one, name: DeployPhoenixSqlite.Supervisor] + Supervisor.start_link(children, opts) + end + + # Tell Phoenix to update the endpoint configuration + # whenever the application is updated. + @impl true + def config_change(changed, _new, removed) do + DeployPhoenixSqliteWeb.Endpoint.config_change(changed, removed) + :ok + end + + defp skip_migrations?() do + # By default, sqlite migrations are run when using a release + System.get_env("RELEASE_NAME") != nil + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/mailer.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/mailer.ex new file mode 100644 index 0000000000..58949297de --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/mailer.ex @@ -0,0 +1,3 @@ +defmodule DeployPhoenixSqlite.Mailer do + use Swoosh.Mailer, otp_app: :deploy_phoenix_sqlite +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/release.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/release.ex new file mode 100644 index 0000000000..7e61de03e0 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/release.ex @@ -0,0 +1,28 @@ +defmodule DeployPhoenixSqlite.Release do + @moduledoc """ + Used for executing DB release tasks when run in production without Mix + installed. + """ + @app :deploy_phoenix_sqlite + + def migrate do + load_app() + + for repo <- repos() do + {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :up, all: true)) + end + end + + def rollback(repo, version) do + load_app() + {:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version)) + end + + defp repos do + Application.fetch_env!(@app, :ecto_repos) + end + + defp load_app do + Application.load(@app) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/repo.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/repo.ex new file mode 100644 index 0000000000..d79bab643c --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite/repo.ex @@ -0,0 +1,5 @@ +defmodule DeployPhoenixSqlite.Repo do + use Ecto.Repo, + otp_app: :deploy_phoenix_sqlite, + adapter: Ecto.Adapters.SQLite3 +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web.ex new file mode 100644 index 0000000000..5ebd1613a2 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web.ex @@ -0,0 +1,113 @@ +defmodule DeployPhoenixSqliteWeb do + @moduledoc """ + The entrypoint for defining your web interface, such + as controllers, components, channels, and so on. + + This can be used in your application as: + + use DeployPhoenixSqliteWeb, :controller + use DeployPhoenixSqliteWeb, :html + + The definitions below will be executed for every controller, + component, etc, so keep them short and clean, focused + on imports, uses and aliases. + + Do NOT define functions inside the quoted expressions + below. Instead, define additional modules and import + those modules here. + """ + + def static_paths, do: ~w(assets fonts images favicon.ico robots.txt) + + def router do + quote do + use Phoenix.Router, helpers: false + + # Import common connection and controller functions to use in pipelines + import Plug.Conn + import Phoenix.Controller + import Phoenix.LiveView.Router + end + end + + def channel do + quote do + use Phoenix.Channel + end + end + + def controller do + quote do + use Phoenix.Controller, + formats: [:html, :json], + layouts: [html: DeployPhoenixSqliteWeb.Layouts] + + import Plug.Conn + import DeployPhoenixSqliteWeb.Gettext + + unquote(verified_routes()) + end + end + + def live_view do + quote do + use Phoenix.LiveView, + layout: {DeployPhoenixSqliteWeb.Layouts, :app} + + unquote(html_helpers()) + end + end + + def live_component do + quote do + use Phoenix.LiveComponent + + unquote(html_helpers()) + end + end + + def html do + quote do + use Phoenix.Component + + # Import convenience functions from controllers + import Phoenix.Controller, + only: [get_csrf_token: 0, view_module: 1, view_template: 1] + + # Include general helpers for rendering HTML + unquote(html_helpers()) + end + end + + defp html_helpers do + quote do + # HTML escaping functionality + import Phoenix.HTML + # Core UI components and translation + import DeployPhoenixSqliteWeb.CoreComponents + import DeployPhoenixSqliteWeb.Gettext + + # Shortcut for generating JS commands + alias Phoenix.LiveView.JS + + # Routes generation with the ~p sigil + unquote(verified_routes()) + end + end + + def verified_routes do + quote do + use Phoenix.VerifiedRoutes, + endpoint: DeployPhoenixSqliteWeb.Endpoint, + router: DeployPhoenixSqliteWeb.Router, + statics: DeployPhoenixSqliteWeb.static_paths() + end + end + + @doc """ + When used, dispatch to the appropriate controller/live_view/etc. + """ + defmacro __using__(which) when is_atom(which) do + apply(__MODULE__, which, []) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/core_components.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/core_components.ex new file mode 100644 index 0000000000..15a1d1f2c7 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/core_components.ex @@ -0,0 +1,676 @@ +defmodule DeployPhoenixSqliteWeb.CoreComponents do + @moduledoc """ + Provides core UI components. + + At first glance, this module may seem daunting, but its goal is to provide + core building blocks for your application, such as modals, tables, and + forms. The components consist mostly of markup and are well-documented + with doc strings and declarative assigns. You may customize and style + them in any way you want, based on your application growth and needs. + + The default components use Tailwind CSS, a utility-first CSS framework. + See the [Tailwind CSS documentation](https://tailwindcss.com) to learn + how to customize them or feel free to swap in another framework altogether. + + Icons are provided by [heroicons](https://heroicons.com). See `icon/1` for usage. + """ + use Phoenix.Component + + alias Phoenix.LiveView.JS + import DeployPhoenixSqliteWeb.Gettext + + @doc """ + Renders a modal. + + ## Examples + + <.modal id="confirm-modal"> + This is a modal. + + + JS commands may be passed to the `:on_cancel` to configure + the closing/cancel event, for example: + + <.modal id="confirm" on_cancel={JS.navigate(~p"/posts")}> + This is another modal. + + + """ + attr :id, :string, required: true + attr :show, :boolean, default: false + attr :on_cancel, JS, default: %JS{} + slot :inner_block, required: true + + def modal(assigns) do + ~H""" + + """ + end + + def input(%{type: "select"} = assigns) do + ~H""" +
+ <.label for={@id}><%= @label %> + + <.error :for={msg <- @errors}><%= msg %> +
+ """ + end + + def input(%{type: "textarea"} = assigns) do + ~H""" +
+ <.label for={@id}><%= @label %> + + <.error :for={msg <- @errors}><%= msg %> +
+ """ + end + + # All other inputs text, datetime-local, url, password, etc. are handled here... + def input(assigns) do + ~H""" +
+ <.label for={@id}><%= @label %> + + <.error :for={msg <- @errors}><%= msg %> +
+ """ + end + + @doc """ + Renders a label. + """ + attr :for, :string, default: nil + slot :inner_block, required: true + + def label(assigns) do + ~H""" + + """ + end + + @doc """ + Generates a generic error message. + """ + slot :inner_block, required: true + + def error(assigns) do + ~H""" +

+ <.icon name="hero-exclamation-circle-mini" class="mt-0.5 h-5 w-5 flex-none" /> + <%= render_slot(@inner_block) %> +

+ """ + end + + @doc """ + Renders a header with title. + """ + attr :class, :string, default: nil + + slot :inner_block, required: true + slot :subtitle + slot :actions + + def header(assigns) do + ~H""" +
+
+

+ <%= render_slot(@inner_block) %> +

+

+ <%= render_slot(@subtitle) %> +

+
+
<%= render_slot(@actions) %>
+
+ """ + end + + @doc ~S""" + Renders a table with generic styling. + + ## Examples + + <.table id="users" rows={@users}> + <:col :let={user} label="id"><%= user.id %> + <:col :let={user} label="username"><%= user.username %> + + """ + attr :id, :string, required: true + attr :rows, :list, required: true + attr :row_id, :any, default: nil, doc: "the function for generating the row id" + attr :row_click, :any, default: nil, doc: "the function for handling phx-click on each row" + + attr :row_item, :any, + default: &Function.identity/1, + doc: "the function for mapping each row before calling the :col and :action slots" + + slot :col, required: true do + attr :label, :string + end + + slot :action, doc: "the slot for showing user actions in the last table column" + + def table(assigns) do + assigns = + with %{rows: %Phoenix.LiveView.LiveStream{}} <- assigns do + assign(assigns, row_id: assigns.row_id || fn {id, _item} -> id end) + end + + ~H""" +
+ + + + + + + + + + + + + +
<%= col[:label] %> + <%= gettext("Actions") %> +
+
+ + + <%= render_slot(col, @row_item.(row)) %> + +
+
+
+ + + <%= render_slot(action, @row_item.(row)) %> + +
+
+
+ """ + end + + @doc """ + Renders a data list. + + ## Examples + + <.list> + <:item title="Title"><%= @post.title %> + <:item title="Views"><%= @post.views %> + + """ + slot :item, required: true do + attr :title, :string, required: true + end + + def list(assigns) do + ~H""" +
+
+
+
<%= item.title %>
+
<%= render_slot(item) %>
+
+
+
+ """ + end + + @doc """ + Renders a back navigation link. + + ## Examples + + <.back navigate={~p"/posts"}>Back to posts + """ + attr :navigate, :any, required: true + slot :inner_block, required: true + + def back(assigns) do + ~H""" +
+ <.link + navigate={@navigate} + class="text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700" + > + <.icon name="hero-arrow-left-solid" class="h-3 w-3" /> + <%= render_slot(@inner_block) %> + +
+ """ + end + + @doc """ + Renders a [Heroicon](https://heroicons.com). + + Heroicons come in three styles – outline, solid, and mini. + By default, the outline style is used, but solid and mini may + be applied by using the `-solid` and `-mini` suffix. + + You can customize the size and colors of the icons by setting + width, height, and background color classes. + + Icons are extracted from the `deps/heroicons` directory and bundled within + your compiled app.css by the plugin in your `assets/tailwind.config.js`. + + ## Examples + + <.icon name="hero-x-mark-solid" /> + <.icon name="hero-arrow-path" class="ml-1 w-3 h-3 animate-spin" /> + """ + attr :name, :string, required: true + attr :class, :string, default: nil + + def icon(%{name: "hero-" <> _} = assigns) do + ~H""" + + """ + end + + ## JS Commands + + def show(js \\ %JS{}, selector) do + JS.show(js, + to: selector, + time: 300, + transition: + {"transition-all transform ease-out duration-300", + "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95", + "opacity-100 translate-y-0 sm:scale-100"} + ) + end + + def hide(js \\ %JS{}, selector) do + JS.hide(js, + to: selector, + time: 200, + transition: + {"transition-all transform ease-in duration-200", + "opacity-100 translate-y-0 sm:scale-100", + "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"} + ) + end + + def show_modal(js \\ %JS{}, id) when is_binary(id) do + js + |> JS.show(to: "##{id}") + |> JS.show( + to: "##{id}-bg", + time: 300, + transition: {"transition-all transform ease-out duration-300", "opacity-0", "opacity-100"} + ) + |> show("##{id}-container") + |> JS.add_class("overflow-hidden", to: "body") + |> JS.focus_first(to: "##{id}-content") + end + + def hide_modal(js \\ %JS{}, id) do + js + |> JS.hide( + to: "##{id}-bg", + transition: {"transition-all transform ease-in duration-200", "opacity-100", "opacity-0"} + ) + |> hide("##{id}-container") + |> JS.hide(to: "##{id}", transition: {"block", "block", "hidden"}) + |> JS.remove_class("overflow-hidden", to: "body") + |> JS.pop_focus() + end + + @doc """ + Translates an error message using gettext. + """ + def translate_error({msg, opts}) do + # When using gettext, we typically pass the strings we want + # to translate as a static argument: + # + # # Translate the number of files with plural rules + # dngettext("errors", "1 file", "%{count} files", count) + # + # However the error messages in our forms and APIs are generated + # dynamically, so we need to translate them by calling Gettext + # with our gettext backend as first argument. Translations are + # available in the errors.po file (as we use the "errors" domain). + if count = opts[:count] do + Gettext.dngettext(DeployPhoenixSqliteWeb.Gettext, "errors", msg, msg, count, opts) + else + Gettext.dgettext(DeployPhoenixSqliteWeb.Gettext, "errors", msg, opts) + end + end + + @doc """ + Translates the errors for a field from a keyword list of errors. + """ + def translate_errors(errors, field) when is_list(errors) do + for {^field, {msg, opts}} <- errors, do: translate_error({msg, opts}) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts.ex new file mode 100644 index 0000000000..14e9c9e24c --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts.ex @@ -0,0 +1,14 @@ +defmodule DeployPhoenixSqliteWeb.Layouts do + @moduledoc """ + This module holds different layouts used by your application. + + See the `layouts` directory for all templates available. + The "root" layout is a skeleton rendered as part of the + application router. The "app" layout is set as the default + layout on both `use DeployPhoenixSqliteWeb, :controller` and + `use DeployPhoenixSqliteWeb, :live_view`. + """ + use DeployPhoenixSqliteWeb, :html + + embed_templates "layouts/*" +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/app.html.heex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/app.html.heex new file mode 100644 index 0000000000..e23bfc81c4 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/app.html.heex @@ -0,0 +1,32 @@ +
+
+
+ + + +

+ v<%= Application.spec(:phoenix, :vsn) %> +

+
+ +
+
+
+
+ <.flash_group flash={@flash} /> + <%= @inner_content %> +
+
diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/root.html.heex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/root.html.heex new file mode 100644 index 0000000000..fef5e9296e --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/components/layouts/root.html.heex @@ -0,0 +1,17 @@ + + + + + + + <.live_title suffix=" · Phoenix Framework"> + <%= assigns[:page_title] || "DeployPhoenixSqlite" %> + + + + + + <%= @inner_content %> + + diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_html.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_html.ex new file mode 100644 index 0000000000..838aa72037 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_html.ex @@ -0,0 +1,24 @@ +defmodule DeployPhoenixSqliteWeb.ErrorHTML do + @moduledoc """ + This module is invoked by your endpoint in case of errors on HTML requests. + + See config/config.exs. + """ + use DeployPhoenixSqliteWeb, :html + + # If you want to customize your error pages, + # uncomment the embed_templates/1 call below + # and add pages to the error directory: + # + # * lib/deploy_phoenix_sqlite_web/controllers/error_html/404.html.heex + # * lib/deploy_phoenix_sqlite_web/controllers/error_html/500.html.heex + # + # embed_templates "error_html/*" + + # The default is to render a plain text page based on + # the template name. For example, "404.html" becomes + # "Not Found". + def render(template, _assigns) do + Phoenix.Controller.status_message_from_template(template) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_json.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_json.ex new file mode 100644 index 0000000000..ffd19c1389 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/error_json.ex @@ -0,0 +1,21 @@ +defmodule DeployPhoenixSqliteWeb.ErrorJSON do + @moduledoc """ + This module is invoked by your endpoint in case of errors on JSON requests. + + See config/config.exs. + """ + + # If you want to customize a particular status code, + # you may add your own clauses, such as: + # + # def render("500.json", _assigns) do + # %{errors: %{detail: "Internal Server Error"}} + # end + + # By default, Phoenix returns the status message from + # the template name. For example, "404.json" becomes + # "Not Found". + def render(template, _assigns) do + %{errors: %{detail: Phoenix.Controller.status_message_from_template(template)}} + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_controller.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_controller.ex new file mode 100644 index 0000000000..fdbfcbfadb --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_controller.ex @@ -0,0 +1,9 @@ +defmodule DeployPhoenixSqliteWeb.PageController do + use DeployPhoenixSqliteWeb, :controller + + def home(conn, _params) do + # The home page is often custom made, + # so skip the default app layout. + render(conn, :home, layout: false) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html.ex new file mode 100644 index 0000000000..181ff31e21 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html.ex @@ -0,0 +1,10 @@ +defmodule DeployPhoenixSqliteWeb.PageHTML do + @moduledoc """ + This module contains pages rendered by PageController. + + See the `page_html` directory for all templates available. + """ + use DeployPhoenixSqliteWeb, :html + + embed_templates "page_html/*" +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html/home.html.heex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html/home.html.heex new file mode 100644 index 0000000000..dc1820b11e --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/controllers/page_html/home.html.heex @@ -0,0 +1,222 @@ +<.flash_group flash={@flash} /> + +
+
+ +

+ Phoenix Framework + + v<%= Application.spec(:phoenix, :vsn) %> + +

+

+ Peace of mind from prototype to production. +

+

+ Build rich, interactive web applications quickly, with less code and fewer moving parts. Join our growing community of developers using Phoenix to craft APIs, HTML5 apps and more, for fun or at scale. +

+ +
+
diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/endpoint.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/endpoint.ex new file mode 100644 index 0000000000..6ebc571fba --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/endpoint.ex @@ -0,0 +1,53 @@ +defmodule DeployPhoenixSqliteWeb.Endpoint do + use Phoenix.Endpoint, otp_app: :deploy_phoenix_sqlite + + # The session will be stored in the cookie and signed, + # this means its contents can be read but not tampered with. + # Set :encryption_salt if you would also like to encrypt it. + @session_options [ + store: :cookie, + key: "_deploy_phoenix_sqlite_key", + signing_salt: "+EvAIZj3", + same_site: "Lax" + ] + + socket "/live", Phoenix.LiveView.Socket, + websocket: [connect_info: [session: @session_options]], + longpoll: [connect_info: [session: @session_options]] + + # Serve at "/" the static files from "priv/static" directory. + # + # You should set gzip to true if you are running phx.digest + # when deploying your static files in production. + plug Plug.Static, + at: "/", + from: :deploy_phoenix_sqlite, + gzip: false, + only: DeployPhoenixSqliteWeb.static_paths() + + # Code reloading can be explicitly enabled under the + # :code_reloader configuration of your endpoint. + if code_reloading? do + socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket + plug Phoenix.LiveReloader + plug Phoenix.CodeReloader + plug Phoenix.Ecto.CheckRepoStatus, otp_app: :deploy_phoenix_sqlite + end + + plug Phoenix.LiveDashboard.RequestLogger, + param_key: "request_logger", + cookie_key: "request_logger" + + plug Plug.RequestId + plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint] + + plug Plug.Parsers, + parsers: [:urlencoded, :multipart, :json], + pass: ["*/*"], + json_decoder: Phoenix.json_library() + + plug Plug.MethodOverride + plug Plug.Head + plug Plug.Session, @session_options + plug DeployPhoenixSqliteWeb.Router +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/gettext.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/gettext.ex new file mode 100644 index 0000000000..d50c1c97e8 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/gettext.ex @@ -0,0 +1,24 @@ +defmodule DeployPhoenixSqliteWeb.Gettext do + @moduledoc """ + A module providing Internationalization with a gettext-based API. + + By using [Gettext](https://hexdocs.pm/gettext), + your module gains a set of macros for translations, for example: + + import DeployPhoenixSqliteWeb.Gettext + + # Simple translation + gettext("Here is the string to translate") + + # Plural translation + ngettext("Here is the string to translate", + "Here are the strings to translate", + 3) + + # Domain-based translation + dgettext("errors", "Here is the error message to translate") + + See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage. + """ + use Gettext, otp_app: :deploy_phoenix_sqlite +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/router.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/router.ex new file mode 100644 index 0000000000..1af67818c7 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/router.ex @@ -0,0 +1,44 @@ +defmodule DeployPhoenixSqliteWeb.Router do + use DeployPhoenixSqliteWeb, :router + + pipeline :browser do + plug :accepts, ["html"] + plug :fetch_session + plug :fetch_live_flash + plug :put_root_layout, html: {DeployPhoenixSqliteWeb.Layouts, :root} + plug :protect_from_forgery + plug :put_secure_browser_headers + end + + pipeline :api do + plug :accepts, ["json"] + end + + scope "/", DeployPhoenixSqliteWeb do + pipe_through :browser + + get "/", PageController, :home + end + + # Other scopes may use custom stacks. + # scope "/api", DeployPhoenixSqliteWeb do + # pipe_through :api + # end + + # Enable LiveDashboard and Swoosh mailbox preview in development + if Application.compile_env(:deploy_phoenix_sqlite, :dev_routes) do + # If you want to use the LiveDashboard in production, you should put + # it behind authentication and allow only admins to access it. + # If your application does not have an admins-only section yet, + # you can use Plug.BasicAuth to set up some basic authentication + # as long as you are also using SSL (which you should anyway). + import Phoenix.LiveDashboard.Router + + scope "/dev" do + pipe_through :browser + + live_dashboard "/dashboard", metrics: DeployPhoenixSqliteWeb.Telemetry + forward "/mailbox", Plug.Swoosh.MailboxPreview + end + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/telemetry.ex b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/telemetry.ex new file mode 100644 index 0000000000..019408039e --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/lib/deploy_phoenix_sqlite_web/telemetry.ex @@ -0,0 +1,92 @@ +defmodule DeployPhoenixSqliteWeb.Telemetry do + use Supervisor + import Telemetry.Metrics + + def start_link(arg) do + Supervisor.start_link(__MODULE__, arg, name: __MODULE__) + end + + @impl true + def init(_arg) do + children = [ + # Telemetry poller will execute the given period measurements + # every 10_000ms. Learn more here: https://hexdocs.pm/telemetry_metrics + {:telemetry_poller, measurements: periodic_measurements(), period: 10_000} + # Add reporters as children of your supervision tree. + # {Telemetry.Metrics.ConsoleReporter, metrics: metrics()} + ] + + Supervisor.init(children, strategy: :one_for_one) + end + + def metrics do + [ + # Phoenix Metrics + summary("phoenix.endpoint.start.system_time", + unit: {:native, :millisecond} + ), + summary("phoenix.endpoint.stop.duration", + unit: {:native, :millisecond} + ), + summary("phoenix.router_dispatch.start.system_time", + tags: [:route], + unit: {:native, :millisecond} + ), + summary("phoenix.router_dispatch.exception.duration", + tags: [:route], + unit: {:native, :millisecond} + ), + summary("phoenix.router_dispatch.stop.duration", + tags: [:route], + unit: {:native, :millisecond} + ), + summary("phoenix.socket_connected.duration", + unit: {:native, :millisecond} + ), + summary("phoenix.channel_joined.duration", + unit: {:native, :millisecond} + ), + summary("phoenix.channel_handled_in.duration", + tags: [:event], + unit: {:native, :millisecond} + ), + + # Database Metrics + summary("deploy_phoenix_sqlite.repo.query.total_time", + unit: {:native, :millisecond}, + description: "The sum of the other measurements" + ), + summary("deploy_phoenix_sqlite.repo.query.decode_time", + unit: {:native, :millisecond}, + description: "The time spent decoding the data received from the database" + ), + summary("deploy_phoenix_sqlite.repo.query.query_time", + unit: {:native, :millisecond}, + description: "The time spent executing the query" + ), + summary("deploy_phoenix_sqlite.repo.query.queue_time", + unit: {:native, :millisecond}, + description: "The time spent waiting for a database connection" + ), + summary("deploy_phoenix_sqlite.repo.query.idle_time", + unit: {:native, :millisecond}, + description: + "The time the connection spent waiting before being checked out for the query" + ), + + # VM Metrics + summary("vm.memory.total", unit: {:byte, :kilobyte}), + summary("vm.total_run_queue_lengths.total"), + summary("vm.total_run_queue_lengths.cpu"), + summary("vm.total_run_queue_lengths.io") + ] + end + + defp periodic_measurements do + [ + # A module, function and arguments to be invoked periodically. + # This function must call :telemetry.execute/3 and a metric must be added above. + # {DeployPhoenixSqliteWeb, :count_users, []} + ] + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/mix.exs b/test/fixtures/deploy-phoenix-sqlite/mix.exs new file mode 100644 index 0000000000..9bc2bc550f --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/mix.exs @@ -0,0 +1,85 @@ +defmodule DeployPhoenixSqlite.MixProject do + use Mix.Project + + def project do + [ + app: :deploy_phoenix_sqlite, + version: "0.1.0", + elixir: "~> 1.14", + elixirc_paths: elixirc_paths(Mix.env()), + start_permanent: Mix.env() == :prod, + aliases: aliases(), + deps: deps() + ] + end + + # Configuration for the OTP application. + # + # Type `mix help compile.app` for more information. + def application do + [ + mod: {DeployPhoenixSqlite.Application, []}, + extra_applications: [:logger, :runtime_tools] + ] + end + + # Specifies which paths to compile per environment. + defp elixirc_paths(:test), do: ["lib", "test/support"] + defp elixirc_paths(_), do: ["lib"] + + # Specifies your project dependencies. + # + # Type `mix help deps` for examples and options. + defp deps do + [ + {:phoenix, "~> 1.7.17"}, + {:phoenix_ecto, "~> 4.5"}, + {:ecto_sql, "~> 3.10"}, + {:ecto_sqlite3, ">= 0.0.0"}, + {:phoenix_html, "~> 4.1"}, + {:phoenix_live_reload, "~> 1.2", only: :dev}, + {:phoenix_live_view, "~> 1.0.0"}, + {:floki, ">= 0.30.0", only: :test}, + {:phoenix_live_dashboard, "~> 0.8.3"}, + {:esbuild, "~> 0.8", runtime: Mix.env() == :dev}, + {:tailwind, "~> 0.2", runtime: Mix.env() == :dev}, + {:heroicons, + github: "tailwindlabs/heroicons", + tag: "v2.1.1", + sparse: "optimized", + app: false, + compile: false, + depth: 1}, + {:swoosh, "~> 1.5"}, + {:finch, "~> 0.13"}, + {:telemetry_metrics, "~> 1.0"}, + {:telemetry_poller, "~> 1.0"}, + {:gettext, "~> 0.20"}, + {:jason, "~> 1.2"}, + {:dns_cluster, "~> 0.1.1"}, + {:bandit, "~> 1.5"} + ] + end + + # Aliases are shortcuts or tasks specific to the current project. + # For example, to install project dependencies and perform other setup tasks, run: + # + # $ mix setup + # + # See the documentation for `Mix` for more info on aliases. + defp aliases do + [ + setup: ["deps.get", "ecto.setup", "assets.setup", "assets.build"], + "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"], + "ecto.reset": ["ecto.drop", "ecto.setup"], + test: ["ecto.create --quiet", "ecto.migrate --quiet", "test"], + "assets.setup": ["tailwind.install --if-missing", "esbuild.install --if-missing"], + "assets.build": ["tailwind deploy_phoenix_sqlite", "esbuild deploy_phoenix_sqlite"], + "assets.deploy": [ + "tailwind deploy_phoenix_sqlite --minify", + "esbuild deploy_phoenix_sqlite --minify", + "phx.digest" + ] + ] + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/mix.lock b/test/fixtures/deploy-phoenix-sqlite/mix.lock new file mode 100644 index 0000000000..a36ae83355 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/mix.lock @@ -0,0 +1,44 @@ +%{ + "bandit": {:hex, :bandit, "1.6.1", "9e01b93d72ddc21d8c576a704949e86ee6cde7d11270a1d3073787876527a48f", [:mix], [{:hpax, "~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:thousand_island, "~> 1.0", [hex: :thousand_island, repo: "hexpm", optional: false]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "5a904bf010ea24b67979835e0507688e31ac873d4ffc8ed0e5413e8d77455031"}, + "castore": {:hex, :castore, "1.0.10", "43bbeeac820f16c89f79721af1b3e092399b3a1ecc8df1a472738fd853574911", [:mix], [], "hexpm", "1b0b7ea14d889d9ea21202c43a4fa015eb913021cb535e8ed91946f4b77a8848"}, + "cc_precompiler": {:hex, :cc_precompiler, "0.1.10", "47c9c08d8869cf09b41da36538f62bc1abd3e19e41701c2cea2675b53c704258", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "f6e046254e53cd6b41c6bacd70ae728011aa82b2742a80d6e2214855c6e06b22"}, + "db_connection": {:hex, :db_connection, "2.7.0", "b99faa9291bb09892c7da373bb82cba59aefa9b36300f6145c5f201c7adf48ec", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "dcf08f31b2701f857dfc787fbad78223d61a32204f217f15e881dd93e4bdd3ff"}, + "decimal": {:hex, :decimal, "2.2.0", "df3d06bb9517e302b1bd265c1e7f16cda51547ad9d99892049340841f3e15836", [:mix], [], "hexpm", "af8daf87384b51b7e611fb1a1f2c4d4876b65ef968fa8bd3adf44cff401c7f21"}, + "dns_cluster": {:hex, :dns_cluster, "0.1.3", "0bc20a2c88ed6cc494f2964075c359f8c2d00e1bf25518a6a6c7fd277c9b0c66", [:mix], [], "hexpm", "46cb7c4a1b3e52c7ad4cbe33ca5079fbde4840dedeafca2baf77996c2da1bc33"}, + "ecto": {:hex, :ecto, "3.12.5", "4a312960ce612e17337e7cefcf9be45b95a3be6b36b6f94dfb3d8c361d631866", [:mix], [{:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6eb18e80bef8bb57e17f5a7f068a1719fbda384d40fc37acb8eb8aeca493b6ea"}, + "ecto_sql": {:hex, :ecto_sql, "3.12.1", "c0d0d60e85d9ff4631f12bafa454bc392ce8b9ec83531a412c12a0d415a3a4d0", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.7", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.19 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "aff5b958a899762c5f09028c847569f7dfb9cc9d63bdb8133bff8a5546de6bf5"}, + "ecto_sqlite3": {:hex, :ecto_sqlite3, "0.17.5", "fbee5c17ff6afd8e9ded519b0abb363926c65d30b27577232bb066b2a79957b8", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.12", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.12", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:exqlite, "~> 0.22", [hex: :exqlite, repo: "hexpm", optional: false]}], "hexpm", "3b54734d998cbd032ac59403c36acf4e019670e8b6ceef9c6c33d8986c4e9704"}, + "elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"}, + "esbuild": {:hex, :esbuild, "0.8.2", "5f379dfa383ef482b738e7771daf238b2d1cfb0222bef9d3b20d4c8f06c7a7ac", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "558a8a08ed78eb820efbfda1de196569d8bfa9b51e8371a1934fbb31345feda7"}, + "expo": {:hex, :expo, "1.1.0", "f7b9ed7fb5745ebe1eeedf3d6f29226c5dd52897ac67c0f8af62a07e661e5c75", [:mix], [], "hexpm", "fbadf93f4700fb44c331362177bdca9eeb8097e8b0ef525c9cc501cb9917c960"}, + "exqlite": {:hex, :exqlite, "0.27.1", "73fc0b3dc3b058a77a2b3771f82a6af2ddcf370b069906968a34083d2ffd2884", [:make, :mix], [{:cc_precompiler, "~> 0.1", [hex: :cc_precompiler, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.8", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "79ef5756451cfb022e8013e1ed00d0f8f7d1333c19502c394dc16b15cfb4e9b4"}, + "file_system": {:hex, :file_system, "1.0.1", "79e8ceaddb0416f8b8cd02a0127bdbababe7bf4a23d2a395b983c1f8b3f73edd", [:mix], [], "hexpm", "4414d1f38863ddf9120720cd976fce5bdde8e91d8283353f0e31850fa89feb9e"}, + "finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"}, + "floki": {:hex, :floki, "0.37.0", "b83e0280bbc6372f2a403b2848013650b16640cd2470aea6701f0632223d719e", [:mix], [], "hexpm", "516a0c15a69f78c47dc8e0b9b3724b29608aa6619379f91b1ffa47109b5d0dd3"}, + "gettext": {:hex, :gettext, "0.26.2", "5978aa7b21fada6deabf1f6341ddba50bc69c999e812211903b169799208f2a8", [:mix], [{:expo, "~> 0.5.1 or ~> 1.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "aa978504bcf76511efdc22d580ba08e2279caab1066b76bb9aa81c4a1e0a32a5"}, + "heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized"]}, + "hpax": {:hex, :hpax, "1.0.1", "c857057f89e8bd71d97d9042e009df2a42705d6d690d54eca84c8b29af0787b0", [:mix], [], "hexpm", "4e2d5a4f76ae1e3048f35ae7adb1641c36265510a2d4638157fbcb53dda38445"}, + "jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"}, + "mime": {:hex, :mime, "2.0.6", "8f18486773d9b15f95f4f4f1e39b710045fa1de891fada4516559967276e4dc2", [:mix], [], "hexpm", "c9945363a6b26d747389aac3643f8e0e09d30499a138ad64fe8fd1d13d9b153e"}, + "mint": {:hex, :mint, "1.6.2", "af6d97a4051eee4f05b5500671d47c3a67dac7386045d87a904126fd4bbcea2e", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "5ee441dffc1892f1ae59127f74afe8fd82fda6587794278d924e4d90ea3d63f9"}, + "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"}, + "nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"}, + "phoenix": {:hex, :phoenix, "1.7.17", "2fcdceecc6fb90bec26fab008f96abbd0fd93bc9956ec7985e5892cf545152ca", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "50e8ad537f3f7b0efb1509b2f75b5c918f697be6a45d48e49a30d3b7c0e464c9"}, + "phoenix_ecto": {:hex, :phoenix_ecto, "4.6.3", "f686701b0499a07f2e3b122d84d52ff8a31f5def386e03706c916f6feddf69ef", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.1", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "909502956916a657a197f94cc1206d9a65247538de8a5e186f7537c895d95764"}, + "phoenix_html": {:hex, :phoenix_html, "4.1.1", "4c064fd3873d12ebb1388425a8f2a19348cef56e7289e1998e2d2fa758aa982e", [:mix], [], "hexpm", "f2f2df5a72bc9a2f510b21497fd7d2b86d932ec0598f0210fed4114adc546c6f"}, + "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.5", "d5f44d7dbd7cfacaa617b70c5a14b2b598d6f93b9caa8e350c51d56cd4350a9b", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "1d73920515554d7d6c548aee0bf10a4780568b029d042eccb336db29ea0dad70"}, + "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.5.3", "f2161c207fda0e4fb55165f650f7f8db23f02b29e3bff00ff7ef161d6ac1f09d", [:mix], [{:file_system, "~> 0.3 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "b4ec9cd73cb01ff1bd1cac92e045d13e7030330b74164297d1aee3907b54803c"}, + "phoenix_live_view": {:hex, :phoenix_live_view, "1.0.0", "3a10dfce8f87b2ad4dc65de0732fc2a11e670b2779a19e8d3281f4619a85bce4", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "254caef0028765965ca6bd104cc7d68dcc7d57cc42912bef92f6b03047251d99"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"}, + "phoenix_template": {:hex, :phoenix_template, "1.0.4", "e2092c132f3b5e5b2d49c96695342eb36d0ed514c5b252a77048d5969330d639", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "2c0c81f0e5c6753faf5cca2f229c9709919aba34fab866d3bc05060c9c444206"}, + "plug": {:hex, :plug, "1.16.1", "40c74619c12f82736d2214557dedec2e9762029b2438d6d175c5074c933edc9d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a13ff6b9006b03d7e33874945b2755253841b238c34071ed85b0e86057f8cddc"}, + "plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"}, + "swoosh": {:hex, :swoosh, "1.17.3", "5cda7bff6bc1121cc5b58db8ed90ef33261b373425ae3e32dd599688037a0482", [:mix], [{:bandit, ">= 1.0.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mua, "~> 0.2.3", [hex: :mua, repo: "hexpm", optional: true]}, {:multipart, "~> 0.4", [hex: :multipart, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:req, "~> 0.5 or ~> 1.0", [hex: :req, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "14ad57cfbb70af57323e17f569f5840a33c01f8ebc531dd3846beef3c9c95e55"}, + "tailwind": {:hex, :tailwind, "0.2.4", "5706ec47182d4e7045901302bf3a333e80f3d1af65c442ba9a9eed152fb26c2e", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "c6e4a82b8727bab593700c998a4d98cf3d8025678bfde059aed71d0000c3e463"}, + "telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"}, + "telemetry_metrics": {:hex, :telemetry_metrics, "1.0.0", "29f5f84991ca98b8eb02fc208b2e6de7c95f8bb2294ef244a176675adc7775df", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f23713b3847286a534e005126d4c959ebcca68ae9582118ce436b521d1d47d5d"}, + "telemetry_poller": {:hex, :telemetry_poller, "1.1.0", "58fa7c216257291caaf8d05678c8d01bd45f4bdbc1286838a28c4bb62ef32999", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9eb9d9cbfd81cbd7cdd24682f8711b6e2b691289a0de6826e58452f28c103c8f"}, + "thousand_island": {:hex, :thousand_island, "1.3.7", "1da7598c0f4f5f50562c097a3f8af308ded48cd35139f0e6f17d9443e4d0c9c5", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0139335079953de41d381a6134d8b618d53d084f558c734f2662d1a72818dd12"}, + "websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"}, + "websock_adapter": {:hex, :websock_adapter, "0.5.8", "3b97dc94e407e2d1fc666b2fb9acf6be81a1798a2602294aac000260a7c4a47d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "315b9a1865552212b5f35140ad194e67ce31af45bcee443d4ecb96b5fd3f3782"}, +} diff --git a/test/fixtures/deploy-phoenix-sqlite/priv/gettext/en/LC_MESSAGES/errors.po b/test/fixtures/deploy-phoenix-sqlite/priv/gettext/en/LC_MESSAGES/errors.po new file mode 100644 index 0000000000..844c4f5cea --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/priv/gettext/en/LC_MESSAGES/errors.po @@ -0,0 +1,112 @@ +## `msgid`s in this file come from POT (.pot) files. +## +## Do not add, change, or remove `msgid`s manually here as +## they're tied to the ones in the corresponding POT file +## (with the same domain). +## +## Use `mix gettext.extract --merge` or `mix gettext.merge` +## to merge POT files into PO files. +msgid "" +msgstr "" +"Language: en\n" + +## From Ecto.Changeset.cast/4 +msgid "can't be blank" +msgstr "" + +## From Ecto.Changeset.unique_constraint/3 +msgid "has already been taken" +msgstr "" + +## From Ecto.Changeset.put_change/3 +msgid "is invalid" +msgstr "" + +## From Ecto.Changeset.validate_acceptance/3 +msgid "must be accepted" +msgstr "" + +## From Ecto.Changeset.validate_format/3 +msgid "has invalid format" +msgstr "" + +## From Ecto.Changeset.validate_subset/3 +msgid "has an invalid entry" +msgstr "" + +## From Ecto.Changeset.validate_exclusion/3 +msgid "is reserved" +msgstr "" + +## From Ecto.Changeset.validate_confirmation/3 +msgid "does not match confirmation" +msgstr "" + +## From Ecto.Changeset.no_assoc_constraint/3 +msgid "is still associated with this entry" +msgstr "" + +msgid "are still associated with this entry" +msgstr "" + +## From Ecto.Changeset.validate_length/3 +msgid "should have %{count} item(s)" +msgid_plural "should have %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be %{count} character(s)" +msgid_plural "should be %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be %{count} byte(s)" +msgid_plural "should be %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at least %{count} item(s)" +msgid_plural "should have at least %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} character(s)" +msgid_plural "should be at least %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} byte(s)" +msgid_plural "should be at least %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at most %{count} item(s)" +msgid_plural "should have at most %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} character(s)" +msgid_plural "should be at most %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} byte(s)" +msgid_plural "should be at most %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +## From Ecto.Changeset.validate_number/3 +msgid "must be less than %{number}" +msgstr "" + +msgid "must be greater than %{number}" +msgstr "" + +msgid "must be less than or equal to %{number}" +msgstr "" + +msgid "must be greater than or equal to %{number}" +msgstr "" + +msgid "must be equal to %{number}" +msgstr "" diff --git a/test/fixtures/deploy-phoenix-sqlite/priv/gettext/errors.pot b/test/fixtures/deploy-phoenix-sqlite/priv/gettext/errors.pot new file mode 100644 index 0000000000..eef2de2ba4 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/priv/gettext/errors.pot @@ -0,0 +1,109 @@ +## This is a PO Template file. +## +## `msgid`s here are often extracted from source code. +## Add new translations manually only if they're dynamic +## translations that can't be statically extracted. +## +## Run `mix gettext.extract` to bring this file up to +## date. Leave `msgstr`s empty as changing them here has no +## effect: edit them in PO (`.po`) files instead. +## From Ecto.Changeset.cast/4 +msgid "can't be blank" +msgstr "" + +## From Ecto.Changeset.unique_constraint/3 +msgid "has already been taken" +msgstr "" + +## From Ecto.Changeset.put_change/3 +msgid "is invalid" +msgstr "" + +## From Ecto.Changeset.validate_acceptance/3 +msgid "must be accepted" +msgstr "" + +## From Ecto.Changeset.validate_format/3 +msgid "has invalid format" +msgstr "" + +## From Ecto.Changeset.validate_subset/3 +msgid "has an invalid entry" +msgstr "" + +## From Ecto.Changeset.validate_exclusion/3 +msgid "is reserved" +msgstr "" + +## From Ecto.Changeset.validate_confirmation/3 +msgid "does not match confirmation" +msgstr "" + +## From Ecto.Changeset.no_assoc_constraint/3 +msgid "is still associated with this entry" +msgstr "" + +msgid "are still associated with this entry" +msgstr "" + +## From Ecto.Changeset.validate_length/3 +msgid "should have %{count} item(s)" +msgid_plural "should have %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be %{count} character(s)" +msgid_plural "should be %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be %{count} byte(s)" +msgid_plural "should be %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at least %{count} item(s)" +msgid_plural "should have at least %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} character(s)" +msgid_plural "should be at least %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} byte(s)" +msgid_plural "should be at least %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at most %{count} item(s)" +msgid_plural "should have at most %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} character(s)" +msgid_plural "should be at most %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} byte(s)" +msgid_plural "should be at most %{count} byte(s)" +msgstr[0] "" +msgstr[1] "" + +## From Ecto.Changeset.validate_number/3 +msgid "must be less than %{number}" +msgstr "" + +msgid "must be greater than %{number}" +msgstr "" + +msgid "must be less than or equal to %{number}" +msgstr "" + +msgid "must be greater than or equal to %{number}" +msgstr "" + +msgid "must be equal to %{number}" +msgstr "" diff --git a/test/fixtures/deploy-phoenix-sqlite/priv/repo/migrations/.formatter.exs b/test/fixtures/deploy-phoenix-sqlite/priv/repo/migrations/.formatter.exs new file mode 100644 index 0000000000..49f9151ed2 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/priv/repo/migrations/.formatter.exs @@ -0,0 +1,4 @@ +[ + import_deps: [:ecto_sql], + inputs: ["*.exs"] +] diff --git a/test/fixtures/deploy-phoenix-sqlite/priv/repo/seeds.exs b/test/fixtures/deploy-phoenix-sqlite/priv/repo/seeds.exs new file mode 100644 index 0000000000..ebeccbf3c7 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/priv/repo/seeds.exs @@ -0,0 +1,11 @@ +# Script for populating the database. You can run it as: +# +# mix run priv/repo/seeds.exs +# +# Inside the script, you can read and write to any of your +# repositories directly: +# +# DeployPhoenixSqlite.Repo.insert!(%DeployPhoenixSqlite.SomeSchema{}) +# +# We recommend using the bang functions (`insert!`, `update!` +# and so on) as they will fail if something goes wrong. diff --git a/test/fixtures/deploy-phoenix-sqlite/priv/static/favicon.ico b/test/fixtures/deploy-phoenix-sqlite/priv/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7f372bfc21cdd8cb47585339d5fa4d9dd424402f GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=@t!V@Ar*{oFEH`~d50E!_s``s q?{G*w(7?#d#v@^nKnY_HKaYb01EZMZjMqTJ89ZJ6T-G@yGywoKK_h|y literal 0 HcmV?d00001 diff --git a/test/fixtures/deploy-phoenix-sqlite/priv/static/images/logo.svg b/test/fixtures/deploy-phoenix-sqlite/priv/static/images/logo.svg new file mode 100644 index 0000000000..9f26babac2 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/priv/static/images/logo.svg @@ -0,0 +1,6 @@ + diff --git a/test/fixtures/deploy-phoenix-sqlite/priv/static/robots.txt b/test/fixtures/deploy-phoenix-sqlite/priv/static/robots.txt new file mode 100644 index 0000000000..26e06b5f19 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/priv/static/robots.txt @@ -0,0 +1,5 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-agent: * +# Disallow: / diff --git a/test/fixtures/deploy-phoenix-sqlite/rel/env.sh.eex b/test/fixtures/deploy-phoenix-sqlite/rel/env.sh.eex new file mode 100755 index 0000000000..5b24b1e55a --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/rel/env.sh.eex @@ -0,0 +1,13 @@ +#!/bin/sh + +# configure node for distributed erlang with IPV6 support +export ERL_AFLAGS="-proto_dist inet6_tcp" +export ECTO_IPV6="true" +export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal" +export RELEASE_DISTRIBUTION="name" +export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*[:'-']}@${FLY_PRIVATE_IP}" + +# Uncomment to send crash dumps to stderr +# This can be useful for debugging, but may log sensitive information +# export ERL_CRASH_DUMP=/dev/stderr +# export ERL_CRASH_DUMP_BYTES=4096 diff --git a/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate new file mode 100755 index 0000000000..050220a66e --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +cd -P -- "$(dirname -- "$0")" +exec ./deploy_phoenix_sqlite eval DeployPhoenixSqlite.Release.migrate diff --git a/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate.bat b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate.bat new file mode 100755 index 0000000000..71cd06aa73 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/migrate.bat @@ -0,0 +1 @@ +call "%~dp0\deploy_phoenix_sqlite" eval DeployPhoenixSqlite.Release.migrate diff --git a/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server new file mode 100755 index 0000000000..15f35a72c6 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +cd -P -- "$(dirname -- "$0")" +PHX_SERVER=true exec ./deploy_phoenix_sqlite start diff --git a/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server.bat b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server.bat new file mode 100755 index 0000000000..90cb73f3f1 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/rel/overlays/bin/server.bat @@ -0,0 +1,2 @@ +set PHX_SERVER=true +call "%~dp0\deploy_phoenix_sqlite" start diff --git a/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_html_test.exs b/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_html_test.exs new file mode 100644 index 0000000000..34f6e02e46 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_html_test.exs @@ -0,0 +1,14 @@ +defmodule DeployPhoenixSqliteWeb.ErrorHTMLTest do + use DeployPhoenixSqliteWeb.ConnCase, async: true + + # Bring render_to_string/4 for testing custom views + import Phoenix.Template + + test "renders 404.html" do + assert render_to_string(DeployPhoenixSqliteWeb.ErrorHTML, "404", "html", []) == "Not Found" + end + + test "renders 500.html" do + assert render_to_string(DeployPhoenixSqliteWeb.ErrorHTML, "500", "html", []) == "Internal Server Error" + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_json_test.exs b/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_json_test.exs new file mode 100644 index 0000000000..8751894711 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/error_json_test.exs @@ -0,0 +1,12 @@ +defmodule DeployPhoenixSqliteWeb.ErrorJSONTest do + use DeployPhoenixSqliteWeb.ConnCase, async: true + + test "renders 404" do + assert DeployPhoenixSqliteWeb.ErrorJSON.render("404.json", %{}) == %{errors: %{detail: "Not Found"}} + end + + test "renders 500" do + assert DeployPhoenixSqliteWeb.ErrorJSON.render("500.json", %{}) == + %{errors: %{detail: "Internal Server Error"}} + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/page_controller_test.exs b/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/page_controller_test.exs new file mode 100644 index 0000000000..f0259ab5a8 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/test/deploy_phoenix_sqlite_web/controllers/page_controller_test.exs @@ -0,0 +1,8 @@ +defmodule DeployPhoenixSqliteWeb.PageControllerTest do + use DeployPhoenixSqliteWeb.ConnCase + + test "GET /", %{conn: conn} do + conn = get(conn, ~p"/") + assert html_response(conn, 200) =~ "Peace of mind from prototype to production" + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/test/support/conn_case.ex b/test/fixtures/deploy-phoenix-sqlite/test/support/conn_case.ex new file mode 100644 index 0000000000..fafa4889fe --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/test/support/conn_case.ex @@ -0,0 +1,38 @@ +defmodule DeployPhoenixSqliteWeb.ConnCase do + @moduledoc """ + This module defines the test case to be used by + tests that require setting up a connection. + + Such tests rely on `Phoenix.ConnTest` and also + import other functionality to make it easier + to build common data structures and query the data layer. + + Finally, if the test case interacts with the database, + we enable the SQL sandbox, so changes done to the database + are reverted at the end of every test. If you are using + PostgreSQL, you can even run database tests asynchronously + by setting `use DeployPhoenixSqliteWeb.ConnCase, async: true`, although + this option is not recommended for other databases. + """ + + use ExUnit.CaseTemplate + + using do + quote do + # The default endpoint for testing + @endpoint DeployPhoenixSqliteWeb.Endpoint + + use DeployPhoenixSqliteWeb, :verified_routes + + # Import conveniences for testing with connections + import Plug.Conn + import Phoenix.ConnTest + import DeployPhoenixSqliteWeb.ConnCase + end + end + + setup tags do + DeployPhoenixSqlite.DataCase.setup_sandbox(tags) + {:ok, conn: Phoenix.ConnTest.build_conn()} + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/test/support/data_case.ex b/test/fixtures/deploy-phoenix-sqlite/test/support/data_case.ex new file mode 100644 index 0000000000..898edfa4d9 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/test/support/data_case.ex @@ -0,0 +1,58 @@ +defmodule DeployPhoenixSqlite.DataCase do + @moduledoc """ + This module defines the setup for tests requiring + access to the application's data layer. + + You may define functions here to be used as helpers in + your tests. + + Finally, if the test case interacts with the database, + we enable the SQL sandbox, so changes done to the database + are reverted at the end of every test. If you are using + PostgreSQL, you can even run database tests asynchronously + by setting `use DeployPhoenixSqlite.DataCase, async: true`, although + this option is not recommended for other databases. + """ + + use ExUnit.CaseTemplate + + using do + quote do + alias DeployPhoenixSqlite.Repo + + import Ecto + import Ecto.Changeset + import Ecto.Query + import DeployPhoenixSqlite.DataCase + end + end + + setup tags do + DeployPhoenixSqlite.DataCase.setup_sandbox(tags) + :ok + end + + @doc """ + Sets up the sandbox based on the test tags. + """ + def setup_sandbox(tags) do + pid = Ecto.Adapters.SQL.Sandbox.start_owner!(DeployPhoenixSqlite.Repo, shared: not tags[:async]) + on_exit(fn -> Ecto.Adapters.SQL.Sandbox.stop_owner(pid) end) + end + + @doc """ + A helper that transforms changeset errors into a map of messages. + + assert {:error, changeset} = Accounts.create_user(%{password: "short"}) + assert "password is too short" in errors_on(changeset).password + assert %{password: ["password is too short"]} = errors_on(changeset) + + """ + def errors_on(changeset) do + Ecto.Changeset.traverse_errors(changeset, fn {message, opts} -> + Regex.replace(~r"%{(\w+)}", message, fn _, key -> + opts |> Keyword.get(String.to_existing_atom(key), key) |> to_string() + end) + end) + end +end diff --git a/test/fixtures/deploy-phoenix-sqlite/test/test_helper.exs b/test/fixtures/deploy-phoenix-sqlite/test/test_helper.exs new file mode 100644 index 0000000000..e01419d2c4 --- /dev/null +++ b/test/fixtures/deploy-phoenix-sqlite/test/test_helper.exs @@ -0,0 +1,2 @@ +ExUnit.start() +Ecto.Adapters.SQL.Sandbox.mode(DeployPhoenixSqlite.Repo, :manual) From 1a866598198ee1c949f3a4d29fcb970327857238 Mon Sep 17 00:00:00 2001 From: lubien Date: Fri, 13 Dec 2024 16:39:02 -0300 Subject: [PATCH 09/10] Fix phoenix for real --- deploy.rb | 2 +- scanner/phoenix.go | 2 +- .../deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy.rb b/deploy.rb index 3edede90ba..c28b83a147 100755 --- a/deploy.rb +++ b/deploy.rb @@ -320,7 +320,7 @@ info("Skipping build, using image defined in fly config: #{image_ref}") image_ref else - image_ref = "registry.fly.io/#{APP_NAME}:#{image_tag}" + image_ref = "registry.fly.io/#{APP_NAME}-#{image_tag}" exec_capture("flyctl deploy --build-only --push -a #{APP_NAME} --image-label #{image_tag} #{CONFIG_COMMAND_STRING}") artifact Artifact::DOCKER_IMAGE, { ref: image_ref } diff --git a/scanner/phoenix.go b/scanner/phoenix.go index 30c98888b7..6b5ffd2b78 100644 --- a/scanner/phoenix.go +++ b/scanner/phoenix.go @@ -170,7 +170,7 @@ export ERL_AFLAGS="-proto_dist inet6_tcp" export ECTO_IPV6="true" export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal" export RELEASE_DISTRIBUTION="name" -export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*[:'-']}@${FLY_PRIVATE_IP}" +export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}" # Uncomment to send crash dumps to stderr # This can be useful for debugging, but may log sensitive information diff --git a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex index 5b24b1e55a..efeb7ffa27 100755 --- a/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex +++ b/test/fixtures/deploy-phoenix-sqlite-custom-tool-versions/rel/env.sh.eex @@ -5,7 +5,7 @@ export ERL_AFLAGS="-proto_dist inet6_tcp" export ECTO_IPV6="true" export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal" export RELEASE_DISTRIBUTION="name" -export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*[:'-']}@${FLY_PRIVATE_IP}" +export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}" # Uncomment to send crash dumps to stderr # This can be useful for debugging, but may log sensitive information From 5aae40fd8035351c74081a82e3703e8bad7dd807 Mon Sep 17 00:00:00 2001 From: lubien Date: Fri, 13 Dec 2024 17:10:54 -0300 Subject: [PATCH 10/10] well thats the fix --- deploy.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy.rb b/deploy.rb index c28b83a147..3b6c4d7b4d 100755 --- a/deploy.rb +++ b/deploy.rb @@ -315,12 +315,12 @@ APP_NAME = DEPLOY_APP_NAME || fly_config["app"] image_ref = in_step Step::BUILD do - image_tag = SecureRandom.hex(16) + image_tag = "deployment-#{SecureRandom.hex(16)}" if (image_ref = fly_config.dig("build","image")&.strip) && !image_ref.nil? && !image_ref.empty? info("Skipping build, using image defined in fly config: #{image_ref}") image_ref else - image_ref = "registry.fly.io/#{APP_NAME}-#{image_tag}" + image_ref = "registry.fly.io/#{APP_NAME}:#{image_tag}" exec_capture("flyctl deploy --build-only --push -a #{APP_NAME} --image-label #{image_tag} #{CONFIG_COMMAND_STRING}") artifact Artifact::DOCKER_IMAGE, { ref: image_ref }