CINXE.COM
Heroku Dev Center Articles
<?xml version="1.0" encoding="UTF-8"?> <feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom"> <id>tag:devcenter.heroku.com,2005:/articles/feed</id> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com"/> <link rel="self" type="application/atom+xml" href="https://devcenter.heroku.com/articles/feed"/> <title>Heroku Dev Center Articles</title> <author> <name>Heroku</name> </author> <updated>2025-02-13T22:20:32Z</updated> <entry> <id>tag:devcenter.heroku.com,2005:Article/8680</id> <published>2025-02-13T22:20:32Z</published> <updated>2025-02-13T22:33:43Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/stratisai"/> <title>Stratis AI</title> <content type="html"><p><a href="https://elements.heroku.com/addons/stratisai">Stratis AI</a> is an add-on that brings conversational AI to your Heroku applications. With Stratis AI, you can enable natural language interactions with your data, websites, and documents, to provide users access to knowledge and insights.</p> <p>Adding Stratis AI to your Heroku app can:</p> <ul> <li><strong>Turn Websites Into Knowledge</strong>: Make your website’s information accessible through conversational interactions.</li> <li><strong>Search Documents Instantly</strong>: Integrate AWS S3 documents for instant AI-powered search.</li> <li><strong>Talk to Your Heroku Database</strong>: Query <a href="https://devcenter.heroku.com/articles/heroku-postgresql">Heroku Postgres</a> databases in plain language with no SQL required (available at GA).</li> <li><strong>Engage Conversationally with Data Cloud &amp; Customer 360</strong>: Unlock <a href="https://help.salesforce.com/s/articleView?id=data.c360_a_data_cloud.htm&amp;type=5">Salesforce Data Cloud</a> insights with conversational access (available at GA).</li> <li><strong>Build Custom Agents</strong>: Create agentic experiences tailored to your business needs.</li> <li><strong>Bring the Conversation Anywhere</strong>: Deploy chat functionality to any Heroku app with a simple JavaScript integration.</li> <li><strong>Converse in Any Language</strong>: Create agentic experiences in any language around the globe.</li> </ul> <h2 id="getting-started-core-concepts">Getting Started: Core Concepts</h2> <p>Here are some Stratis AI concepts to get familiar with:</p> <ul> <li>An <strong>Agent</strong> is a combination of one of more <strong>Actions</strong> that powers a digital assistant or chatbot.</li> <li>An <strong>Action</strong> determines what your agents can do with a <strong>Knowledge Source</strong>.</li> <li><strong>Knowledge Sources</strong> are where an agent retrieves information from. In the beta, you can create knowledge sources from documents, such as a S3 drive, and web content, such as website URLs.</li> </ul> <p>In the beta release, you can create an agentic digital assistant that knows about two types of knowledge: documents and web content. After provisioning our add-on, see the <a href="#building-your-agents">Building Your Agents</a> section where we:</p> <ul> <li>Create two <strong>Knowledge Sources</strong>: an uploaded PDF and a specified website</li> <li>Create two <strong>Actions</strong>: a doc action and a web action</li> <li>Create an <strong>Agent</strong> and add the two <strong>Actions</strong> to it</li> <li>Create a digital assistant or chatbot <strong>Deployment</strong> and see our new <strong>Agent</strong> in action.</li> <li>Optionally, deploy our <strong>Agent</strong> to a sample Heroku app using the included <strong>Heroku Button</strong> so we can test it live.</li> </ul> <h2 id="provisioning-the-add-on">Provisioning the Add-on</h2> <p>Attach Stratis AI to a Heroku application via the CLI:</p> <div class="callout"> <p>Reference the <a href="https://elements.heroku.com/addons/stratisai">Stratis AI Elements Page</a> for a list of available plans and regions.</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:create stratisai:PLAN --app HEROKU_APP_NAME Creating stratisai on ⬢ HEROKU_APP_NAME... free All set! To get started, run `heroku addons:open stratisai -a HEROKU_APP_NAME`. </code></pre> <p>After provisioning Stratis AI, the <code>STRATISAI_ORG_ID</code> config var is available in the attached app’s configuration. It contains the unique identifier for the Stratis organization created for your Heroku app. For now, you can ignore this config var, but it can come in handy for referencing it during a support issue during troubleshooting. You can see the config var via the <code>heroku config:get</code> command:</p> <pre class="language-term"><code class="language-term">$ heroku config:get STRATISAI_ORG_ID -a HEROKU_APP_NAME f9b807aa-84ba-4b00-b234-00806c5f0155 </code></pre> <h2 id="accessing-the-admin-dashboard">Accessing the Admin Dashboard</h2> <p>After provision the add-on, access the admin dashboard via the browser or CLI:</p> <h3 id="via-browser">Via Browser</h3> <ol> <li>Navigate to the <strong><code>Resources</code></strong> tab of your app in the Heroku Dashboard.</li> <li>Select the <strong><code>Stratis AI</code></strong> resource to open the Stratis AI dashboard in a new window.</li> </ol> <h3 id="via-command-line">Via Command Line</h3> <p>Access the dashboard via the CLI:</p> <pre class="language-term"><code class="language-term">$ heroku addons:open stratisai -a HEROKU_APP_NAME </code></pre> <h2 id="building-your-agents">Building Your Agents</h2> <p>The <strong><code>Setup Wizard</code></strong> guides you through configuring and deploying your conversational agents in four steps. This process ensures an easy experience, even for users with limited technical expertise.</p> <ol> <li><a href="#connect-your-knowledge-sources">Connect Your Knowledge Sources</a></li> <li><a href="#define-your-actions-tools">Define Your Actions (Tools)</a></li> <li><a href="#assemble-agents">Assemble Agents</a></li> <li><a href="#deploying-conversational-agents">Deploying Conversational Agents</a></li> </ol> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842761-sai-setup-wizard.png" alt="Stratis AI setup wizard"></p> <h3 id="connect-your-knowledge-sources">Connect Your Knowledge Sources</h3> <p>The Stratis AI beta supports multiple knowledge sources including:</p> <ul> <li>AWS S3 Buckets: add and schedule periodic ingestion from your S3 documents.</li> <li>Websites: enable web ingestion for real-time data updates.</li> </ul> <div class="callout"> <p>An additional library of tools and knowledge sources are available at GA.</p> </div> <p>To create a knowledge source:</p> <ol> <li>Select the type of source, for example, AWS S3 or website.</li> <li>Enter the required credentials, for example, S3 keys or API URLs.</li> <li>Choose a synchronization schedule, for example, daily, weekly, or monthly.</li> <li>Click <strong><code>Submit</code></strong>.</li> </ol> <p>Our example shows the configuration for creating a web source with an hourly sync schedule.</p> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842760-sai-add-web-source.png" alt="Creating a Stratis AI web source"></p> <p>You can view and edit your web sources via the list view after creating them.</p> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842761-sai-web-sources.png" alt="Viewing Stratis AI web sources"></p> <p>After configuring your knowledge sources, an automatic process triggers to crawl the source and then vectorize the information into <a href="https://github.com/pgvector/pgvector"><code>pgvector</code></a>. During this process, you can select the knowledge source and view the progress. Usually, the crawl is very fast and depending on the size of the source, the vectorization follows shortly.</p> <h3 id="define-your-actions-tools">Define Your Actions (Tools)</h3> <p>Actions are the building blocks of your agents. They determine what your agents can do with the configured data sources. For example:</p> <ul> <li>Retrieving specific documents from AWS S3.</li> <li>Searching website content.</li> </ul> <p>To create an action in the setup wizard:</p> <ol> <li>Select a knowledge source you created.</li> <li>Select the specific additional configuration, such as the query or function the action performs if applicable.</li> <li>Add a meaningful name and description to help agents use it.</li> <li>Click <strong><code>Submit</code></strong>.</li> </ol> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842760-sai-add-action.png" alt="Creating a Stratis AI action"></p> <h3 id="assemble-agents">Assemble Agents</h3> <p>Agents combine specific actions to perform meaningful tasks. You can customize agents to fit different workflows or business needs.</p> <p>To create an agent in the wizard:</p> <ol> <li>Assign one or more actions you created to the agent.</li> <li>Select a language or processing capabilities for the agent.</li> <li>Add optional details like a custom persona or branding logo.</li> <li>Click <strong><code>Submit</code></strong>.</li> </ol> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842760-sai-add-agent.png" alt="Creating a Stratis AI agent"></p> <p>In the <strong><code>Agents</code></strong> page, you can test an ad-hoc conversation with the agent by clicking the message icon. Use this feature to validate your agent before making it available to a deployed chat interface.</p> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842760-sai-agent-admin-chat.png" alt="Chatting with a Stratis AI agent in the admin UI"></p> <h2 id="deploying-conversational-agents">Deploying Conversational Agents</h2> <p>Deploy your agents to interact with users via <strong>Conversational Agents</strong>. You can embed these interfaces into your website via manual code insertion or a <a href="https://devcenter.heroku.com/articles/heroku-button">Heroku Button</a>.</p> <p>During this beta, you can deploy your conversational agents by placing a small JavaScript snippet the Stratis AI add-on provides into your web or mobile app. If you have any questions on where to place this snippet, you can reach out to us at <a href="mailto:support@stratisglobal.com">support@stratisglobal.com</a>.</p> <p>To simplify this process, we’re providing a sample site deployment method that includes your created agent using a Heroku Button. To see your agent running on this sample site, click the Heroku Button on the <strong><code>Deploy Agent Chat Interfaces</code></strong> page, or from <strong><code>Operate → Deployments</code></strong> in the Admin UI.</p> <p>Either way, begin by creating the conversational agent in the setup wizard:</p> <ol> <li>Add a meaningful name and icon for your chat interface.</li> <li>Assign one or more agents you created to the chat interface.</li> <li>Optionally, provide a list of website domains your chat interface can be on.</li> <li>Click <strong><code>Submit</code></strong>.</li> </ol> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842760-sai-add-chat-client.png" alt="Creating a Stratis AI chat interface"></p> <h3 id="deploying-via-code-change">Deploying via Code Change</h3> <p>To deploy via a code change:</p> <ol> <li>Grab the generated code snippet from the <strong><code>Setup Wizard</code></strong> by clicking the copy icon under the <strong><code>Message</code></strong> column on the chat interface’s row. You can also visually inspect the code snippet by clicking the pencil icon.</li> <li>Insert the code snippet into your website’s code, specifically inside the <code>&lt;body&gt;</code> of the HTML. This step varies based on your chosen web framework. Reach out at <a href="mailto:support@stratisglobal.com">support@stratisglobal.com</a> for help.</li> </ol> <h3 id="deploying-via-heroku-button">Deploying via Heroku Button</h3> <p>To deploy via a Heroku Button, click the <strong><code>Deploy to Heroku</code></strong> button on the chat interface row you want to deploy. This button opens up a new page where you enter a name for your app and click <strong><code>Deploy</code></strong>.</p> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842760-sai-chat-clients.ai.png" alt="Viewing Stratis AI chat interfaces"></p> <p>After the new app deploys, click the <strong><code>View</code></strong> button to chat with your agent.</p> <p><img src="https://assets.devcenter.heroku.com/article-images/1733842685-sai-example-chat-interface-app.png" alt="sai-example-chat-interface-app"></p> <h2 id="next-steps">Next Steps</h2> <p>After successfully creating and deploying your first conversational agent, you can iterate and improve it by:</p> <ul> <li>Adding knowledge sources</li> <li>Monitoring the crawling and vectorizing of those sources</li> <li>Adding more actions</li> <li>Adding configurations and parameters to how your agent performs</li> <li>Testing your agents for accuracy and performance</li> </ul> <h2 id="removing-the-add-on">Removing the Add-on</h2> <p>Remove Stratis AI via the CLI:</p> <div class="warning"> <p>This action destroys all associated knowledge source crawls and vectorizations, associated actions, and all agents. You can’t undo it!</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:destroy stratisai Destroying stratisai-trapezoidal-84750 on ⬢ HEROKU_APP_NAME... done </code></pre> <h2 id="support">Support</h2> <p>Submit all Stratis AI support and runtime issues via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>. Any non-support-related issues or product feedback is welcome at <a href="mailto:support@stratisglobal.com">support@stratisglobal.com</a>.</p></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8155</id> <published>2025-02-11T09:23:41Z</published> <updated>2025-02-14T17:51:45Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/ah-grafana-stackhero"/> <title>Stackhero for Grafana</title> <content type="html"><p><a href="https://elements.heroku.com/addons/ah-grafana-stackhero">Stackhero for Grafana</a> provides a managed Grafana service running on a fully dedicated instance.</p> <p>The <a href="https://elements.heroku.com/addons/ah-grafana-stackhero">Stackhero for Grafana</a> add-on offers various features:</p> <ul> <li>A private instance (dedicated VM) for high performances and security</li> <li>TLS encryption (aka SSL)</li> <li>An automatic backup every 24 hours</li> <li>One click to update to new Grafana versions</li> </ul> <h2 id="provisioning-the-add-on">Provisioning the add-on</h2> <p>Stackhero for Grafana can be attached to a Heroku application via the CLI:</p> <div class="callout"> <p>For more information about available plans, see <a href="https://elements.heroku.com/addons/ah-grafana-stackhero">Stackhero for Grafana</a>.</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:create --wait ah-grafana-stackhero --app &lt;your app name&gt; Creating ah-grafana-stackhero... Your add-on is being provisioned on Stackhero. It will be available in around 2 minutes. </code></pre> <h2 id="connecting-to-the-stackhero-dashboard">Connecting to the Stackhero Dashboard</h2> <p>View your instance usage, restart it, and apply updates with the Stackhero dashboard. You can access the dashboard via the CLI:</p> <pre class="language-term"><code class="language-term">$ heroku addons:open ah-grafana-stackhero Opening ah-grafana-stackhero for sharp-mountain-4005 </code></pre> <p>You can also visit the <a href="https://dashboard.heroku.com/apps">Heroku Dashboard</a>, select your application, and then select <strong><code>Stackhero for Grafana</code></strong> from the <strong><code>Add-ons</code></strong> menu.</p> <h2 id="upgrading-your-plan">Upgrading Your Plan</h2> <div class="warning"> <p>You can’t downgrade an existing add-on.</p> </div> <p>Use the <code>heroku addons:upgrade</code> command to migrate to a new plan.</p> <pre class="language-term"><code class="language-term">$ heroku addons:upgrade ah-grafana-stackhero:newplan -----&gt; Upgrading ah-grafana-stackhero:newplan to sharp-mountain-4005... done Your plan has been updated to: ah-grafana-stackhero:newplan </code></pre> <h2 id="removing-the-add-on">Removing the Add-on</h2> <p>You can remove Stackhero for Grafana via the CLI:</p> <div class="warning"> <p>This destroys all associated data and can’t be undone!</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:destroy ah-grafana-stackhero -----&gt; Removing ah-grafana-stackhero from sharp-mountain-4005... done </code></pre> <h2 id="support">Support</h2> <p>You can submit support and runtime issues for Stackhero for Grafana via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>. For urgent issues, CC support@stackhero.io.</p> <h2 id="additional-resources">Additional Resources</h2> <ul> <li><a href="https://www.stackhero.io/en/services/Grafana/documentations">Grafana documentation by Stackhero</a></li> <li><a href="https://www.stackhero.io/en/services/Grafana/benefits">Grafana cloud</a></li> </ul></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8151</id> <published>2025-02-11T09:23:34Z</published> <updated>2025-02-14T17:50:59Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/ah-matomo-stackhero"/> <title>Stackhero for Matomo</title> <content type="html"><p><a href="https://elements.heroku.com/addons/ah-matomo-stackhero">Stackhero for Matomo</a> provides a managed Matomo service running on a fully dedicated instance.</p> <p>The <a href="https://elements.heroku.com/addons/ah-matomo-stackhero">Stackhero for Matomo</a> add-on provides the following features:</p> <ul> <li>A private instance (dedicated VM) for high performances and security</li> <li>TLS encryption (aka SSL)</li> <li>An automatic backup every 24 hours</li> <li>One click to update to new Matomo versions</li> </ul> <h2 id="provisioning-the-add-on">Provisioning the add-on</h2> <p>Stackhero for Matomo can be attached to a Heroku application via the CLI:</p> <div class="callout"> <p>For more information about available plans, see <a href="https://elements.heroku.com/addons/ah-matomo-stackhero">Stackhero for Matomo</a>.</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:create --wait ah-matomo-stackhero --app &lt;your app name&gt; Creating ah-matomo-stackhero... Your add-on is being provisioned on Stackhero. It will be available in around 2 minutes. </code></pre> <h2 id="connecting-to-the-stackhero-dashboard">Connecting to the Stackhero Dashboard</h2> <p>View your instance usage, restart it, and apply updates with the Stackhero dashboard. You can access the dashboard via the CLI:</p> <pre class="language-term"><code class="language-term">$ heroku addons:open ah-matomo-stackhero Opening ah-matomo-stackhero for sharp-mountain-4005 </code></pre> <p>You can also visit the <a href="https://dashboard.heroku.com/apps">Heroku Dashboard</a>, select your application, and then select <strong><code>Stackhero for Matomo</code></strong> from the <strong><code>Add-ons</code></strong> menu.</p> <h2 id="upgrading-your-plan">Upgrading Your Plan</h2> <div class="warning"> <p>You can’t downgrade an existing add-on.</p> </div> <p>Use the <code>heroku addons:upgrade</code> command to migrate to a new plan.</p> <pre class="language-term"><code class="language-term">$ heroku addons:upgrade ah-matomo-stackhero:newplan -----&gt; Upgrading ah-matomo-stackhero:newplan to sharp-mountain-4005... done Your plan has been updated to: ah-matomo-stackhero:newplan </code></pre> <h2 id="removing-the-add-on">Removing the Add-on</h2> <p>You can remove Stackhero for Matomo via the CLI:</p> <div class="warning"> <p>This destroys all associated data and can’t be undone!</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:destroy ah-matomo-stackhero -----&gt; Removing ah-matomo-stackhero from sharp-mountain-4005... done </code></pre> <h2 id="support">Support</h2> <p>You can submit support and runtime issues for Stackhero for Matomo via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>. For urgent issues, CC support@stackhero.io.</p> <h2 id="additional-resources">Additional Resources</h2> <ul> <li><a href="https://www.stackhero.io/en/services/Matomo/documentations">Matomo documentation</a> by Stackhero</li> <li><a href="https://www.stackhero.io/en/services/Matomo/benefits">Matomo managed cloud</a></li> </ul></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8150</id> <published>2025-02-11T09:23:33Z</published> <updated>2025-02-14T17:51:13Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/ah-opensearch-stackhero"/> <title>Stackhero for OpenSearch</title> <content type="html"><p><a href="https://elements.heroku.com/addons/ah-opensearch-stackhero">Stackhero for OpenSearch</a> provides a managed OpenSearch service running on a fully dedicated instance.</p> <p>With the <a href="https://elements.heroku.com/addons/ah-opensearch-stackhero">Stackhero for OpenSearch</a> add-on, you’ll get:</p> <ul> <li>A private instance (dedicated VM) for high performances and security</li> <li>TLS encryption (aka SSL)</li> <li>An automatic backup every 24 hours</li> <li>One click to update to new OpenSearch versions</li> </ul> <h2 id="provisioning-the-add-on">Provisioning the add-on</h2> <p>Stackhero for OpenSearch can be attached to a Heroku application via the CLI:</p> <div class="callout"> <p>For more information about available plans, see <a href="https://elements.heroku.com/addons/ah-opensearch-stackhero">Stackhero for OpenSearch</a>.</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:create --wait ah-opensearch-stackhero --app &lt;your app name&gt; Creating ah-opensearch-stackhero... Your add-on is being provisioned on Stackhero. It will be available in around 2 minutes. </code></pre> <h2 id="connecting-to-the-stackhero-dashboard">Connecting to the Stackhero Dashboard</h2> <p>View your instance usage, restart it, and apply updates with the Stackhero dashboard. You can access the dashboard via the CLI:</p> <pre class="language-term"><code class="language-term">$ heroku addons:open ah-opensearch-stackhero Opening ah-opensearch-stackhero for sharp-mountain-4005 </code></pre> <p>You can also visit the <a href="https://dashboard.heroku.com/apps">Heroku Dashboard</a>, select your application, and then select <strong><code>Stackhero for OpenSearch</code></strong> from the <strong><code>Add-ons</code></strong> menu.</p> <h2 id="upgrading-your-plan">Upgrading Your Plan</h2> <div class="warning"> <p>You can’t downgrade an existing add-on.</p> </div> <p>Use the <code>heroku addons:upgrade</code> command to migrate to a new plan.</p> <pre class="language-term"><code class="language-term">$ heroku addons:upgrade ah-opensearch-stackhero:newplan -----&gt; Upgrading ah-opensearch-stackhero:newplan to sharp-mountain-4005... done Your plan has been updated to: ah-opensearch-stackhero:newplan </code></pre> <h2 id="removing-the-add-on">Removing the Add-on</h2> <p>You can remove Stackhero for OpenSearch via the CLI:</p> <div class="warning"> <p>This destroys all associated data and can’t be undone!</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:destroy ah-opensearch-stackhero -----&gt; Removing ah-opensearch-stackhero from sharp-mountain-4005... done </code></pre> <h2 id="support">Support</h2> <p>You can submit support and runtime issues for Stackhero for OpenSearch via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>. For urgent issues, CC support@stackhero.io.</p> <h2 id="additional-resources">Additional Resources</h2> <ul> <li><a href="https://www.stackhero.io/en/services/OpenSearch/documentations">OpenSearch documentation by Stackhero</a></li> <li><a href="https://www.stackhero.io/en/services/OpenSearch/benefits">OpenSearch managed cloud</a></li> </ul></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8152</id> <published>2025-02-11T09:23:33Z</published> <updated>2025-02-14T17:51:26Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/ah-prometheus-stackhero"/> <title>Stackhero for Prometheus</title> <content type="html"><p><a href="https://elements.heroku.com/addons/ah-prometheus-stackhero">Stackhero for Prometheus</a> provides a managed Prometheus service running on a fully dedicated instance.</p> <p>The <a href="https://elements.heroku.com/addons/ah-prometheus-stackhero">Stackhero for Prometheus</a> add-on offers various features:</p> <ul> <li>A private instance (dedicated VM) for high performances and security</li> <li>TLS encryption (aka SSL)</li> <li>An automatic backup every 24 hours</li> <li>One click to update to new Prometheus versions</li> </ul> <h2 id="provisioning-the-add-on">Provisioning the add-on</h2> <p>Stackhero for Prometheus can be attached to a Heroku application via the CLI:</p> <div class="callout"> <p>For more information about available plans, see <a href="https://elements.heroku.com/addons/ah-prometheus-stackhero">Stackhero for Prometheus</a>.</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:create --wait ah-prometheus-stackhero --app &lt;your app name&gt; Creating ah-prometheus-stackhero... Your add-on is being provisioned on Stackhero. It will be available in around 2 minutes. </code></pre> <h2 id="connecting-to-the-stackhero-dashboard">Connecting to the Stackhero Dashboard</h2> <p>View your instance usage, restart it, and apply updates in the Stackhero dashboard. You can access the dashboard via the CLI:</p> <pre class="language-term"><code class="language-term">$ heroku addons:open ah-prometheus-stackhero Opening ah-prometheus-stackhero for sharp-mountain-4005 </code></pre> <p>You can also visit the <a href="https://dashboard.heroku.com/apps">Heroku Dashboard</a>, select your application, and then select <strong><code>Stackhero for Prometheus</code></strong> from the <strong><code>Add-ons</code></strong> menu.</p> <h2 id="upgrading-your-plan">Upgrading Your Plan</h2> <div class="warning"> <p>You can’t downgrade an existing add-on.</p> </div> <p>Use the <code>heroku addons:upgrade</code> command to migrate to a new plan.</p> <pre class="language-term"><code class="language-term">$ heroku addons:upgrade ah-prometheus-stackhero:newplan -----&gt; Upgrading ah-prometheus-stackhero:newplan to sharp-mountain-4005... done Your plan has been updated to: ah-prometheus-stackhero:newplan </code></pre> <h2 id="removing-the-add-on">Removing the Add-on</h2> <p>You can remove Stackhero for Prometheus via the CLI:</p> <div class="warning"> <p>This destroys all associated data and can’t be undone!</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:destroy ah-prometheus-stackhero -----&gt; Removing ah-prometheus-stackhero from sharp-mountain-4005... done </code></pre> <h2 id="support">Support</h2> <p>You can submit support and runtime issues for Stackhero for Prometheus via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>. For urgent issues, CC support@stackhero.io.</p> <h2 id="additional-resources">Additional Resources</h2> <ul> <li><a href="https://www.stackhero.io/en/services/Prometheus/documentations">Prometheus documentation by Stackhero</a></li> <li><a href="https://www.stackhero.io/en/services/Prometheus/benefits">Prometheus cloud</a></li> </ul></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8149</id> <published>2025-02-11T09:23:24Z</published> <updated>2025-02-14T17:50:28Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/ah-valkey-stackhero"/> <title>Stackhero for Valkey</title> <content type="html"><p><a href="https://elements.heroku.com/addons/ah-valkey-stackhero">Stackhero for Valkey</a> provides a managed Valkey instance running on a fully dedicated instance.</p> <p>Valkey is an open-source fork of the Redis project before they changed their license. Valkey is a drop-in replacement for Redis 7.2 and previous versions.</p> <p>With the <a href="https://elements.heroku.com/addons/ah-valkey-stackhero">Stackhero for Valkey</a> add-on, you’ll get:</p> <ul> <li>A private instance (dedicated VM) for high performances and security</li> <li>TLS encryption (aka SSL)</li> <li>An automatic backup every 24 hours</li> <li>A graphical web UI (Redis Commander)</li> <li>One click to update to new Valkey versions</li> </ul> <p>All Redis clients can connect to <a href="https://elements.heroku.com/addons/ah-valkey-stackhero">Stackhero for Valkey</a>, and there’s a Valkey/Redis client library for almost every language out there, including Ruby, Node.js, Java, Python, Clojure, and Erlang.</p> <div class="warning"> <p>When you choose a Valkey or Redis client library, opt for one that supports TLS encryption (aka SSL) for the best security. We strongly discourage you to use Valkey without TLS support unless you know exactly what you are doing.</p> </div> <h2 id="provisioning-the-add-on">Provisioning the add-on</h2> <p>Stackhero for Valkey can be attached to a Heroku application via the CLI:</p> <div class="callout"> <p>A list of all plans available can be found <a href="https://elements.heroku.com/addons/ah-valkey-stackhero">here</a>.</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:create --wait ah-valkey-stackhero --app &lt;your app name&gt; Creating ah-valkey-stackhero... Your add-on is being provisioned on Stackhero. It will be available in around 2 minutes. </code></pre> <p>After you provision Stackhero for Valkey, the <code>STACKHERO_VALKEY_URL_TLS</code> and <code>STACKHERO_VALKEY_URL_CLEAR</code> config variables are available in your app’s configuration. They contain the URLs to your Valkey instance as its credentials.</p> <ul> <li><code>STACKHERO_VALKEY_URL_TLS</code> is the URL to your Valkey instance with TLS encryption. We recommend you use this URL to connect to your Valkey instance.</li> <li><code>STACKHERO_VALKEY_URL_CLEAR</code> is the URL to your Valkey instance with <em>no encryption</em> (clear).</li> </ul> <p>You can see the content of those variables via the <code>heroku config:get</code> command:</p> <pre class="language-term"><code class="language-term">$ heroku config:get STACKHERO_VALKEY_URL_TLS rediss://user:password@domain:port </code></pre> <p>After you install Stackhero for Valkey, you must configure your application to fully integrate with the add-on.</p> <h2 id="local-setup">Local setup</h2> <p>After you provision the add-on, it’s necessary to locally replicate its config variables so your development environment can operate against the service.</p> <p>Use the Heroku Local command-line tool to configure, run, and manage process types specified in your app’s <a href="https://devcenter.heroku.com/articles/procfile">Procfile</a>. Heroku Local reads configuration variables from a <code>.env</code> file. To view all of your app’s config variables, type <code>heroku config</code>. Use these commands for each value that you want to add to your <code>.env</code> file:</p> <pre class="language-term"><code class="language-term">$ heroku config:get STACKHERO_VALKEY_URL_TLS -s &gt;&gt; .env $ heroku config:get STACKHERO_VALKEY_URL_CLEAR -s &gt;&gt; .env </code></pre> <div class="warning"> <p>Credentials and other sensitive configuration values should not be committed to source-control. In Git, exclude the <code>.env</code> file with: <code>echo .env &gt;&gt; .gitignore</code>.</p> </div> <p>For more information, see <a href="https://devcenter.heroku.com/articles/heroku-local">Running Apps Locally</a>.</p> <h2 id="configure-valkey-on-java">Configure Valkey on Java</h2> <p>You can use the environment variable <code>STACKHERO_VALKEY_URL_TLS</code> to connect to Valkey.</p> <p>Here’s an example of a connection using Jedis:</p> <pre class="language-java"><code class="language-java">private static Jedis getConnection() throws URISyntaxException { URI valkeyURI = new URI(System.getenv("STACKHERO_VALKEY_URL_TLS")); Jedis jedis = new Jedis(valkeyURI); return jedis; } </code></pre> <p>For more information, see the official <a href="https://github.com/redis/jedis">Jedis repository</a> and the official <a href="https://github.com/redis/jedis/wiki">wiki</a>.</p> <p>In a multithreaded environment, like a web server, use Jedis Pool:</p> <pre class="language-java"><code class="language-java">public static JedisPool getPool() { URI valkeyURI = new URI(System.getenv("STACKHERO_VALKEY_URL_TLS")); JedisPoolConfig poolConfig = new JedisPoolConfig(); poolConfig.setMaxTotal(10); poolConfig.setMaxIdle(5); poolConfig.setMinIdle(1); poolConfig.setTestOnBorrow(true); poolConfig.setTestOnReturn(true); poolConfig.setTestWhileIdle(true); JedisPool pool = new JedisPool(poolConfig, valkeyURI); return pool; } </code></pre> <p>For more information, see the official <a href="https://github.com/redis/jedis/wiki/Getting-started#using-jedis-in-a-multithreaded-environment">Jedis wiki</a>.</p> <h2 id="configure-valkey-on-ruby">Configure Valkey on Ruby</h2> <p>Install the Redis gem:</p> <pre class="language-term"><code class="language-term">$ bundle add redis </code></pre> <p>With Rails, you have to create the initializer file <code>config/initializers/redis.rb</code> like this:</p> <pre class="language-ruby"><code class="language-ruby">$redis = Redis.new(url: ENV["STACKHERO_VALKEY_URL_TLS"]) </code></pre> <p>To use Valkey as a cache system, edit the <code>config/environments/production.rb</code> file and add this line:</p> <pre class="language-ruby"><code class="language-ruby">config.cache_store = :redis_cache_store, { url: ENV['STACKHERO_VALKEY_URL_TLS'] } </code></pre> <div class="note"> <p>By default caching is only enabled on the production environment.</p> <p>To test caching on development, edit the file <code>config/environments/development.rb</code>, add the configuration from above, and add <code>config.action_controller.perform_caching = true</code> to enable caching.</p> <p>A good way to test that caching works is to start a Rails console with <code>bin/rails console</code>, then test writing with <code>Rails.cache.write("foo", "bar")</code>.</p> </div> <h3 id="configure-valkey-on-sidekiq">Configure Valkey on Sidekiq</h3> <p>To use Stackhero for Valkey as your Sidekiq Valkey server, set the environment variable <code>REDIS_PROVIDER</code> to <code>STACKHERO_VALKEY_URL_TLS</code>:</p> <pre class="language-term"><code class="language-term">$ heroku config:set REDIS_PROVIDER=STACKHERO_VALKEY_URL_TLS </code></pre> <p>Sidekiq will automatically use Stackero for Valkey then.</p> <h3 id="configure-valkey-on-resque">Configure Valkey on Resque</h3> <p>Edit the file <code>config/resque.yml</code> and replace <code>production: &lt;%= ENV['REDIS_URL'] %&gt;</code> with this value:</p> <pre class="language-yaml"><code class="language-yaml">production: &lt;%= ENV['STACKHERO_VALKEY_URL_TLS'] %&gt; </code></pre> <p>Resque will then use Stackero for Valkey.</p> <h2 id="configure-valkey-on-python">Configure Valkey on Python</h2> <p>Install the Redis package:</p> <pre class="language-term"><code class="language-term">$ pip install redis $ pip freeze &gt; requirements.txt </code></pre><pre class="language-python"><code class="language-python">import os import redis r = redis.from_url(os.environ.get("STACKHERO_VALKEY_URL_TLS")) </code></pre> <p>For more information, see the official <a href="https://pypi.org/project/redis/">Python redis package documentation</a>.</p> <h3 id="how-to-avoid-error-connection-closed-by-server-with-valkey-and-python">How to avoid error “Connection closed by server” with Valkey and Python</h3> <p>The error <code>redis.exceptions.ConnectionError: Connection closed by server</code> is potentially related to the fact that your Python app doesn’t exchange data with Valkey for a certain time and the connection closes automatically. When your app tries to exchange again with Valkey, the connection doesn’t work anymore and you get the error <code>Connection closed by server</code>.</p> <p>To resolve this, you can pass the <code>health_check_interval</code> setting to your Valkey connection like this:</p> <pre class="language-python"><code class="language-python">r = redis.from_url( 'rediss://default:&lt;password&gt;@XXXXXX.stackhero-network.com:&lt;port&gt;', health_check_interval=10, socket_connect_timeout=5, retry_on_timeout=True, socket_keepalive=True ) </code></pre> <p>If you use the Valkey PubSub feature, the <code>redis-py</code> library assumes that you call functions <code>get_message()</code> or <code>listen()</code> more frequently than the <code>health_check_interval</code> value in seconds. In this example, <code>health_check_interval</code> is set to 10 seconds. This means your app has to call <code>get_message()</code> or <code>listen()</code> at least one time each 10 seconds. For more information, see the <a href="https://github.com/redis/redis-py#connections">redis-py official documentation</a>.</p> <p>If this isn’t the case, you’ll get the error <code>Connection closed by server</code>.</p> <p>To avoid that, a trick is to call <code>check_health()</code> regularly.</p> <p>Here’s an example:</p> <pre class="language-python"><code class="language-python">import redis import threading # Connection to Valkey r = redis.from_url( 'rediss://default:&lt;password&gt;@XXXXXX.stackhero-network.com:&lt;port&gt;', health_check_interval=10, socket_connect_timeout=5, retry_on_timeout=True, socket_keepalive=True ) # Create a PubSub instance p = r.pubsub() # Subscribe to the channel "test" p.subscribe('test') # Create a function that will call `check_health` every 5 seconds def redis_auto_check(p): t = threading.Timer(5, redis_auto_check, [ p ]) t.start() p.check_health() # Call the redis_auto_check function redis_auto_check(p) </code></pre> <h2 id="configure-valkey-on-php">Configure Valkey on PHP</h2> <p>Retrieve the URL with <code>getenv('STACKHERO_VALKEY_URL_TLS')</code> and pass it to your preferred Valkey client library.</p> <h2 id="configure-valkey-on-go">Configure Valkey on Go</h2> <p>First install the <a href="https://github.com/go-redis/redis">go-redis</a> package:</p> <pre class="language-term"><code class="language-term">$ go get github.com/go-redis/redis/v8 </code></pre> <p>Then, import it in your code:</p> <pre class="language-go"><code class="language-go">import "github.com/gomodule/redigo/redis" </code></pre> <p>Finally, connect to the Valkey server using the <code>STACKHERO_VALKEY_URL_TLS</code> variable:</p> <pre class="language-go"><code class="language-go">opt, err := redis.ParseURL(os.Getenv("STACKHERO_VALKEY_URL_TLS")) if err != nil { panic(err) } rdb := redis.NewClient(opt) </code></pre> <p>For more information, see the official <a href="https://github.com/go-redis/redis">go-redis repository</a></p> <h2 id="configure-valkey-on-node-js">Configure Valkey on Node.js</h2> <p>We recommend using <a href="https://github.com/luin/ioredis">ioredis</a>.</p> <p>Install the <code>ioredis</code> package:</p> <pre class="language-term"><code class="language-term">$ npm install ioredis </code></pre><pre class="language-javascript"><code class="language-javascript">const Ioredis = require('ioredis'); (async () =&gt; { const valkey = new Ioredis(process.env.STACKHERO_VALKEY_URL_TLS); // Set key "stackhero-example-key" to "abcd" await valkey.set('stackhero-example-key', 'abcd'); // Get key "stackhero-example-key" const value = await valkey.get('stackhero-example-key'); console.log(`Key "stackhero-example-key" has value "${value}"`); // Finally delete key "stackhero-example-key" await valkey.del('stackhero-example-key'); })().catch(error =&gt; { console.error('An error occurred!', error); }); </code></pre> <p>For more examples, see the official <a href="https://github.com/luin/ioredis">ioredis repository</a>.</p> <h2 id="dashboard-and-web-ui-redis-commander">Dashboard and web UI (Redis Commander)</h2> <p>Stackhero dashboard allows you to see your instance usage, restart it, and apply updates. It also gives you the ability to access the web UI to consult your Valkey data directly in a graphical way.</p> <p>You can access the dashboard via the CLI:</p> <pre class="language-term"><code class="language-term">$ heroku addons:open ah-valkey-stackhero Opening ah-valkey-stackhero for sharp-mountain-4005 </code></pre> <p>You can also visit the <a href="https://dashboard.heroku.com/apps">Heroku Dashboard</a> and select the application in question. Then, select <strong><code>Stackhero for Valkey</code></strong> from the <strong><code>Add-ons</code></strong> menu.</p> <p><img src="https://devcenter2.assets.heroku.com/article-images/1638789839-redisDashboard.png" alt="Stackhero dashboard for Valkey"></p> <h2 id="set-eviction-policy">Set eviction policy</h2> <p>Yon can define how Valkey will react when you consume more memory than available on your plan.</p> <p>To do so, <a href="#dashboard-and-web-ui-redis-commander">connect to your Stackhero dashboard</a>, select your Valkey service, then click <strong><code>Configure</code></strong> and set the <strong><code>Eviction policy</code></strong> setting.</p> <p><img src="https://devcenter0.assets.heroku.com/article-images/1638789837-redisConfiguration.png" alt="Configuration of Valkey on Stackhero"></p> <h2 id="upgrading-your-plan">Upgrading your plan</h2> <div class="warning"> <p>You cannot downgrade an existing add-on.</p> </div> <p class="devcenter-parser-special-block-separator" style="display:none">&nbsp;</p> <div class="note"> <p>Application owners must carefully manage the migration timing to ensure proper application function during the migration process.</p> </div> <p>Use the <code>heroku addons:upgrade</code> command to migrate to a new plan.</p> <pre class="language-term"><code class="language-term">$ heroku addons:upgrade ah-valkey-stackhero:newplan -----&gt; Upgrading ah-valkey-stackhero:newplan to sharp-mountain-4005... done Your plan has been updated to: ah-valkey-stackhero:newplan </code></pre> <h2 id="removing-the-add-on">Removing the add-on</h2> <p>You can remove Stackhero for Valkey via the CLI:</p> <div class="warning"> <p>This will destroy all associated data and cannot be undone!</p> </div> <pre class="language-term"><code class="language-term">$ heroku addons:destroy ah-valkey-stackhero -----&gt; Removing ah-valkey-stackhero from sharp-mountain-4005... done </code></pre> <h2 id="support">Support</h2> <p>You can submit support and runtime issues for Stackhero for Valkey via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>. For urgent issues, CC support@stackhero.io.</p> <h2 id="additional-resources">Additional resources</h2> <ul> <li><a href="https://www.stackhero.io/en/services/Valkey/documentations">Valkey documentation by Stackhero</a></li> <li><a href="https://www.stackhero.io/en/services/Valkey/benefits">Valkey managed cloud</a></li> </ul></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8378</id> <published>2025-02-09T19:24:56Z</published> <updated>2025-02-14T17:52:50Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/nscriptiod"/> <title>Nscriptio Static IP</title> <content type="html"><p><a href="https://elements.heroku.com/addons/nscriptio">NScriptio</a> is an add-on that provides Heroku applications the ability to proxy their app network output through HTTP/HTTPS proxy under a pair of fixed, static IP. NScriptio is language and framework agnostic.</p> <p>NScriptio acts as a proxy for outbound traffic, tunneling your requests through a pair of balanced IP addresses. You can use given addresses anywhere you need a fixed IP: API providers, firewall configurations, etc.</p> <h2 id="provisioning-the-add-on">Provisioning the Add-on</h2> <p>Add the Nscriptio add-on to a Heroku application via the CLI:</p> <pre class="language-term"><code class="language-term">$ heroku addons:create nscriptiod --app your-app-name -- --cc=ca -----&gt; Creating nscriptiod on ⬢ your-app-name... free Your add-on is being provisioned, will be available shortly nscriptiod-graceful-83372 is being created in the background. The app will restart when complete... Use heroku addons:info nscriptiod-graceful-83372 to check creation progress Use heroku addons:docs nscriptiod to view documentation </code></pre> <div class="callout"> <p>If your heroku CLI version is below v9.0.0, use <code>heroku addons:create nscriptiod --app your-app-name --cc=ca</code> syntax, above syntax is for version v9.0.0+, for details check <a href="https://github.com/heroku/cli/releases/tag/v9.0.0">ChangeLog</a></p> </div> <p>Use the <code>cc</code> option to specify a country you want your IPs to be in. If not provided, the default is <code>us</code>. We provide IPs from following locations:</p> <table><thead> <tr> <th>Flag</th> <th>Country Code</th> <th>Full Name</th> </tr> </thead><tbody> <tr> <td>🇦🇺</td> <td>au</td> <td>Australia</td> </tr> <tr> <td>🇨🇦</td> <td>ca</td> <td>Canada</td> </tr> <tr> <td>🇩🇪</td> <td>de</td> <td>Germany</td> </tr> <tr> <td>🇪🇸</td> <td>es</td> <td>Spain</td> </tr> <tr> <td>🇫🇷</td> <td>fr</td> <td>France</td> </tr> <tr> <td>🇬🇧</td> <td>gb</td> <td>United Kingdom</td> </tr> <tr> <td>🇮🇹</td> <td>it</td> <td>Italy</td> </tr> <tr> <td>🇸🇬</td> <td>sg</td> <td>Sinapore</td> </tr> <tr> <td>🇺🇸</td> <td>us</td> <td>United States</td> </tr> </tbody></table> <p>If you want more locations, just ask us at <a href="mailto:support@nscriptio.com">support@nscriptio.com</a>.</p> <p>After adding the add-on, the <code>NSCRIPTIOD_HTTP</code>, <code>NSCRIPTIOD_HTTPS</code> config vars are available in the app. You can retrieve them by using the <code>heroku config:get</code> command:</p> <pre class="language-term"><code class="language-term">$ heroku config:get --app your-app-name NSCRIPTIOD_HTTPS https://username:password@nscriptio.online:3128 </code></pre> <h2 id="add-on-dashboard">Add-on Dashboard</h2> <p>Access the dashboard via the CLI:</p> <pre class="language-term"><code class="language-term">heroku addon:open nscriptiod </code></pre> <p>or by visiting the <a href="http://heroku.com/myapps">Heroku apps web interface</a> and selection the application in question, then select NScriptio from the add-ons menu.</p> <h2 id="what-are-my-ips">What are my IPs?</h2> <p>The add-on provides two static IP addresses with fallback capability. Traffic routes through your primary IP, but if it fails, it uses the fallback IP. Both IPs are listed on the add-on dashboard</p> <h2 id="local-setup">Local Setup</h2> <h3 id="environment-setup">Environment Setup</h3> <p>To use NScriptio to proxy requests while developing locally, you can export<code>NSCRIPTIOD_*</code> environment variables to a config file for use in other applications:</p> <pre class="language-term"><code class="language-term">$ heroku config:get --app your-app-name NSCRIPTIOD_HTTPS -s &gt;&gt; .env $ heroku config:get --app your-app-name NSCRIPTIOD_HTTP -s &gt;&gt; .env </code></pre> <p>You can either use the <code>.env</code> file within other application as an <code>ENV</code> import, or use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s <a href="https://devcenter.heroku.com/articles/procfile">Procfile</a>. Heroku Local reads configuration variables from a <code>.env</code> file.</p> <div class="warning"> <p>Don’t commit credentials and other sensitive configuration values to source control. In Git, exclude the <code>.env</code> file with: <code>echo .env &gt;&gt; .gitignore</code>.</p> </div> <p>For more information, see the <a href="https://devcenter.heroku.com/articles/heroku-local">Heroku Local</a> article.</p> <h2 id="use-with-node-js">Use with Node.js</h2> <p>You can use most <code>http</code> libraries with HTTP proxy, but not all of them work with HTTPS. Here we give an example on how to get Axios to work via HTTPS proxy:</p> <pre class="language-javascript"><code class="language-javascript">const axios = require('axios'); const proxyagent = require('https-proxy-agent'); const agent = new proxyagent.HttpsProxyAgent(process.env.NSCRIPTIOD_HTTPS); axios.get('https://ipinfo.io/ip', {proxy:false,httpsAgent:agent}).then(function(res){ console.log(res); }); </code></pre> <h2 id="use-with-ruby">Use with Ruby</h2> <p><code>rest-client</code> and <code>faraday</code> doesn’t support SSL proxy, so you can only use it with a HTTP proxy. With <code>typhoeus</code>, you can use both protocols. Here are the examples for those:</p> <h3 id="rest-client">rest-client</h3> <pre class="language-ruby"><code class="language-ruby">require "rest-client" RestClient.proxy = ENV["NSCRIPTIOD_HTTP"] res = RestClient.get("https://ipinfo.io/ip") remoteIp = res.body puts "IP: #{remoteIp}" </code></pre> <h3 id="faraday">faraday</h3> <pre class="language-ruby"><code class="language-ruby">require 'faraday' conn = Faraday.new(:url =&gt; "https://ipinfo.io/ip", :proxy =&gt; ENV["NSCRIPTIOD_HTTP"]) res = conn.get remoteIp = res.body puts "IP: #{remoteIp}" </code></pre> <h3 id="typhoeus">typhoeus</h3> <pre class="language-ruby"><code class="language-ruby">require 'typhoeus' _, username, password, host, port = ENV["NSCRIPTIOD_HTTPS"].gsub(/(:|\/|@)/,' ').squeeze(' ').split res = Typhoeus.get( 'https://ipinfo.io/ip', proxy: "https://#{host}:#{port}", proxyuserpwd: "#{username}:#{password}" ) remoteIp = res.body puts "IP: #{remoteIp}" </code></pre> <h2 id="use-with-java">Use with Java</h2> <p>Most third-party network libraries support HTTP/HTTPS proxy. Here we use the native Java support by setting the proxy globally:</p> <pre class="language-java"><code class="language-java">import java.net.*; import java.io.*; public class Test { public static void main(String []args) throws IOException { URL pUrl = new URL(System.getenv("NSCRIPTIOD_HTTPS")); String info = pUrl.getUserInfo(); int i = info.indexOf(':'); String user = info.substring(0, i); String password = info.substring(i + 1); System.setProperty("http.proxyHost", pUrl.getHost()); System.setProperty("http.proxyPort", Integer.toString(pUrl.getPort())); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(user, password.toCharArray()); } }); URL url = new URL("https://ipinfo.io/ip"); URLConnection conn = url.openConnection(); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String remoteIp = rd.readLine(); System.out.println("IP:"+remoteIp); } } </code></pre> <h2 id="use-with-python">Use with Python</h2> <pre class="language-python"><code class="language-python">import os, requests r = requests.get('https://ipinfo.io/ip', proxies={ "http" : os.getenv('NSCRIPTIOD_HTTPS'), "https" : os.getenv('NSCRIPTIOD_HTTPS') }) remoteIp=r.text print('IP: '+remoteIp) </code></pre> <p>You can also set the proxy globally by using system <code>http_proxy</code> ENV</p> <pre class="language-python"><code class="language-python">os.environ['http_proxy'] = os.getenv('NSCRIPTIOD_HTTP') os.environ['https_proxy'] = os.getenv('NSCRIPTIOD_HTTP') r = requests.get('https://ipinfo.io/ip') remoteIp=r.text print('IP: '+remoteIp) </code></pre> <h2 id="use-with-golang">Use with Golang</h2> <pre class="language-go"><code class="language-go">package main import ( "net/url" "net/http" "os" "io/ioutil" ) func main () { proxyUrl, _ := url.Parse(os.Getenv("NSCRIPTIOD_HTTPS")) customClient := &amp;http.Client{Transport: &amp;http.Transport{Proxy: http.ProxyURL(proxyUrl)}} resp, err = customClient.Get("https://ipinfo.io/ip") if (err != nil) { println(err.Error()) return } defer resp.Body.Close() remoteIp, _ := ioutil.ReadAll(resp.Body) println("IP: "+string(remoteIp)) } </code></pre> <h2 id="use-with-php">Use with PHP</h2> <pre class="language-php"><code class="language-php">&lt;?php $ch = curl_init("https://ipinfo.io/ip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_PROXY, getenv("NSCRIPTIOD_HTTPS")); $remoteIp = curl_exec($ch); print("IP: ".$remoteIp); curl_close($ch); ?&gt; </code></pre> <h2 id="migrating-between-plans">Migrating between Plans</h2> <div class="note"> <p>Application owners can migrate at any time with no interruption to your service.</p> </div> <p>Use the <code>heroku addons:upgrade</code> command to migrate to a new plan.</p> <pre class="language-term"><code class="language-term">$ heroku addons:upgrade nscriptiod:g50 -----&gt; Upgrading nscriptiod:g50 to sharp-mountain-4005... done, v18 ($10/mo) Your plan has been updated to: nscriptiod:g50 </code></pre> <h2 id="removing-the-add-on">Removing the add-on</h2> <p>Remove the add-on via the CLI.</p> <pre class="language-term"><code class="language-term">heroku addons:destroy nscriptiod -----&gt; Removing nscriptiod from sharp-mountain-4005... done, v20 (free) </code></pre> <h2 id="support">Support</h2> <p>Submit all NScriptio support tickets via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>.</p> <h2 id="faq">FAQ</h2> <h3 id="where-can-i-see-my-usage-data">Where can I see my usage data?</h3> <p>On the add-on’s dashboard.</p> <h3 id="how-do-the-two-ips-work">How do the two IPs work?</h3> <p>Your traffic routes to your primary IP, the first one listed. If a request gets refused by target server or proxy server, the backup IP is used.</p></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8782</id> <published>2025-01-13T15:22:46Z</published> <updated>2025-01-13T15:22:46Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/heroku-php-behavior"/> <title>PHP Behavior in Heroku</title> <content type="html"><p>The Heroku Platform uses the <a href="https://devcenter.heroku.com/articles/php-support">PHP buildpack</a> to handle deployed PHP applications. The following shows Heroku’s behavior towards PHP apps and how it recognizes, runs, and builds them.</p> <h2 id="auto-detection">Auto-Detection</h2> <p>Heroku PHP support applies to applications that have a file named <code>composer.json</code> in the root directory. Even if an application has no <a href="http://getcomposer.org">Composer</a> dependencies, it must include at least an <strong>empty</strong> (<code>{}</code>) <code>composer.json</code> in order to be recognized as a PHP application.</p> <p>When Heroku recognizes a PHP application, it responds accordingly during a push:</p> <pre class="language-term"><code class="language-term">$ git push heroku main -----&gt; PHP app detected … </code></pre> <p>If <code>composer.json</code> specifies dependencies of any kind in its <code>require</code> section, the corresponding <code>composer.lock</code> that gets generated by running <code>composer update</code> must also be committed to the repository, or the push is rejected. This ensures that the dependencies Heroku installs are the same as in any other environment. For detailed instructions, check out the <a href="https://devcenter.heroku.com/articles/deploying-php#manage-dependencies">“Manage Dependencies” section of the Deploying PHP guide</a>.</p> <h2 id="php-runtimes">PHP Runtimes</h2> <p>Heroku allows you to run your application using the official <a href="http://php.net">PHP</a> runtime. To learn how to specify a PHP runtime, refer to the <a href="https://devcenter.heroku.com/articles/specifying-a-php-runtime">corresponding Dev Center article</a>.</p> <h3 id="runtime-settings">Runtime Settings</h3> <p>All PHP runtimes use the respective release’s <code>php.ini-production</code> file as their base <a href="https://www.php.net/manual/en/configuration.file.php"><code>php.ini</code> configuration</a>.</p> <p>Notwithstanding the above, the following INI directives are set to Heroku-specific values:</p> <ul> <li><a href="https://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone"><code>date.timezone</code></a> is set to <code>UTC</code></li> <li><a href="https://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting"><code>error_reporting</code></a> is set to <ul> <li><code>E_ALL &amp; ~E_STRICT</code> for PHP versions before 8.4</li> <li><code>E_ALL</code> for PHP 8.4 or later</li> </ul></li> <li><a href="https://www.php.net/manual/en/ini.core.php#ini.expose-php"><code>expose_php</code></a> is set to <code>Off</code></li> <li><a href="https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length"><code>session.sid_length</code></a> is set to <code>32</code> (for PHP versions 7.3 to 8.3)</li> <li><a href="https://www.php.net/manual/en/ini.core.php#ini.short-open-tag"><code>short_open_tag</code></a> is set to <code>On</code></li> <li><a href="https://www.php.net/manual/en/ini.core.php#ini.user-ini.cache-ttl"><code>user_ini.cache_ttl</code></a> is set to <code>86400</code></li> <li><a href="https://www.php.net/manual/en/ini.core.php#ini.variables-order"><code>variables_order</code></a> is set to <code>EGPCS</code></li> </ul> <p>In addition, the PHP runtimes always have <a href="http://php.net/manual/book.opcache">OPcache</a> enabled for improved performance, with the following configuration changes optimized for the specific characteristics of Heroku’s dynos:</p> <ul> <li><code>opcache.enable_cli</code> is set to <code>1</code></li> <li><code>opcache.validate_timestamps</code> is set to <code>0</code></li> </ul> <h4 id="php-cli">PHP CLI</h4> <p>The <code>memory_limit</code> PHP INI directive for the <code>php</code> CLI executable defaults to the full available dyno memory. For example, worker dynos using a <code>php</code> command use this memory limit instead of the default PHP INI value of <code>128M</code>.</p> <h3 id="default-runtime">Default Runtime</h3> <p>Applications that don’t use a <code>composer.json</code>, or where <code>composer.lock</code> contains no requirements for package <code>php</code> even in any dependent package, will receive the latest version of PHP that is <a href="https://devcenter.heroku.com/articles/php-support#available-versions">available</a> on the app’s <a href="https://devcenter.heroku.com/articles/stack">stack</a>.</p> <h3 id="upgrades">Upgrades</h3> <p>If you deploy an application that doesn’t declare a runtime version dependency, the then-latest version of PHP is used. Your application upgrades to more recent versions of PHP if available automatically upon the next deployment.</p> <p>If your application declares runtime version dependencies, the most recent version matching the version constraint will be selected for installation.</p> <h3 id="runtime-behavior">Runtime Behavior</h3> <p>The <code>$PATH</code> environment variable contains all necessary paths for an application to function at runtime. The <a href="https://getcomposer.org/doc/articles/vendor-binaries.md#can-vendor-binaries-be-installed-somewhere-other-than-vendor-bin-">Composer <code>bin-dir</code></a> is appended to <code>$PATH</code> for convenience.</p> <h4 id="php-fpm-configuration">PHP-FPM Configuration</h4> <p>PHP-FPM is set up to automatically spawn a suitable number of worker processes depending on dyno size and the configured PHP <code>memory_limit</code>. For more information, see <a href="https://devcenter.heroku.com/articles/php-concurrency">Optimizing PHP Application Concurrency</a>.</p> <h4 id="timeouts">Timeouts</h4> <p>When a request <a href="https://devcenter.heroku.com/articles/request-timeout">reaches the Heroku router’s request timeout</a>, a PHP-FPM process continues to run, potentially as long as it takes for example an external timeout to occur. This would tie up that PHP-FPM process, which could then no longer respond to other incoming requests.</p> <p>For applications using PHP 7.4 or later, by default, PHP-FPM will therefore</p> <ul> <li>log a backtrace of requests that take longer than three seconds (<code>request_slowlog_timeout</code> directive), and</li> <li>terminate requests that have exceeded an execution time of 30 seconds (<code>request_terminate_timeout</code> directive) and therefore likely <a href="https://devcenter.heroku.com/articles/request-timeout">timed out</a>.</li> </ul> <p>You may <a href="https://devcenter.heroku.com/articles/custom-php-settings#php-fpm-settings">adjust the settings for PHP-FPM</a> to change these (or other) configuration settings.</p> <h4 id="composer-configuration">Composer Configuration</h4> <p>For convenience, the following settings for Composer are automatically set using environment variables:</p> <ul> <li><code>$COMPOSER_MEMORY_LIMIT</code> defaults to the available dyno memory;</li> <li><code>$COMPOSER_MIRROR_PATH_REPOS</code> defaults to <code>1</code>;</li> <li><code>$COMPOSER_NO_INTERACTION</code> defaults to <code>1</code>;</li> <li><code>$COMPOSER_PROCESS_TIMEOUT</code> defaults to <code>0</code>.</li> </ul> <h2 id="customizing-settings">Customizing Settings</h2> <h3 id="php">PHP</h3> <p>Any <code>.user.ini</code> file that’s placed into a project <a href="http://php.net/manual/en/configuration.file.per-user.php">according to the instructions in the PHP manual</a> loads after the main <code>php.ini</code>. You can use these to set any directive permitted in <code>PHP_INI_ALL</code>, <code>PHP_INI_USER</code> and <code>PHP_INI_PERDIR</code> contexts.</p> <p>For additional details on this and other ways of customizing settings for the PHP runtime, refer to the <a href="https://devcenter.heroku.com/articles/custom-php-settings">corresponding Dev Center article</a>.</p> <h2 id="build-behavior">Build Behavior</h2> <h3 id="installation-of-dependencies">Installation of Dependencies</h3> <p>The following command is run during a deploy to resolve dependencies unless <code>composer.json</code> is empty and no <code>composer.lock</code> is present:</p> <pre class="language-term"><code class="language-term">$ composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction </code></pre> <div class="note"> <p>Heroku won’t install development dependencies from the <code>require-dev</code> section of <code>composer.json</code>. However, if the <code>require-dev</code> section contains a PHP runtime version requirement or lists a dependency that contains such a requirement, then the <code>require</code> section of <code>composer.json</code> must also contain a PHP runtime version requirement or list a dependency that contains such a requirement. This is to ensure that Heroku doesn’t select a default PHP runtime version that conflicts with what other environments (which include <code>require-dev</code> dependencies) install.</p> </div> <p>The installed <a href="https://devcenter.heroku.com/articles/php-support#available-composer-versions">version of Composer</a> will be printed for your reference before installation begins. Builds are run using the latest possible Composer version (1.x, 2.2.x LTS, or 2.3+) that’s compatible with an application’s <code>composer.lock</code>. The respective version of Composer is available on <code>$PATH</code> at app runtime under the command name <code>composer</code>.</p> <p>An application’s Composer cache directory is persisted between builds to speed up package installation on subsequent deploys.</p> <h3 id="custom-compile-step">Custom Compile Step</h3> <p>For applications that wish to execute an additional compilation step during a build that shouldn’t be part of a standard <a href="https://getcomposer.org/doc/articles/scripts.md#event-names"><code>post-install-cmd</code> Composer script</a>, for example an asset compilation or cache pre-warming procedure, a <code>compile</code> <a href="https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands">custom command</a>, if present in <code>composer.json</code>, executes using the following command:</p> <pre class="language-term"><code class="language-term">$ composer compile --no-dev --no-interaction </code></pre> <p>Any such custom script command defined in composer.json can <a href="https://getcomposer.org/doc/articles/scripts.md#defining-scripts">either be a single string, or an array of multiple commands to execute</a>; example:</p> <pre class="language-json"><code class="language-json">{ "scripts": { "compile": [ "@php app/console assetic:dump --env=prod --no-debug", "MyVendor\\MyClass::postDeployComposerCallback" ] } } </code></pre> <div class="note"> <p>If you must execute <code>php</code> or <code>composer</code> in any Composer script, always reference the executables using the <a href="https://getcomposer.org/doc/articles/scripts.md#executing-php-scripts"><code>@php</code></a> or <a href="https://getcomposer.org/doc/articles/scripts.md#calling-composer-commands"><code>@composer</code></a> shorthand notations. This will always call the correct PHP or Composer executable in any environment, and also ensure any <a href="#composer-configuration">Composer configuration</a>, including the right PHP <code>memory_limit</code>, is applied.</p> </div> <p class="devcenter-parser-special-block-separator" style="display:none">&nbsp;</p> <div class="note"> <p>Composer’s <code>bin-dir</code> is <a href="https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands">pushed on top of <code>$PATH</code> during command execution</a>, making binaries installed by dependencies easily accessible as CLI commands when writing scripts without having to use <code>vendor/bin/</code> or a similar prefix.</p> </div> <h3 id="private-repositories">Private Repositories</h3> <p>To use private repositories like <a href="https://packagist.com/">Private Packagist</a>, or packages from a source that requires authentication (such as a private GitHub repository), Composer must be provided with authentication details (typically a token generated by the provider or service).</p> <p>On a development machine, these are typically stored by Composer in <a href="https://getcomposer.org/doc/articles/handling-private-packages-with-satis.md#authentication"><code>auth.json</code></a>, but on Heroku, such <a href="https://devcenter.heroku.com/articles/config-vars">secrets are stored as environment variables</a>. The <a href="https://getcomposer.org/doc/03-cli.md#composer-auth"><code>COMPOSER_AUTH</code> environment variable is automatically read by Composer</a>; its JSON structure is identical to <code>auth.json</code>.</p> <p>The following entries are allowed as top-level keys in the JSON document:</p> <ul> <li><a href="https://getcomposer.org/doc/06-config.md#http-basic"><code>http-basic</code></a></li> <li><a href="https://getcomposer.org/doc/06-config.md#github-oauth"><code>github-oauth</code></a></li> <li><a href="https://getcomposer.org/doc/06-config.md#gitlab-oauth"><code>gitlab-oauth</code></a></li> <li><a href="https://getcomposer.org/doc/06-config.md#gitlab-token"><code>gitlab-token</code></a></li> <li><a href="https://getcomposer.org/doc/06-config.md#bitbucket-oauth"><code>bitbucket-oauth</code></a></li> </ul> <p>Each entry then contains a hash of domains as keys and authentication details as values; the authentication detail structure is specific to each of the sources above and described in the documentation.</p> <div class="note"> <p>When using GitHub Enterprise or the Self-Managed version of GitLab, remember to also set the <a href="https://getcomposer.org/doc/06-config.md#github-domains"><code>github-domains</code></a> or <a href="https://getcomposer.org/doc/06-config.md#gitlab-domains"><code>gitlab-domains</code></a> config option inside your project’s <code>composer.json</code>.</p> </div> <p>For example, to store authentication details for a <a href="https://packagist.com/">Private Packagist</a>, account, set the <code>COMPOSER_AUTH</code> variable using <code>heroku config:set</code> with <code>http-basic</code> details (replacing “YOURTOKEN” with the actual token Private Packagist generated):</p> <pre><code>$ heroku config:set COMPOSER_AUTH='{"http-basic":{"repo.packagist.com":{"username":"token","password":"YOURTOKEN"}}}' </code></pre> <p>To give another example, when using <a href="https://getcomposer.org/doc/05-repositories.md#using-private-repositories">code from private GitHub repositories as Composer dependencies</a>, a <a href="https://github.com/blog/1509-personal-api-tokens">personal OAuth token</a> can be set for authentication. After <a href="https://github.com/settings/tokens/new">creating a new Token</a>, you can set it on Heroku (replacing “YOURTOKEN” with the actual token GitHub generated):</p> <pre><code>$ heroku config:set COMPOSER_AUTH='{"github-oauth":{"github.com":"YOURTOKEN"}}' </code></pre> <div class="note"> <p>The private repository URL in your <code>composer.json</code> must use the <code>https://</code> and not the <code>git://</code> protocol for Composer to be able to use the OAuth token for authentication.</p> </div> <p>Several sets of authentication details can also be combined into a single document; for example, to use both private GitHub and private BitBucket repositories:</p> <pre><code>$ heroku config:set COMPOSER_AUTH='{ "github-oauth": {"github.com": "YOURTOKEN"}, "bitbucket-oauth": {"bitbucket.org": { "consumer-key": "YOURKEY", "consumer-secret": "YOURSECRET"} } }' </code></pre> <div class="note"> <p>You may use line breaks within quotes when setting environment variables on Heroku as shown in the example above, but you must ensure that the quoting is correct when running the <code>heroku config:set</code> command.</p> </div> <h2 id="customer-support">Customer Support</h2> <p>You can submit issues via one of the <a href="https://devcenter.heroku.com/articles/support-channels">Heroku Support channels</a>.</p> <h2 id="additional-reading">Additional Reading</h2> <ul> <li><a href="https://devcenter.heroku.com/articles/php-support">Heroku PHP Support Reference</a></li> <li><a href="https://devcenter.heroku.com/articles/specifying-a-php-runtime">Specifying a PHP Runtime</a></li> </ul></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8786</id> <published>2025-01-03T20:53:25Z</published> <updated>2025-01-03T20:53:25Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/specifying-a-php-runtime"/> <title>Specifying a PHP Runtime</title> <content type="html"><p>You can specify which runtime(s) to use in your <code>composer.json</code> file. Upon a push, Heroku reads the necessary information from <code>composer.lock</code>, if present, and falls back to <code>composer.json</code> otherwise.</p> <h2 id="specifying-a-runtime">Specifying a Runtime</h2> <p>For example, here <code>composer.json</code> instructs Heroku to use the latest version of PHP 8 greater or equal to 8.2.0, but not PHP 9:</p> <pre class="language-json"><code class="language-json">{ "require": { "php": "^8.2.0" } } </code></pre> <div class="warning"> <p>Never specify an exact version like “<code>8.2.13</code>” for PHP, or any other package.</p> <p>Instead, use <a href="https://getcomposer.org/doc/articles/versions.md#next-significant-release-operators">the “<code>^</code>” or “<code>~</code>” <em>next significant release</em> operators</a> to ensure that you get appropriate updates upon push as they become available.</p> <p>For example, specifying “<code>~8.2.0</code>” provides the latest 8.2.x release. This specification is fully compatible with other releases from the 8.2 series, but may contain security or performance updates. It is not compatible with PHP 8.3 or later.</p> <p>To get the latest PHP 8.2 or later (including PHP 8.3, 8.4, and so on) but not PHP 9, specify “<code>^8.2.0</code>”.</p> </div> <p>Heroku prints the versions that are resolved and installs:</p> <pre><code>-----&gt; Installing platform packages... - php (8.2.13) </code></pre> <p>Specifying an unknown or unsupported version results in an error listing potential alternative versions.</p> <h3 id="php">PHP</h3> <p>Specify “<code>php</code>” as a dependency in the <code>require</code> section of your <code>composer.json</code> to use PHP as the runtime. For example, for PHP 8.1 or later:</p> <pre class="language-json"><code class="language-json">{ "require": { "php": "^8.1.0" } } </code></pre> <div class="note"> <p>It’s recommended you always prefix the minimum version you’d like to use with the <code>^</code> selector. This ensures that you receive updated versions as they become available. In the example above, you get PHP 8.1.0 or later, including newer versions in the 8.x series. You won’t get PHP 9 (when it’s released) until you change your specification.</p> </div> <p>Next, ensure that your new requirements are “frozen” to <code>composer.lock</code> by running:</p> <pre class="language-term"><code class="language-term">$ composer update </code></pre> <p>Finally, don’t forget to <code>git add</code> and <code>git commit</code> both files!</p> <h2 id="additional-reading">Additional Reading</h2> <ul> <li><a href="https://devcenter.heroku.com/articles/php-support#php-runtimes">Heroku PHP Support Reference</a></li> <li><a href="https://devcenter.heroku.com/articles/php-behavior-in-heroku">PHP Behavior in Heroku</a></li> </ul></content> </entry> <entry> <id>tag:devcenter.heroku.com,2005:Article/8781</id> <published>2025-01-03T20:52:54Z</published> <updated>2025-01-03T20:52:54Z</updated> <link rel="alternate" type="text/html" href="https://devcenter.heroku.com/articles/managing-php-web-servers"/> <title>Managing PHP Web Servers</title> <content type="html"><p>Heroku supports <strong><a href="http://httpd.apache.org">Apache HTTPD</a> 2.4</strong> and <strong><a href="http://nginx.org">Nginx</a></strong> as dedicated web servers. For testing purposes, users can also use PHP’s built-in web server, although it’s not recommended. To see available web server versions, see <a href="https://devcenter.heroku.com/articles/php-support#available-web-servers">Heroku PHP Support Reference</a>.</p> <p>In the absence of a <code>Procfile</code> entry for the “web” dyno type, the Apache Web server will be used together with the PHP runtime.</p> <h2 id="apache">Apache</h2> <p>Apache interfaces with PHP-FPM via FastCGI using <code>mod_proxy_fcgi</code>.</p> <p>To start Apache together with PHP-FPM and correct settings, use the <code>heroku-php-apache2</code> script:</p> <pre><code>web: heroku-php-apache2 </code></pre> <p>By default, the root folder of your project will be used as the <a href="https://devcenter.heroku.com/articles/custom-php-settings#setting-the-document-root">document root</a>. To use a subdirectory, you can pass the name of a subfolder as the argument to the boot script, for example “public_html”:</p> <pre><code>web: heroku-php-apache2 public_html </code></pre> <p>You can use regular <code>.htaccess</code> files to customize Apache’s behavior, for example for <a href="http://httpd.apache.org/docs/2.4/rewrite/">URL rewriting</a>. For additional details on this and other options to customize settings for Apache, refer to the <a href="https://devcenter.heroku.com/articles/custom-php-settings">corresponding Dev Center article</a>.</p> <h2 id="nginx">Nginx</h2> <p>Nginx interfaces with PHP-FPM via FastCGI.</p> <p>To start Nginx together with PHP-FPM and correct settings, use the <code>heroku-php-nginx</code> script:</p> <pre><code>web: heroku-php-nginx </code></pre> <p>By default, the root folder of your project will be used as the <a href="https://devcenter.heroku.com/articles/custom-php-settings#setting-the-document-root">document root</a>. To use a subdirectory, you can pass the name of a subfolder as the argument to the boot script, for example “public_html”:</p> <pre><code>web: heroku-php-nginx public_html </code></pre> <p>For additional details on different ways of customizing settings for Nginx, refer to the <a href="https://devcenter.heroku.com/articles/custom-php-settings">corresponding Dev Center article</a>.</p> <h2 id="php-built-in-web-server">PHP Built-in Web server</h2> <p>For testing purposes, you can start <a href="http://php.net/manual/en/features.commandline.webserver.php">PHP’s built-in Web server</a> by using <code>php -S 0.0.0.0:$PORT</code> as the entry for “web” in your <code>Procfile</code>:</p> <pre><code>web: php -S ‘0.0.0.0:$PORT </code></pre> <div class="note"> <p>The <code>Procfile</code> must contain <code>$PORT</code> in the line shown above. It’s used by Heroku at runtime to dynamically bind the web server instance to the correct port for the dyno.</p> </div> <p class="devcenter-parser-special-block-separator" style="display:none">&nbsp;</p> <div class="note"> <p>It’s important to bind to all interfaces using <code>0.0.0.0</code>, otherwise Heroku’s <a href="https://devcenter.heroku.com/articles/http-routing">routing</a> won’t be able to forward requests to the web server!</p> </div> <p>You can also pass an alternative document root, or use a router script to process requests. For details, refer to the PHP project’s <a href="https://www.php.net/manual/en/features.commandline.webserver.php">documentation for the built-in Web server</a>.</p></content> </entry> </feed>