Skip to content

Commit 9a49a5c

Browse files
authored
Merge pull request #1180 from gliderlabs/master
Release 0.9.0
2 parents c56b045 + 6c4388c commit 9a49a5c

34 files changed

+421
-57
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.9.0](https://github.com/gliderlabs/herokuish/compare/v0.8.0...v0.9.0) - 2024-03-31
6+
7+
- #1177 @dependabot: Update php to version v248
8+
- #1178 @josegonzalez: chore: update dependencies in scala test app
9+
- #1179 @josegonzalez: feat: use system bash to avoid extracting bash at runtime
10+
511
## [0.8.0](https://github.com/gliderlabs/herokuish/compare/v0.7.6...v0.8.0) - 2024-03-28
612

713
- #1093 @dependabot: chore(deps): bump actions/download-artifact from 3 to 4

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,4 @@ RUN /bin/herokuish buildpack install \
5353
*/tmp
5454
COPY include/default_user.bash /tmp/default_user.bash
5555
RUN bash /tmp/default_user.bash && rm -f /tmp/default_user.bash
56+
ENV BASH_BIN /usr/bin/bash

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ REPOSITORY = herokuish
44
DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
55
HARDWARE = $(shell uname -m)
66
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]')
7-
VERSION ?= 0.8.0
7+
VERSION ?= 0.9.0
88
IMAGE_NAME ?= $(NAME)
99
BUILD_TAG ?= dev
1010
PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://github.com/gliderlabs/herokuish/workflows/CI/badge.svg)](https://github.com/gliderlabs/herokuish/actions?query=workflow%3ACI)
44
[![IRC Channel](https://img.shields.io/badge/irc-%23gliderlabs-blue.svg)](https://kiwiirc.com/client/irc.freenode.net/#gliderlabs)
5-
[![Docker Hub](https://img.shields.io/badge/docker%20hub-v0.8.0-blue)](https://hub.docker.com/r/gliderlabs/herokuish)
5+
[![Docker Hub](https://img.shields.io/badge/docker%20hub-v0.9.0-blue)](https://hub.docker.com/r/gliderlabs/herokuish)
66

77
A command line tool for emulating Heroku build and runtime tasks in containers.
88

@@ -19,7 +19,7 @@ Download and uncompress the latest binary tarball from [releases](https://github
1919
For example, you can do this directly in your Dockerfiles installing into `/bin` as one step:
2020

2121
```shell
22-
RUN curl --location --silent https://github.com/gliderlabs/herokuish/releases/download/v0.8.0/herokuish_0.8.0_linux_x86_64.tgz \
22+
RUN curl --location --silent https://github.com/gliderlabs/herokuish/releases/download/v0.9.0/herokuish_0.9.0_linux_x86_64.tgz \
2323
| tar -xzC /bin
2424
```
2525

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v247
1+
v248
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ENERGY=20 GeV
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package controllers
2+
3+
import javax.inject._
4+
import play.api.mvc._
5+
6+
import play.api.data._
7+
import play.api.data.Forms._
8+
9+
case class $model;format="Camel"$Data(name: String, age: Int)
10+
11+
// NOTE: Add the following to conf/routes to enable compilation of this class:
12+
/*
13+
GET /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Get()
14+
POST /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Post()
15+
*/
16+
17+
/**
18+
* $model;format="Camel"$ form controller for Play Scala
19+
*/
20+
class $model;format="Camel"$Controller @Inject()(mcc: MessagesControllerComponents) extends MessagesAbstractController(mcc) {
21+
22+
val $model;format="camel"$Form = Form(
23+
mapping(
24+
"name" -> text,
25+
"age" -> number
26+
)($model;format="Camel"$Data.apply)($model;format="Camel"$Data.unapply)
27+
)
28+
29+
def $model;format="camel"$Get() = Action { implicit request: MessagesRequest[AnyContent] =>
30+
Ok(views.html.$model;format="camel"$.form($model;format="camel"$Form))
31+
}
32+
33+
def $model;format="camel"$Post() = Action { implicit request: MessagesRequest[AnyContent] =>
34+
$model;format="camel"$Form.bindFromRequest().fold(
35+
formWithErrors => {
36+
// binding failure, you retrieve the form containing errors:
37+
BadRequest(views.html.$model;format="camel"$.form(formWithErrors))
38+
},
39+
$model;format="camel"$Data => {
40+
/* binding success, you get the actual value. */
41+
/* flashing uses a short lived cookie */
42+
Redirect(routes.$model;format="Camel"$Controller.$model;format="camel"$Get()).flashing("success" -> ("Successful " + $model;format="camel"$Data.toString))
43+
}
44+
)
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@($model;format="camel"$Form: Form[$model;format="Camel"$Data])(implicit request: MessagesRequestHeader)
2+
3+
<h1>$model;format="camel"$ form</h1>
4+
5+
@request.flash.get("success").getOrElse("")
6+
7+
@helper.form(action = routes.$model;format="Camel"$Controller.$model;format="camel"$Post()) {
8+
@helper.CSRF.formField
9+
@helper.inputText($model;format="camel"$Form("name"))
10+
@helper.inputText($model;format="camel"$Form("age"))
11+
<input type="submit" value="submit"/>
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description = Generates a Controller with form handling
2+
model = user
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package controllers
2+
3+
import play.api.mvc._
4+
import play.api.i18n._
5+
import org.scalatestplus.play._
6+
import org.scalatestplus.play.guice.GuiceOneAppPerTest
7+
import play.api.http.FileMimeTypes
8+
import play.api.test._
9+
import play.api.test.Helpers._
10+
import play.api.test.CSRFTokenHelper._
11+
12+
import scala.concurrent.ExecutionContext
13+
14+
/**
15+
* $model;format="Camel"$ form controller specs
16+
*/
17+
class $model;format="Camel"$ControllerSpec extends PlaySpec with GuiceOneAppPerTest with Injecting {
18+
19+
// Provide stubs for components based off Helpers.stubControllerComponents()
20+
class StubComponents(cc:ControllerComponents = stubControllerComponents()) extends MessagesControllerComponents {
21+
override val parsers: PlayBodyParsers = cc.parsers
22+
override val messagesApi: MessagesApi = cc.messagesApi
23+
override val langs: Langs = cc.langs
24+
override val fileMimeTypes: FileMimeTypes = cc.fileMimeTypes
25+
override val executionContext: ExecutionContext = cc.executionContext
26+
override val actionBuilder: ActionBuilder[Request, AnyContent] = cc.actionBuilder
27+
override val messagesActionBuilder: MessagesActionBuilder = new DefaultMessagesActionBuilderImpl(parsers.default, messagesApi)(executionContext)
28+
}
29+
30+
"$model;format="Camel"$Controller GET" should {
31+
32+
"render the index page from a new instance of controller" in {
33+
val controller = new $model;format="Camel"$Controller(new StubComponents())
34+
val request = FakeRequest().withCSRFToken
35+
val home = controller.$model;format="camel"$Get().apply(request)
36+
37+
status(home) mustBe OK
38+
contentType(home) mustBe Some("text/html")
39+
}
40+
41+
"render the index page from the application" in {
42+
val controller = inject[$model;format="Camel"$Controller]
43+
val request = FakeRequest().withCSRFToken
44+
val home = controller.$model;format="camel"$Get().apply(request)
45+
46+
status(home) mustBe OK
47+
contentType(home) mustBe Some("text/html")
48+
}
49+
50+
"render the index page from the router" in {
51+
val request = CSRFTokenHelper.addCSRFToken(FakeRequest(GET, "/$model;format="camel"$"))
52+
val home = route(app, request).get
53+
54+
status(home) mustBe OK
55+
contentType(home) mustBe Some("text/html")
56+
}
57+
}
58+
59+
"$model;format="Camel"$Controller POST" should {
60+
"process form" in {
61+
val request = {
62+
FakeRequest(POST, "/$model;format="camel"$")
63+
.withFormUrlEncodedBody("name" -> "play", "age" -> "4")
64+
}
65+
val home = route(app, request).get
66+
67+
status(home) mustBe SEE_OTHER
68+
}
69+
}
70+
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Note: Delete this file if you are copying the code in this repository into your own project.
2+
3+
* @heroku/languages
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
logs
2+
target
3+
/.bsp
4+
/.idea
5+
/.idea_modules
6+
/.classpath
7+
/.project
8+
/.settings
9+
/RUNNING_PID
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2023 Salesforce, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: target/universal/stage/bin/hello
1+
web: target/universal/stage/bin/scala-getting-started -Dhttp.port=${PORT}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: target\universal\stage\bin\scala-getting-started.bat -Dhttp.port=${PORT}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Scala: Getting Started
2+
3+
A barebones Scala app, which can easily be deployed to Heroku.
4+
5+
## Deploying to Heroku
6+
7+
Using resources for this example app counts towards your usage. [Delete your app](https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-apps-destroy) and [database](https://devcenter.heroku.com/articles/heroku-postgresql#removing-the-add-on) as soon as you are done experimenting to control costs.
8+
9+
By default, apps use Eco dynos if you are subscribed to Eco. Otherwise, it defaults to Basic dynos. The Eco dynos plan is shared across all Eco dynos in your account and is recommended if you plan on deploying many small apps to Heroku. Learn more about our low-cost plans [here](https://blog.heroku.com/new-low-cost-plans).
10+
11+
Eligible students can apply for platform credits through our new [Heroku for GitHub Students program](https://blog.heroku.com/github-student-developer-program).
12+
13+
This application supports the [Getting Started with Scala on Heroku](https://devcenter.heroku.com/articles/getting-started-with-scala) article - check it out for instructions on how to deploy this app to Heroku and also run it locally.
14+
15+
Alternatively, you can deploy it using this Heroku Button:
16+
17+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
18+
19+
For more information about using Scala on Heroku, see these Dev Center articles:
20+
21+
- [Scala on Heroku](https://devcenter.heroku.com/categories/scala)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Start on Heroku: Scala",
3+
"description": "A barebones Scala app, which can easily be deployed to Heroku.",
4+
"addons": ["heroku-postgresql"]
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package controllers
2+
3+
import javax.inject._
4+
import play.api._
5+
import play.api.db.Database
6+
import play.api.mvc._
7+
8+
@Singleton
9+
class Application @Inject()(val controllerComponents: ControllerComponents, val database: Database) extends BaseController {
10+
11+
def index(): Action[AnyContent] = Action { implicit request: Request[AnyContent] =>
12+
Ok("scala")
13+
}
14+
15+
def db(): Action[AnyContent] = Action { implicit request: Request[AnyContent] =>
16+
// In this getting started app, we don't use a custom execution context to keep the code and configuration simple.
17+
// For real-world apps, consult the Play documentation on how to configure custom contexts and how to use them:
18+
// https://www.playframework.com/documentation/2.8.19/AccessingAnSQLDatabase#Using-a-CustomExecutionContext
19+
database.withConnection { connection =>
20+
val statement = connection.createStatement()
21+
statement.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)")
22+
statement.executeUpdate("INSERT INTO ticks VALUES (now())")
23+
24+
val output = new StringBuilder();
25+
val resultSet = statement.executeQuery("SELECT tick FROM ticks")
26+
while (resultSet.next()) {
27+
output.append("Read from DB: " + resultSet.getTimestamp("tick") + "\n")
28+
}
29+
30+
Ok(output.toString())
31+
}
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@()
2+
@main {
3+
scala
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@(content: Html)
2+
@content
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<nav class="navbar navbar-default navbar-static-top navbar-inverse">
2+
<div class="container">
3+
<ul class="nav navbar-nav">
4+
<li class="active">
5+
<a href="/"><span class="glyphicon glyphicon-home"></span> Home</a>
6+
</li>
7+
<li>
8+
<a href="https://devcenter.heroku.com/articles/how-heroku-works"><span class="glyphicon glyphicon-user"></span> How Heroku Works</a>
9+
</li>
10+
<li class="dropdown">
11+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-info-sign"></span> Getting Started Guides <span class="caret"></span></a>
12+
<ul class="dropdown-menu" role="menu">
13+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-ruby">Getting Started with Ruby on Heroku</a></li>
14+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs">Getting Started with Node on Heroku</a></li>
15+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-php">Getting Started with PHP on Heroku</a></li>
16+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-python">Getting Started with Python on Heroku</a></li>
17+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-scala">Getting Started with Java on Heroku</a></li>
18+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-go">Getting Started with Go on Heroku</a></li>
19+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-clojure">Getting Started with Clojure on Heroku</a></li>
20+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-scala">Getting Started with Scala on Heroku</a></li>
21+
<li class="divider"></li>
22+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-heroku-and-connect-without-local-dev">Getting Started on Heroku with Heroku Connect</a></li>
23+
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-jruby">Getting Started with Ruby on Heroku (Microsoft Windows)</a></li>
24+
</ul>
25+
</li>
26+
</ul>
27+
<ul class="nav navbar-nav navbar-right">
28+
<li class="navbar-right">
29+
<a href="https://devcenter.heroku.com"><span class="glyphicon glyphicon-book"></span> Heroku Dev Center</a>
30+
</li>
31+
</ul>
32+
</div>
33+
</nav>
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1-
import NativePackagerKeys._
1+
name := """scala-getting-started"""
2+
organization := "com.heroku"
23

3-
packageArchetype.java_application
4+
version := "1.0-SNAPSHOT"
45

5-
name := "hello"
6+
lazy val root = (project in file(".")).enablePlugins(PlayScala)
67

7-
version := "1.0"
8-
9-
scalaVersion := "2.10.4"
10-
11-
mainClass in Compile := Some("Web")
8+
scalaVersion := "2.13.10"
129

10+
libraryDependencies += guice
11+
libraryDependencies += jdbc
12+
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
1313
libraryDependencies ++= Seq(
14-
"com.twitter" % "finagle-http_2.10" % "6.18.0"
14+
"com.google.inject" % "guice" % "5.1.0",
15+
"com.google.inject.extensions" % "guice-assistedinject" % "5.1.0",
16+
"org.postgresql" % "postgresql" % "42.6.0"
1517
)
18+
19+
// Adds additional packages into Twirl
20+
//TwirlKeys.templateImports += "com.heroku.controllers._"
21+
22+
// Adds additional packages into conf/routes
23+
// play.sbt.routes.RoutesKeys.routesImport += "com.heroku.binders._"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import mill._
2+
import $ivy.`com.lihaoyi::mill-contrib-playlib:`, mill.playlib._
3+
4+
object scalagettingstarted extends PlayModule with SingleModule {
5+
6+
def scalaVersion = "2.13.10"
7+
def playVersion = "2.8.19"
8+
def twirlVersion = "1.5.1"
9+
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# https://www.playframework.com/documentation/latest/Configuration
2+
3+
# Allows all hosts to be valid hosts for requests to this app. This is necessary since this getting started guide
4+
# makes users deploy their own app of which we don't know the hostname in advance. For production apps, set this
5+
# to the correct host of your application.
6+
# More info: https://www.playframework.com/documentation/2.8.x/AllowedHostsFilter
7+
play.filters.hosts {
8+
allowed = ["."]
9+
}
10+
11+
# Sets the secret key if the APPLICATION_SECRET environment variable isn't set. It is recommended to set the
12+
# application secret for production apps via heroku config:set on the command line.
13+
# More info: https://www.playframework.com/documentation/2.8.x/ApplicationSecret
14+
play.http.secret.key = "YWRmNTNmZDYtMTE5NS00MTc1LWI4YmMtMGU3ZmY2NTE1NDI0Cg=="
15+
play.http.secret.key = ${?APPLICATION_SECRET}
16+
17+
# Default to "jdbc:postgresql://example.com:5432/database" so that the application at least starts up when
18+
# JDBC_DATABASE_URL is not set. We use this here to reduce friction when newcomers work with this getting started
19+
# application. Production applications should not have a default like this, especially not ones that have credentials
20+
# in them!
21+
db.default.url = "jdbc:postgresql://example.com:5432/database"
22+
db.default.url = ${?JDBC_DATABASE_URL}
23+
db.default.driver = org.postgresql.Driver

0 commit comments

Comments
 (0)