dwyl / learn-heroku Goto Github PK
View Code? Open in Web Editor NEW:checkered_flag: Learn how to deploy your web application to Heroku from scratch step-by-step in 7 minutes!
:checkered_flag: Learn how to deploy your web application to Heroku from scratch step-by-step in 7 minutes!
The example in this repo/tutorial is a basic Node.js (static) page which is a good start ...
Most apps will have a bit more functionality ...
Given our choice of "stack": https://github.com/dwyl/technology-stack
I feel it would be good to have a walkthrough of deploying a Phoenix App.
Ref: HashNuke/heroku-buildpack-elixir#107
looks like we need both buildpacks:
Trying it ...
see: https://devcenter.heroku.com/articles/app-json-schema
used in: https://github.com/healthlocker/healthlocker/blob/master/app.json
and: https://github.com/dwyl/hapi-socketio-redis-chat-example/blob/master/app.json
We need to write a brief intro to why an app.json
file is useful for apps deployed to Heroku.
This work could be tied into helping people deploy the dwyl "chat/time" app to heroku. 🤔
The Heroku Web UI is miles better than most other "Cloud" services. 🎉
We are really grateful that the UI is easy enough for non-technical people to use.
But it has certain limitations (log history not visible unless you have a tab open), effectiveness (clicking around to see things) and no automation of actions.
At present, the instructions in our Elixir/Phoenix Deployment guide instruct people to use Elixir 1.6
elixir-phoenix-app-deployment.md#5-create-a-elixir_buildpackconfig-file
While this version is perfectly fine, it's a couple of years old and should not be used for NEW
apps.
I recently used the latest Elixir + Erlang in dwyl/elixir-auth-google-demo > elixir_buildpack.config
Which is working on: https://elixir-auth-google-demo.herokuapp.com
So I am confident that updating the instructions will not cause any beginners to have headaches.
elixir_buildpack.config
to Elixir v1.9.4
22.2
Heroku [Salesforce] has decided to be hostile to beginners/hobby devs
and will be deleting
accounts + data by the end of November 2022!
This is fairly predictable. Salesforce has record revenue. But the bean-counters need to cut back on costs.
https://investor.salesforce.com/press-releases/press-release-details/2022/Salesforce-Announces-Record-Fourth-Quarter-and-Full-Year-Fiscal-2022-Results/default.aspx
While trying to deploy a new version of a Elixir/Phoenix and Elm app to heroku, I kept getting this error and failing to deploy:
remote: > [email protected] install /tmp/build_aed45373ab53117201137c6bfc2c1e04/assets/node_modules/elm
remote: > binwrap-install
remote:
remote: sh: 1: binwrap-install: not found
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! [email protected] install: `binwrap-install`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the [email protected] install script.
remote: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I don't think it could have been caused by anything I did, as I had recently deployed the same day, and the only changes I had made were adding some csv files to the root directory. I also tried deploying other branches with only minimal changes, and got the same error.
I eventually managed to get around this error, but not in the most optimal way. Deploying the exact same branch that was failing to a brand new heroku instance worked fine, but any subsequent deployments would fail with the same error. This led me to think that the issue must be somewhere on the heroku or npm side.
I changed the version of both npm and node, and turned off the caching. I did this using the config file for the phoenix buildpack we are using (https://github.com/gjaldon/heroku-buildpack-phoenix-static):
phoenix_static_buildpack.config
:
assets_path=assets
phoenix_ex=phx
node_version=9.3.0
npm_version=5.2.0
clean_cache=true
I'm not sure currently whether it's the cache or the specific npm version that fixes the error, but after doing this, I have deployed multiple updates with no problems.
Each time I log into heroku I get the following warning:
2017-10-03T09:06:19.988494+00:00 app[web.1]: > node example/github_server.js
2017-10-03T09:06:19.988495+00:00 app[web.1]:
2017-10-03T09:06:20.131086+00:00 app[web.1]: �[1m�[43m�[30m WARNING: �[22m�[42m�[30m env2 was required to load an .env file: �[46m�[30m /app/.env �[1m�[43m�[30m NOT FOUND! �[22m�[42m�[30m Please see: http://git.io/vG3UZ�[49m�[39m�[22m
2017-10-03T09:06:21.176535+00:00 app[web.1]: Now Visit: http://localhost:20094
2017-10-03T09:07:17.051002+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2017-10-03T09:07:17.051002+00:00 heroku[web.1]: Stopping process with SIGKILL
2017-10-03T09:07:17.209186+00:00 heroku[web.1]: Process exited with status 137
2017-10-03T09:07:17.217016+00:00 heroku[web.1]: State changed from starting to crashed
Hey @nelsonic I've been making my way through the tutorial for setting up an SSL certificate but I keep running into an error with TLS:
I've been googling around but can't seem to find anything that's helpful for my use-case.
Did you experience this error at all?
We did this last year https://github.com/ideaq/meteor-email but ... I didn't create a re-usable example (with tests) let's fix that.
What is an Heroku Build pack and how can I use it to deploy my app?
In https://github.com/dwyl/learn-heroku/blob/master/elixir-phoenix-app-deployment.md the section 5 could be next to the section 9 and more information about the buildpacks configuration can be added:
and
see: #18 (review)
Should we "cross-link" to the https://github.com/dwyl/learn-ngrok tutorial
for people who "just" want show their app in a Demo without deploying it?
The obvious advantage is that changes can be made (with "live-reloading") on ngrok
without having to go through the "minutes" of re-deploying to Heroku.
@iteles thoughts?
https://devcenter.heroku.com/articles/github-integration-review-apps 💡
We used these on Healthlocker until the app was migrated to Azure ... 🙄
I think it's worth having a write-up on how to use them for a very good "workflow". 🐎
We have a detailed ("step-by-step") guide to setting up SSL Certificate on Heroku:
https://github.com/dwyl/learn-heroku/blob/master/SSL-certificate-step-by-step-setup-instructions.md
However the Let's Encrypt Certs only last 3 months.
This is fine for a "Startup" or "Hackathon" project that you just want to get up-and-running ASAP,
but it's lame for a project that has longevity.
So, the time has come to extend our tutorial to include certificate renewal.
Relates to: healthlocker/healthlocker#712
I'm working on a project at the moment where we are deploying to heroku (free tier at the moment for development) and I'm confused by what will be needed in terms of dynos when it comes to deploying the app for production.
How many concurrent users are too many when using a hobby dyno? This app is likely to have a reasonably low amount of regular concurrent users and from a bit of reading I wouldn't need to look into the professional tiers unless I would be looking at more than 100 concurrent users?
How do you decide whether your app will be okay on hobby, or if it needs professional?
I think something around this kind of info would be great to have in this README, so if we manage to collate some answers here I'd be happy to make a PR with them.
Sorry, this was an accident
Just logged into Heroku and was greeted with this: https://dashboard.heroku.com/terms-of-service
https://c1.sfdcstatic.com/content/dam/web/en_us/www/documents/legal/salesforce_MSA.pdf
"MASTER SUBSCRIPTION AGREEMENT": salesforce_MSA.pdf
"Master" ... how long before they change the name ...
https://en.wikipedia.org/wiki/Master/slave_(technology)#Terminology_concerns
Error:
2017-10-03T08:04:59.568303+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico"
host=github-oauth-demo.herokuapp.com
request_id=6deb46cc-e65d-4450-8582-dc9f4ce6142d fwd="46.28.161.222"
dyno= connect= service= status=503 bytes= protocol=https
This is happening for: https://github.com/nelsonic/github-oauth-demo
should be an easy fix.
Trying to debug the deployment fail on localhost
getting the following error:
10:12:14.889 [error] Could not find static manifest at "/code/phoenix-chat-example/_build/prod/lib/chat/priv/static/cache_manifest.json". Run "mix phx.digest" after building your static files or remove the configuration from "config/prod.exs".
A useful addition to this tutorial would be to show how to use a custom domain...
Getting an app running on localhost
should be easy for new team members,
(ideally it should be a single command ...) but sadly, currently it's not! 😞
@dwyl we have apps deployed to a variety of infrastructure, see: dwyl/learn-devops
Most of the time we recommend that people start with Heroku because the convenience and much simpler interface far outweighs the cost (and switching away is relatively easy!)
One of the most tedious steps in getting an app running on localhost
is getting the Environment Variables. We don't want to share environment variables through insecure means (some people share secrets through Chat message, Google Docs or even email, but none of these means of communication are truly secure ... all store your data somewhere that is not in your direct control so it's possible for keys to leak ...)
We need to a bulletproof way of storing application secrets for our own apps.
See: dwyl/learn-security#43
But for now, using Heroku as the "single source of truth" for Secrets (Environment Variables) is a good starting point for the apps we have deployed on Heroku.
First visit the "Settings" tab for your Heroku App.
And click on the "Reveal Config Vars" button:
Then Run this script in your web browser's developer console:
var keys = document.getElementsByClassName('config-var-key');
var vals = document.getElementsByClassName('config-var-value');
var vars = '';
for (var i = 0; i < keys.length - 1; i++) {
var index = (i == 0) ? 0 : i * 2; // cause there are two values for every key ... 🙄
vars = vars + 'export ' + keys[i].value + '=' + vals[index].value + '\n';
}
console.log(vars);
You should see something like this:
Copy the output from the browser console and paste it into your .env
file.
export AWS_ACCESS_KEY_ID=AKIA****************
export AWS_S3_BUCKET=bucket-name
export AWS_S3_REGION=eu-west-1
export AWS_SECRET_ACCESS_KEY=****************
export DATABASE_URL=postgres://[email protected]:5432/password
export ENCRYPTION_KEYS='****************='
export GOOGLE_MAPS_API_KEY=****************
export HEROKU_POSTGRESQL=postgres://[email protected]:5432/password
export IMPORT_FILES_DIR=temp
export SECRET_KEY_BASE=****************
export [email protected]
export SES_PORT=25
export SES_SERVER=email-smtp.eu-west-1.amazonaws.com
export SITE_URL=https://www.example.com
export SMTP_PASSWORD=****************
export SMTP_USERNAME=AKIA****************
export URL=your-app.herokuapp.com
localhost
for club-soda/club-soda-guide#512I googled for this question https://www.google.com/search?q=heroku+view+postgres+data
and the first 3 results were:
The StackOverflow thread links to Heroku Data Explorer > renamed "Adminium"
But sadly, Adminium requires access to ALL environment variables on ALL Apps.
"Read and write access to all of your apps and resources, excluding account information. Includes configuration variables, which may include runtime secrets."
If it was limited to just the App I want to view data for, I would be fine with it.
But we have apps that have AWS credentials in Environment Variables, and there's no way I would grant access to those to anyone.
To be clear: I've been using Heroku for 8 years and querying the data using the CLI e.g:
heroku pg:psql
but that is definitely not "beginner friendly" or accessible to non-technical people (e.g: Product Owner)
I'm going to do a writeup of using PGAdmin to view/query Heroku PostgreSQL Data.
While attempting to connect to Heroku PostgreSQL we got the following error:
11:27:37.439 [error] GenServer #PID<0.205.0> terminating
** (ArgumentError) argument error
(postgrex) lib/postgrex/utils.ex:67: anonymous fn/1 in Postgrex.Utils.parse_version/1
(elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
(elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
(postgrex) lib/postgrex/utils.ex:67: Postgrex.Utils.parse_version/1
(postgrex) lib/postgrex/protocol.ex:641: Postgrex.Protocol.bootstrap_send/6
(postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
(db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
Last message: nil
** (exit) exited in: :gen_server.call(#PID<0.205.0>, {:checkout, #Reference<0.963189577.137101314.27724>, true, :infinity}, 5000)
** (EXIT) an exception was raised:
** (ArgumentError) argument error
(postgrex) lib/postgrex/utils.ex:67: anonymous fn/1 in Postgrex.Utils.parse_version/1
(elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
(elixir) lib/enum.ex:1294: Enum."-map/2-lists^map/1-0-"/2
(postgrex) lib/postgrex/utils.ex:67: Postgrex.Utils.parse_version/1
(postgrex) lib/postgrex/protocol.ex:641: Postgrex.Protocol.bootstrap_send/6
(postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
(db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(db_connection) lib/db_connection/poolboy.ex:112: DBConnection.Poolboy.checkout/3
(db_connection) lib/db_connection.ex:920: DBConnection.checkout/2
(db_connection) lib/db_connection.ex:742: DBConnection.run/3
(db_connection) lib/db_connection.ex:1133: DBConnection.run_meter/3
(db_connection) lib/db_connection.ex:584: DBConnection.prepare_execute/4
(ecto) lib/ecto/adapters/postgres/connection.ex:86: Ecto.Adapters.Postgres.Connection.execute/4
(ecto) lib/ecto/adapters/sql.ex:256: Ecto.Adapters.SQL.sql_call/6
(ecto) lib/ecto/adapters/sql.ex:198: Ecto.Adapters.SQL.query!/5
When attempting to deploy our Example Phoenix App, it appeared to work, but then we saw this error in the logs:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Going to attempt to use the PORT
environment variable instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.