### Clone the sample project Source: https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java Clone the sample project repository from GitHub to get started with database connection examples. ```bash git clone git://github.com/heroku/devcenter-java-database.git ``` -------------------------------- ### Run example applications locally (Windows) Source: https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java Execute the start scripts for the different example applications (plain JDBC, Spring XML, Spring Java) on Windows. ```bash devcenter-java-database-plain-jdbc/target/bin/main.bat ``` ```bash devcenter-java-database-spring-xml/target/bin/main.bat ``` ```bash devcenter-java-database-spring-java/target/bin/main.bat ``` -------------------------------- ### Run example applications locally (Linux/Mac) Source: https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java Execute the start scripts for the different example applications (plain JDBC, Spring XML, Spring Java) on Linux or macOS. ```bash sh devcenter-java-database-plain-jdbc/target/bin/main ``` ```bash sh devcenter-java-database-spring-xml/target/bin/main ``` ```bash sh devcenter-java-database-spring-java/target/bin/main ``` -------------------------------- ### Setup Virtual Environment and Install Flask Source: https://devcenter.heroku.com/articles/flask-memcache Creates a project directory, sets up a Python virtual environment, and installs the Flask framework. Essential for isolated Python development. ```bash $ mkdir flask_memcache $ cd flask_memcache $ python -m venv venv $ source venv/bin/activate (venv) $ pip install Flask ``` -------------------------------- ### Install and Run Application Locally Source: https://devcenter.heroku.com/articles/getting-started-with-go Installs the Go application and starts it using `heroku local`. This command uses the `.env` file to set environment variables. ```bash $ go install -v . github.com/heroku/go-getting-started $ heroku local --port=5006 ``` -------------------------------- ### App Setup Response Source: https://devcenter.heroku.com/articles/platform-api-reference Example of a successful or failed response when creating an app setup. It includes details about the setup's status, any failure messages, and build information. ```json { "id": "01234567-89ab-cdef-0123-456789abcdef", "created_at": "2012-01-01T12:00:00Z", "updated_at": "2012-01-01T12:00:00Z", "status": "failed", "failure_message": "invalid app.json", "app": { "id": "01234567-89ab-cdef-0123-456789abcdef", "name": "example" }, "build": { "id": "01234567-89ab-cdef-0123-456789abcdef", "status": "succeeded", "output_stream_url": "https://build-output.heroku.com/streams/01234567-89ab-cdef-0123-456789abcdef" }, "manifest_errors": [ "config var FOO is required" ], "postdeploy": { "output": "assets precompiled", "exit_code": 1 }, "resolved_success_url": "https://example.herokuapp.com/welcome" } ``` -------------------------------- ### Install Dependencies and Run Locally Source: https://devcenter.heroku.com/articles/getting-started-with-ruby Install project dependencies using Bundler and start a local development server. The '--port' flag specifies the listening port. ```bash $ bundle install $ heroku local --port=5006 ``` -------------------------------- ### Clone Alpine-based Python example Source: https://devcenter.heroku.com/articles/container-registry-and-runtime Get a sample Alpine-based Python application to start with. ```bash $ git clone https://github.com/heroku/alpinehelloworld.git ``` -------------------------------- ### Set up Go Application with Heroku Source: https://devcenter.heroku.com/articles/que-go Install the example application, create a Heroku app, add Heroku Postgres, and scale the worker dyno. This sequence configures the environment for background job processing. ```bash go get -u github.com/heroku-examples/go-queue-example/... cd $GOPATH/src/github.com/heroku-examples/go-queue-example heroku create heroku addons:add heroku-postgresql git push heroku master heroku ps:scale worker=1 ``` -------------------------------- ### App Setup Info Source: https://devcenter.heroku.com/articles/platform-api-reference Get the status of an app setup. ```APIDOC ## GET /app-setups/{app_setup_id} ### Description Get the status of an app setup. ### Method GET ### Endpoint /app-setups/{app_setup_id} ### Parameters #### Path Parameters - **app_setup_id** (string) - Required - The unique identifier of the app setup. ### Response #### Success Response (200) - **id** (string) - Unique identifier for the app setup. - **created_at** (string) - Timestamp when the app setup was created. - **updated_at** (string) - Timestamp when the app setup was last updated. - **status** (string) - Current status of the app setup (e.g., "failed", "succeeded"). - **failure_message** (string) - Message detailing the reason for failure, if applicable. - **app** (object) - Information about the app. - **id** (string) - Unique identifier for the app. - **name** (string) - Name of the app. - **build** (object) - Information about the build process. - **id** (string) - Unique identifier for the build. - **status** (string) - Status of the build (e.g., "succeeded"). - **output_stream_url** (string) - URL to stream build output. - **manifest_errors** (array) - List of errors found in the app manifest. - **postdeploy** (object) - Information about the post-deploy process. - **output** (string) - Output from the post-deploy script. - **exit_code** (integer) - Exit code of the post-deploy script. - **resolved_success_url** (string) - The URL the app setup resolved to upon success. #### Response Example ```json { "id": "01234567-89ab-cdef-0123-456789abcdef", "created_at": "2012-01-01T12:00:00Z", "updated_at": "2012-01-01T12:00:00Z", "status": "failed", "failure_message": "invalid app.json", "app": { "id": "01234567-89ab-cdef-0123-456789abcdef", "name": "example" }, "build": { "id": "01234567-89ab-cdef-0123-456789abcdef", "status": "succeeded", "output_stream_url": "https://build-output.heroku.com/streams/01234567-89ab-cdef-0123-456789abcdef" }, "manifest_errors": [ "config var FOO is required" ], "postdeploy": { "output": "assets precompiled", "exit_code": 1 }, "resolved_success_url": "https://example.herokuapp.com/welcome" } ``` ``` -------------------------------- ### Install MemCachier Go Client Source: https://devcenter.heroku.com/articles/memcachier Install the recommended 'mc' client for MemCachier using go get. This client supports the binary protocol and SASL authentication. ```bash $ go get github.com/memcachier/mc ``` -------------------------------- ### Gin Example with MemCachier Client Source: https://devcenter.heroku.com/articles/memcachier A basic Gin application example demonstrating the integration of the 'mc' MemCachier client for setting and getting cache values. Ensure to defer the Quit() call. ```go package main import ( "os" "fmt" "github.com/memcachier/mc" ) func main() { username := os.Getenv("MEMCACHIER_USERNAME") password := os.Getenv("MEMCACHIER_PASSWORD") servers := os.Getenv("MEMCACHIER_SERVERS") mcClient := mc.NewMC(servers, username, password) defer mcClient.Quit() _, err := mcClient.set("foo", "bar", 0, 0, 0) if err != nil { fmt.Printf("Failed to set value: %s\n", err) } val, _, _, err := c.Get("foo") if err != nil { fmt.Printf("Failed to fetch value: %s\n", err) } fmt.Printf("Got value: %s\n", val) } ``` -------------------------------- ### Comprehensive heroku.yml Example Source: https://devcenter.heroku.com/articles/build-docker-images-heroku-yml An example heroku.yml file demonstrating setup for add-ons and config vars, build configurations for multiple Docker images, release phase commands, and run commands for different process types. ```yaml setup: addons: - plan: heroku-postgresql as: DATABASE config: S3_BUCKET: my-example-bucket build: docker: web: Dockerfile worker: worker/Dockerfile config: RAILS_ENV: development FOO: bar release: command: - ./deployment-tasks.sh image: worker run: web: bundle exec puma -C config/puma.rb worker: python myworker.py asset-syncer: command: - python asset-syncer.py image: worker ``` -------------------------------- ### Example Requests for Connection Details Source: https://devcenter.heroku.com/articles/heroku-applink-api Demonstrates how to make GET requests to retrieve connection details using different identifiers: connection name, connection UUID, or Salesforce Org ID. ```bash # Request using connection name GET /addons/fe3b4938-3383-4c40-868c-1a5cdc38a358/connections/productionOrg # Request using connection UUID GET /addons/fe3b4938-3383-4c40-868c-1a5cdc38a358/connections/a8bc7bcb-89c3-45c0-b7b7-4fb4427e598b # Request using Org ID GET /addons/fe3b4938-3383-4c40-868c-1a5cdc38a358/connections/00DSG00000DGEIr2AP ``` -------------------------------- ### Install dependencies and boot the server Source: https://devcenter.heroku.com/articles/rack-app-behavior Install the declared dependencies using `bundle install` and then boot the Rack application server using `bundle exec rackup`. ```bash $ bundle install $ bundle exec rackup -p 9292 config.ru ``` -------------------------------- ### Main Application Setup and Server Initialization Source: https://devcenter.heroku.com/articles/go-websockets Initializes the application by setting up a logger, retrieving port and Redis URL from environment variables, creating a Redis client, and initializing a Hub. It configures graceful shutdown using OS signals and starts a goroutine for Redis subscription and message handling. It also sets up an HTTP server to serve static files and the WebSocket endpoint, and starts the server in a separate goroutine. ```go func main() { logger := slog.Default() port := os.Getenv("PORT") if port == "" { logger.Error("$PORT must be set") os.Exit(1) } redisURL := os.Getenv("REDIS_URL") if redisURL == "" { logger.Error("$REDIS_URL must be set") os.Exit(1) } rdb, err := newRedisClient(redisURL) if err != nil { logger.Error("failed to create redis client", "err", err) os.Exit(1) } hub := NewHub(rdb, logger) ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer stop() go func() { for { if err := waitForRedis(ctx, rdb, logger, func() { hub.Broadcast(waitingMsg) }); err != nil { return } hub.Broadcast(availableMsg) if err := hub.Subscribe(ctx); err != nil { if ctx.Err() != nil { return } logger.Error("redis subscription error, reconnecting", "err", err) continue } return } }() mux := http.NewServeMux() mux.Handle("/", http.FileServer(http.Dir("./public"))) mux.HandleFunc("/ws", handleWebSocket(hub, logger)) srv := &http.Server{ Addr: ":" + port, Handler: mux, } go func() { logger.Info("server starting", "port", port) if err := srv.ListenAndServe(); err != http.ErrServerClosed { logger.Error("server error", "err", err) os.Exit(1) } }() <-ctx.Done() logger.Info("shutting down") } ``` -------------------------------- ### Procfile Example for Node.js App Source: https://devcenter.heroku.com/articles/nodejs-behavior-in-heroku A Procfile defines the commands that are executed to start your application's processes. This example shows how to start a web process using npm. ```procfile web: npm start ``` -------------------------------- ### Install Dependencies in One-Off Dyno Source: https://devcenter.heroku.com/articles/troubleshooting-node-deploys Once a one-off dyno is active, you can install dependencies using npm to test and debug. This example installs the 'debug' package. ```bash $ npm install debug up to date, audited 52 packages in 2s found 0 vulnerabilities ``` -------------------------------- ### Provision an Essential-0 Plan Database Source: https://devcenter.heroku.com/articles/provisioning-heroku-postgres Example of provisioning an Essential-0 plan database for an application named 'example-app'. The database creation may take up to 5 minutes. ```bash $ heroku addons:create heroku-postgresql:essential-0 -a example-app Creating heroku-postgresql:essential-0 on ⬢ example-app... ~$0.007/hour (max $5/month) Database should be available soon postgresql-concave-52656 is being created in the background. The app will restart when complete... Use heroku addons:info postgresql-concave-52656 to check creation progress Use heroku addons:docs heroku-postgresql to view documentation ``` -------------------------------- ### Install Axios Package Source: https://devcenter.heroku.com/articles/heroku-inference-quickstart-javascript-v1-embeddings Install the 'axios' package, which is used for making HTTP requests in the JavaScript example. ```bash npm install axios ``` -------------------------------- ### Install Axios Package Source: https://devcenter.heroku.com/articles/heroku-inference-quickstart-javascript-v1-chat-completions Install the 'axios' package, which is used for making HTTP requests in the JavaScript example. ```bash npm install axios ``` -------------------------------- ### Download Add-on Documentation Template Source: https://devcenter.heroku.com/articles/add-on-documentation-guidelines Use this command to download the starter template for creating add-on documentation locally. ```bash $ curl https://devcenter.heroku.com/articles/add-on-template.md > addon-doc.md ``` -------------------------------- ### Example app.json Configuration Source: https://devcenter.heroku.com/articles/app-json-schema A comprehensive example demonstrating various sections of app.json, including name, description, keywords, URLs, scripts, environment variables, formation, image, add-ons, buildpacks, and environments. ```json { "name": "Small Sharp Tool", "description": "This app does one little thing, and does it well.", "keywords": [ "productivity", "HTML5", "scalpel" ], "website": "https://small-sharp-tool.com/", "repository": "https://github.com/jane-doe/small-sharp-tool", "logo": "https://small-sharp-tool.com/logo.svg", "success_url": "/welcome", "scripts": { "postdeploy": "bundle exec rake bootstrap" }, "env": { "SECRET_TOKEN": { "description": "A secret key for verifying the integrity of signed cookies.", "generator": "secret" }, "WEB_CONCURRENCY": { "description": "The number of processes to run.", "value": "5" } }, "formation": { "web": { "quantity": 1, "size": "standard-1x" } }, "image": "heroku/ruby", "addons": [ "openredis", { "plan": "mongolab:shared-single-small", "as": "MONGO" }, { "plan": "heroku-postgresql", "options": { "version": "9.5" } } ], "buildpacks": [ { "url": "https://github.com/stomita/heroku-buildpack-phantomjs" } ], "environments": { "test": { "scripts": { "test": "bundle exec rake test" } } } } ``` -------------------------------- ### Example Response for Get Publications Source: https://devcenter.heroku.com/articles/heroku-applink-api This is an example of the response when retrieving a list of AppLink publications for a connection. It includes details for each published app. ```json [ { "app_id": "1c6bb699-2a91-47b3-b55e-8f2e37254684", "heroku_app_link_id": "1up000000000000", "external_service_id": "0Lexx0000004H77CAE", "external_service_name": "MyApp", "connection_name": "my-prod-org", "org_id": "00DSG00000DGEIr2AP", "app_name": "app-name", "created_at": "2025-04-06T18:20:42.226577Z", "created_by": "creator@somewhere.com", "last_modified_at": "2025-04-09T18:20:42.226577Z", "last_modified_by": "modifier@somewhere.com" } ] ``` -------------------------------- ### Example Request for AppLink Connections Source: https://devcenter.heroku.com/articles/heroku-applink-api An example of a GET request to retrieve AppLink connections, demonstrating the use of specific addon and app UUIDs. ```bash GET /addons/fe3b4938-3383-4c40-868c-1a5cdc38a358/connections/ef01ec58-63f6-478b-ab87-34f82b3c5bdd ``` -------------------------------- ### App Setup Create Source: https://devcenter.heroku.com/articles/platform-api-reference Create a new app setup from a gzipped tar archive containing an app.json manifest file. ```APIDOC ## POST /app-setups ### Description Create a new app setup from a gzipped tar archive containing an app.json manifest file. ### Method POST ### Endpoint /app-setups ### Parameters #### Query Parameters - **source_blob:checksum** (nullable string) - Optional - an optional checksum of the gzipped tarball for verifying its integrity - **source_blob:url** (string) - Required - URL of gzipped tarball of source code containing app.json manifest file - **source_blob:version** (nullable string) - Optional - Version of the gzipped tarball. - **app:locked** (boolean) - Optional - are other team members forbidden from joining this app. - **app:name** (string) - Optional - name of app. Pattern: `^[a-z][a-z0-9-]{1,28}[a-z0-9]$` - **app:organization** (string) - Optional - unique name of team - **app:personal** (boolean) - Optional - force creation of the app in the user account even if a default team is set. - **app:region** (string) - Optional - name of region - **app:space** (string) - Optional - unique name of space. Pattern: `^[a-z0-9](?:[a-z0-9]|-(?!-))+[a-z0-9]$` - **app:stack** (string) - Optional - unique name - **overrides:buildpacks** (array) - Optional - overrides the buildpacks specified in the app.json manifest file - **overrides:env** (object) - Optional - overrides of the env specified in the app.json manifest file ### Request Example ```json { "app": { "locked": false, "name": "example", "organization": "example", "personal": false, "region": "us", "space": "nasa", "stack": "heroku-18" }, "source_blob": { "checksum": "SHA256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "url": "https://example.com/source.tgz?token=xyz", "version": "v1.3.0" }, "overrides": { "buildpacks": [ { "url": "https://example.com/buildpack.tgz" } ], "env": { "FOO": "bar", "BAZ": "qux" } } } ``` ### Response #### Success Response (201) - **id** (string) - Unique identifier for the app setup. - **created_at** (string) - Timestamp when the app setup was created. - **updated_at** (string) - Timestamp when the app setup was last updated. - **status** (string) - Current status of the app setup (e.g., "failed", "succeeded"). - **failure_message** (string) - Message detailing the reason for failure, if applicable. - **app** (object) - Information about the created app. - **id** (string) - Unique identifier for the app. - **name** (string) - Name of the app. - **build** (object) - Information about the build process. - **id** (string) - Unique identifier for the build. - **status** (string) - Status of the build (e.g., "succeeded"). - **output_stream_url** (string) - URL to stream build output. - **manifest_errors** (array) - List of errors found in the app manifest. - **postdeploy** (object) - Information about the post-deploy process. - **output** (string) - Output from the post-deploy script. - **exit_code** (integer) - Exit code of the post-deploy script. - **resolved_success_url** (string) - The URL the app setup resolved to upon success. #### Response Example ```json { "id": "01234567-89ab-cdef-0123-456789abcdef", "created_at": "2012-01-01T12:00:00Z", "updated_at": "2012-01-01T12:00:00Z", "status": "failed", "failure_message": "invalid app.json", "app": { "id": "01234567-89ab-cdef-0123-456789abcdef", "name": "example" }, "build": { "id": "01234567-89ab-cdef-0123-456789abcdef", "status": "succeeded", "output_stream_url": "https://build-output.heroku.com/streams/01234567-89ab-cdef-0123-456789abcdef" }, "manifest_errors": [ "config var FOO is required" ], "postdeploy": { "output": "assets precompiled", "exit_code": 1 }, "resolved_success_url": "https://example.herokuapp.com/welcome" } ``` ``` -------------------------------- ### Create App Setup Source: https://devcenter.heroku.com/articles/platform-api-reference Create a new app setup from a gzipped tar archive containing an app.json manifest file. This endpoint requires a URL to the source blob and optionally accepts a checksum, version, and various app configuration overrides. ```bash $ curl -n -X POST https://api.heroku.com/app-setups \ -d '{ "app": { "locked": false, "name": "example", "organization": "example", "personal": false, "region": "us", "space": "nasa", "stack": "heroku-18" }, "source_blob": { "checksum": "SHA256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "url": "https://example.com/source.tgz?token=xyz", "version": "v1.3.0" }, "overrides": { "buildpacks": [ { "url": "https://example.com/buildpack.tgz" } ], "env": { "FOO": "bar", "BAZ": "qux" } } }' \ -H "Content-Type: application/json" \ -H "Accept: application/vnd.heroku+json; version=3" ``` -------------------------------- ### Install Heroku Data CLI Plugin Source: https://devcenter.heroku.com/articles/heroku-data-labs Install the Heroku Data CLI plugin to manage experimental features. This command is used for initial setup. ```bash $ heroku plugins:install @heroku-cli/plugin-data ``` -------------------------------- ### Full Updated main.go Example Source: https://devcenter.heroku.com/articles/getting-started-with-go The complete main.go file after incorporating config var handling and the repeat handler. This includes all necessary imports and application logic. ```go package main import ( "bytes" "database/sql" "fmt" "log" "net/http" "os" "strconv" "time" "github.com/gin-gonic/gin" _ "github.com/heroku/x/hmetrics/onload" _ "github.com/lib/pq" ) func main() { port := os.Getenv("PORT") if port == "" { log.Fatal("$PORT must be set") } db, err := sql.Open("postgres", os.Getenv("DATABASE_URL")) if err != nil { log.Fatalf("Error opening database: %q", err) } tStr := os.Getenv("REPEAT") repeat, err := strconv.Atoi(tStr) if err != nil { log.Printf("Error converting $REPEAT to an int: %q - Using default\n", err) repeat = 5 } router := gin.New() router.Use(gin.Logger()) router.GET("/repeat", repeatHandler(repeat)) router.GET("/db", dbFunc(db)) router.LoadHTMLGlob("templates/*.tmpl.html") router.Static("/static", "static") router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index.tmpl.html", nil) }) router.Run(": ``` -------------------------------- ### Curl Example for Getting Add-on Info Source: https://devcenter.heroku.com/articles/platform-api-reference Example using curl to fetch details of a specific add-on for an application. Authentication via Heroku CLI is assumed. ```shell $ curl -n https://api.heroku.com/apps/$APP_ID_OR_NAME/addons/$ADD_ON_ID_OR_NAME \ -H "Accept: application/vnd.heroku+json; version=3" ``` -------------------------------- ### Initialize Gin Project with GoVendor Source: https://devcenter.heroku.com/articles/gin-memcache Initializes a new Gin project and fetches the Gin framework using govendor. Ensure you are in your $GOPATH/src directory. ```bash $ cd $GOPATH/src $ mkdir gin_memcache $ cd gin_memcache $ govendor init $ govendor fetch github.com/gin-gonic/gin@v1.2 ``` -------------------------------- ### Example Response for Get Publications Source: https://devcenter.heroku.com/articles/heroku-applink-api This is an example of the JSON response when retrieving AppLink publications for an app. It includes details about the app, its link to Salesforce, and creation timestamps. ```json [ { "app_id": "1c6bb699-2a91-47b3-b55e-8f2e37254684", "heroku_app_link_id": "1up000000000000", "external_service_id": "0Lexx0000004H77CAE", "external_service_name": "MyApp", "connection_name": "my-prod-org", "org_id": "00DSG00000DGEIr2AP", "app_name": "app-name", "created_at": "2025-04-06T18:20:42.226577Z", "created_by": "creator@somewhere.com", "last_modified_at": "2025-04-09T18:20:42.226577Z", "last_modified_by": "modifier@somewhere.com" } ] ``` -------------------------------- ### Install Go Application Source: https://devcenter.heroku.com/articles/getting-started-with-go Installs the Go application and its dependencies. This command is typically run before testing locally. ```bash $ go install -v . github.com/gin-gonic/gin/internal/bytesconv github.com/go-playground/locales/currency github.com/leodido/go-urn/scim/schema github.com/pelletier/go-toml/v2/internal/characters database/sql/driver github.com/gin-gonic/gin/codec/json github.com/gabriel-vasile/mimetype/internal/scan github.com/gin-contrib/sse github.com/gabriel-vasile/mimetype/internal/json github.com/gabriel-vasile/mimetype/internal/markup github.com/gabriel-vasile/mimetype/internal/charset github.com/gabriel-vasile/mimetype/internal/csv github.com/go-playground/locales github.com/leodido/go-urn github.com/gabriel-vasile/mimetype/internal/magic database/sql github.com/go-playground/universal-translator golang.org/x/sys/cpu golang.org/x/crypto/sha3 golang.org/x/text/internal/tag github.com/gabriel-vasile/mimetype golang.org/x/text/internal/language github.com/goccy/go-yaml/token github.com/pelletier/go-toml/v2/internal/danger github.com/pelletier/go-toml/v2/unstable github.com/goccy/go-yaml/ast github.com/goccy/go-yaml/scanner github.com/pelletier/go-toml/v2/internal/tracker golang.org/x/text/internal/language/compact github.com/pelletier/go-toml/v2 golang.org/x/text/language github.com/goccy/go-yaml/printer github.com/goccy/go-yaml/internal/format github.com/goccy/go-yaml/internal/errors github.com/go-playground/validator/v10 github.com/goccy/go-yaml/lexer github.com/goccy/go-yaml/parser github.com/ugorji/go/codec go.mongodb.org/mongo-driver/v2/internal/decimal128 go.mongodb.org/mongo-driver/v2/internal/binaryutil go.mongodb.org/mongo-driver/v2/internal/bsoncoreutil go.mongodb.org/mongo-driver/v2/x/bsonx/bsoncore github.com/goccy/go-yaml go.mongodb.org/mongo-driver/v2/bson google.golang.org/protobuf/internal/detrand google.golang.org/protobuf/internal/errors google.golang.org/protobuf/encoding/protowire google.golang.org/protobuf/internal/pragma google.golang.org/protobuf/reflect/protoreflect google.golang.org/protobuf/internal/flags github.com/gin-gonic/gin/internal/fs golang.org/x/sys/unix google.golang.org/protobuf/internal/encoding/messageset google.golang.org/protobuf/internal/genid google.golang.org/protobuf/internal/order google.golang.org/protobuf/internal/strs google.golang.org/protobuf/reflect/protoregistry google.golang.org/protobuf/runtime/protoiface google.golang.org/protobuf/proto golang.org/x/net/http2/hpack github.com/mattn/go-isatty github.com/quic-go/quic-go/internal/monotime github.com/quic-go/quic-go/quicvarint github.com/quic-go/quic-go/internal/protocol github.com/quic-go/qpack github.com/quic-go/quic-go/qlogwriter/jsontext golang.org/x/crypto/internal/alias golang.org/x/crypto/internal/poly1305 golang.org/x/crypto/chacha20 github.com/quic-go/quic-go/internal/utils github.com/quic-go/quic-go/internal/qerr github.com/quic-go/quic-go/qlogwriter golang.org/x/crypto/chacha20poly1305 github.com/quic-go/quic-go/internal/wire github.com/quic-go/quic-go/internal/flowcontrol golang.org/x/crypto/hkdf github.com/quic-go/quic-go/internal/utils/linkedlist github.com/quic-go/quic-go/internal/utils/ringbuffer golang.org/x/net/bpf golang.org/x/net/internal/iana golang.org/x/net/internal/socket golang.org/x/text/transform golang.org/x/text/unicode/bidi github.com/quic-go/quic-go/qlog golang.org/x/text/secure/bidirule golang.org/x/net/ipv4 golang.org/x/net/ipv6 golang.org/x/text/unicode/norm github.com/quic-go/quic-go/internal/congestion github.com/quic-go/quic-go/internal/ackhandler github.com/quic-go/quic-go/internal/handshake golang.org/x/net/internal/httpsfv github.com/quic-go/quic-go github.com/heroku/x/hmetrics golang.org/x/net/idna github.com/heroku/x/hmetrics/onload os/user golang.org/x/net/http/httpguts golang.org/x/net/internal/httpcommon golang.org/x/net/http2 github.com/lib/pq/internal/pqutil github.com/lib/pq/internal/pgpass github.com/lib/pq/internal/pgservice github.com/lib/pq/internal/pqsql github.com/lib/pq/internal/pqtime github.com/lib/pq/internal/proto github.com/lib/pq/oid github.com/lib/pq/pqerror github.com/lib/pq/scram github.com/lib/pq golang.org/x/net/http2/h2c github.com/quic-go/quic-go/http3/qlog github.com/quic-go/quic-go/http3 github.com/gin-gonic/gin/binding github.com/gin-gonic/gin/render github.com/gin-gonic/gin github.com/heroku/go-getting-started ``` -------------------------------- ### Initialize Express.js Project Source: https://devcenter.heroku.com/articles/expressjs-memcache Set up a new Node.js project and install the Express.js framework. Ensure the entry point is set to app.js during npm init. ```bash $ mkdir express_memcache $ cd express_memcache $ npm init # choose a package name and make sure the entry point is app.js $ npm install express ``` -------------------------------- ### Install Go Application Source: https://devcenter.heroku.com/articles/getting-started-with-go Compile and install your Go application to the $GOPATH/bin directory. This command downloads and installs necessary dependencies. ```bash $ go install -v . ``` -------------------------------- ### Improper Hashbang Line Example Source: https://devcenter.heroku.com/articles/ruby-versions An example of an improper hashbang line in a script that can cause it to use the wrong Ruby version. Ensure the line starts with `#!/usr/bin/env ruby`. ```ruby #!/usr/bin/env ruby1.9.1 ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle') ``` -------------------------------- ### Add-on Provisioning Request Example Source: https://devcenter.heroku.com/articles/add-on-partner-api-reference This example demonstrates the structure of a POST request to provision a new add-on resource. It includes all common parameters such as callback URL, name, OAuth grant details, plan, region, and optional logging URLs. ```http POST /heroku/resources HTTP/1.1 Host: addon-slug-1234567890ab.herokuapp.com:443 Authorization: Basic YWRkb24tc2x1ZzpzdXBlci1zZWNyZXQ= Content-Type: application/json Accept: application/vnd.heroku-addons+json; version=3 ``` ```json { "callback_url": "https://api.heroku.com/addons/01234567-89ab-cdef-0123-456789abcdef", "name": "acme-inc-primary-database", "oauth_grant": { "code": "01234567-89ab-cdef-0123-456789abcdef", "expires_at": "2016-03-03T18:01:31-0800", "type": "authorization_code" }, "options": { "foo" : "bar", "baz" : "true" }, "plan": "basic", "region": "amazon-web-services::us-east-1", "uuid": "01234567-89ab-cdef-0123-456789abcdef", "log_input_url": "https://token:t.01234567-89ab-cdef-0123-456789abcdef@1.us.logplex.io/logs", "log_drain_token": "d.01234567-89ab-cdef-0123-456789abcdef" } ``` -------------------------------- ### Display Git Help Information Source: https://devcenter.heroku.com/articles/getting-started-with-rails8 Verify if Git is installed on your system by running the 'git --help' command. If it returns usage information, Git is installed and ready to use. ```bash $ git --help ``` -------------------------------- ### Get App Setup Info Source: https://devcenter.heroku.com/articles/platform-api-reference Retrieve the current status of an app setup using its unique ID. This is useful for monitoring the progress or outcome of an app creation process. ```bash $ curl -n https://api.heroku.com/app-setups/$APP_SETUP_ID \n -H "Accept: application/vnd.heroku+json; version=3" ``` -------------------------------- ### Build the project with Maven Source: https://devcenter.heroku.com/articles/connecting-to-relational-databases-on-heroku-with-java Navigate to the cloned directory and run the Maven build command to package the project. ```bash mvn package ``` -------------------------------- ### Install Multiple Add-on Instances Source: https://devcenter.heroku.com/articles/add-ons Use the `heroku addons:create` command to install multiple instances of the same add-on. Specify a unique name for each instance using the `--name` flag. This example shows installing two instances of `redis`. ```bash $ heroku addons:create heroku-redis:premium --name cache-redis \ > --app example-app Creating premium-redis-random-name... $ heroku addons:create heroku-redis:premium --name session-redis \ > --app example-app Creating premium-redis-another-random-name... ``` -------------------------------- ### App Config Vars Response Example Source: https://devcenter.heroku.com/articles/platform-api-reference Example response showing the key-value pairs of an app's configuration variables. ```json { "FOO": "bar", "BAZ": "qux" } ``` -------------------------------- ### Curl Example for Get Add-on Webhook Event Info Source: https://devcenter.heroku.com/articles/platform-api-reference Example using curl to fetch a specific add-on webhook event. Ensure you replace placeholders with actual IDs. ```shell $ curl -n https://api.heroku.com/addons/$ADD_ON_ID_OR_NAME/webhook-events/$APP_WEBHOOK_EVENT_ID \ -H "Accept: application/vnd.heroku+json; version=3" ``` -------------------------------- ### Example: Get mTLS IP Allowlist Rule Status Source: https://devcenter.heroku.com/articles/apache-kafka-on-heroku-via-mtls An example of retrieving the status for a previously created IP allowlist rule. It shows the command with placeholder values replaced by actual identifiers. ```bash $ heroku data:mtls:ip-rules:get kafka-sushi-12345 --id 38c466b6-dcfb-4869-b5ac-40420b786fb4 --app example-app ``` -------------------------------- ### Create App Directory Source: https://devcenter.heroku.com/articles/platform-api-deploying-slugs Create and navigate into the application directory. This is the first step for preparing your application code. ```bash $ mkdir app $ cd app ``` -------------------------------- ### Get Release Info Response Source: https://devcenter.heroku.com/articles/platform-api-reference Example JSON response when retrieving information for a specific Heroku release. ```json { "addon_plan_names": [ "heroku-postgresql:dev" ], "artifacts": [ { "type": "slug", "id": "01234567-89ab-cdef-0123-456789abcdef" } ], "app": { "name": "example", "id": "01234567-89ab-cdef-0123-456789abcdef" }, "created_at": "2012-01-01T12:00:00Z", "description": "Added new feature", "id": "01234567-89ab-cdef-0123-456789abcdef", "updated_at": "2012-01-01T12:00:00Z", "slug": { "id": "01234567-89ab-cdef-0123-456789abcdef" }, "status": "succeeded", "user": { "id": "01234567-89ab-cdef-0123-456789abcdef", "email": "username@example.com" }, "version": 11, "current": true, "output_stream_url": "https://release-output.heroku.com/streams/01234567-89ab-cdef-0123-456789abcdef", "eligible_for_rollback": true } ``` -------------------------------- ### Example Response: Connect to Salesforce Org Source: https://devcenter.heroku.com/articles/heroku-applink-api A sample response after successfully initiating a connection to a Salesforce org. It includes connection details, status, and org information. ```json { "id": "a8bc7bcb-89c3-45c0-b7b7-4fb4427e598b", "redirect_uri": "https://login.salesforce.com/services/oauth2/authorize?client_id=3MVG...&redirect_uri=https%3A%2F%2Fcreds-virginia.events.staging.herokudev.com%2Fsalesforce%2Foauth%2Fcallback&response_type=code&state=ey...", "status": "connecting", "org": { "id": "00DSG00000DGEIr2AP", "connection_name": "productionOrg", "instance_url": "https://mydomain.my.salesforce.com", "type": "SalesforceOrg", "api_verion": "57.0", "user_auth": { "username": "admin@example.org", "user_id": "005...", "access_token": "00DSG00000DGEIr2AP!" } "app_id": "ef01ec58-63f6-478b-ab87-34f82b3c5bdd", "addon_id": "fe3b4938-3383-4c40-868c-1a5cdc38a358", "created_at": "2025-04-06T18:20:42.226577Z", "connection_method": "OAuth" } } ``` -------------------------------- ### Get pgvector Version Source: https://devcenter.heroku.com/articles/pgvector-heroku-postgres Query the `pg_extension` table to retrieve the specific version of the pgvector extension installed. ```sql SELECT extversion FROM pg_extension WHERE extname = 'vector'; ``` -------------------------------- ### Create AppOptics Agent Directory (Java) Source: https://devcenter.heroku.com/articles/appoptics Create a dedicated subdirectory for the AppOptics agent and navigate into it. This is the first step for manual agent installation. ```bash $ pwd /home/example/heroku/java-getting-started $ mkdir appoptics-agent/ $ cd appoptics-agent ``` -------------------------------- ### Setup and Migrate SQLite Locally Source: https://devcenter.heroku.com/articles/laravel-memcache Create the SQLite database file and run migrations locally if you are using SQLite for development. ```bash $ touch database/database.sqlite $ php artisan migrate --force ``` -------------------------------- ### Clone Sample Java App Source: https://devcenter.heroku.com/articles/getting-started-with-java Clone the Heroku Java getting started sample application to your local machine. ```bash $ git clone https://github.com/heroku/java-getting-started $ cd java-getting-started ``` -------------------------------- ### Example .env File Contents Source: https://devcenter.heroku.com/articles/heroku-local This is an example of how your .env file might be structured with key-value pairs for configuration. ```dotenv S3_KEY=mykey S3_SECRET=mysecret ``` -------------------------------- ### Heroku Clock Process Logs Source: https://devcenter.heroku.com/articles/clock-processes-python Example output in Heroku logs indicating the clock process has started and is queuing jobs. ```log 2023-05-30T20:59:38+00:00 heroku[clock.1]: State changed from created to starting 2023-05-30T20:59:38+00:00 heroku[api]: Scale to clock=1, web=3 by user@heroku.com 2023-05-30T20:59:40+00:00 heroku[clock.1]: Starting process with command `python clock.py` 2023-05-30T20:59:41+00:00 heroku[clock.1]: State changed from starting to up 2023-05-30T20:59:48+00:00 app[clock.1]: Starting clock for 1 events: [ Queueing interval job ] 2023-05-30T20:59:48+00:00 app[clock.1]: Queuing scheduled jobs ``` -------------------------------- ### Get PostGIS Version Source: https://devcenter.heroku.com/articles/postgis Execute this SQL query in `psql` to retrieve the specific version of the PostGIS extension installed on your database. ```sql => SELECT postgis_version(); postgis_version --------------------------------------- 3.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 (1 row) (1 row) ``` -------------------------------- ### Clone Sample Go App Source: https://devcenter.heroku.com/articles/getting-started-with-go Clone the sample Go application to your local machine to begin. This sets up a local Git repository with the necessary files. ```bash $ git clone https://github.com/heroku/go-getting-started.git $ cd go-getting-started ``` -------------------------------- ### Initialize New Node.js Project with npm init Source: https://devcenter.heroku.com/articles/node-best-practices Use `npm init --yes` to quickly scaffold a package.json file for a new Node.js project. Open package.json afterward to specify details like the Node.js version. ```bash $ mkdir example-app $ cd example-app $ npm init --yes ``` -------------------------------- ### Specify Ruby Version in Gemfile.lock Source: https://devcenter.heroku.com/articles/ruby-support-reference Heroku installs the Ruby version specified in your Gemfile.lock. This example shows the format for specifying the Ruby version. ```text RUBY VERSION ruby 3.3.5p100 ``` -------------------------------- ### Curl Example: Get Team Invitation Source: https://devcenter.heroku.com/articles/platform-api-reference Use cURL to fetch a team invitation by its token. Ensure the Accept header is correctly formatted. ```Shell $ curl -n https://api.heroku.com/teams/invitations/$TEAM_INVITATION_TOKEN \ -H "Accept: application/vnd.heroku+json; version=3" ``` -------------------------------- ### List Provisioned Add-ons Source: https://devcenter.heroku.com/articles/getting-started-with-ruby View all add-ons provisioned for your application, including databases. This command displays details such as the add-on name, plan, price, and state. ```bash $ heroku addons Add-on Plan Price Max Price State ------------------------------------------------------------------------------------------------- heroku-postgresql (postgresql-trapezoidal-49653) essential-0 ~$0.007/hour $5/month created └─ as DATABASE ``` -------------------------------- ### Get Apps with Accept-Ranges Header Source: https://devcenter.heroku.com/articles/platform-api-reference This example shows how to retrieve a list of apps and inspect the Accept-Ranges header to understand available sorting properties. ```shell $ curl -i -n -X GET https://api.heroku.com/apps \ -H "Accept: application/vnd.heroku+json; version=3" ``` ```text ... Accept-Ranges: id, name ... ```