Skip to content

Commit

Permalink
Merge pull request #1180 from gliderlabs/master
Browse files Browse the repository at this point in the history
Release 0.9.0
  • Loading branch information
josegonzalez committed Mar 31, 2024
2 parents c56b045 + 6c4388c commit 9a49a5c
Show file tree
Hide file tree
Showing 34 changed files with 421 additions and 57 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

## [0.9.0](https://github.com/gliderlabs/herokuish/compare/v0.8.0...v0.9.0) - 2024-03-31

- #1177 @dependabot: Update php to version v248
- #1178 @josegonzalez: chore: update dependencies in scala test app
- #1179 @josegonzalez: feat: use system bash to avoid extracting bash at runtime

## [0.8.0](https://github.com/gliderlabs/herokuish/compare/v0.7.6...v0.8.0) - 2024-03-28

- #1093 @dependabot: chore(deps): bump actions/download-artifact from 3 to 4
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ RUN /bin/herokuish buildpack install \
*/tmp
COPY include/default_user.bash /tmp/default_user.bash
RUN bash /tmp/default_user.bash && rm -f /tmp/default_user.bash
ENV BASH_BIN /usr/bin/bash
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ REPOSITORY = herokuish
DESCRIPTION = 'Herokuish uses Docker and Buildpacks to build applications like Heroku'
HARDWARE = $(shell uname -m)
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]')
VERSION ?= 0.8.0
VERSION ?= 0.9.0
IMAGE_NAME ?= $(NAME)
BUILD_TAG ?= dev
PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion buildpacks/buildpack-php/buildpack-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v247
v248
1 change: 1 addition & 0 deletions buildpacks/buildpack-scala/tests/scala/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ENERGY=20 GeV
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package controllers

import javax.inject._
import play.api.mvc._

import play.api.data._
import play.api.data.Forms._

case class $model;format="Camel"$Data(name: String, age: Int)

// NOTE: Add the following to conf/routes to enable compilation of this class:
/*
GET /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Get()
POST /$model;format="camel"$ controllers.$model;format="Camel"$Controller.$model;format="camel"$Post()
*/

/**
* $model;format="Camel"$ form controller for Play Scala
*/
class $model;format="Camel"$Controller @Inject()(mcc: MessagesControllerComponents) extends MessagesAbstractController(mcc) {

val $model;format="camel"$Form = Form(
mapping(
"name" -> text,
"age" -> number
)($model;format="Camel"$Data.apply)($model;format="Camel"$Data.unapply)
)

def $model;format="camel"$Get() = Action { implicit request: MessagesRequest[AnyContent] =>
Ok(views.html.$model;format="camel"$.form($model;format="camel"$Form))
}

def $model;format="camel"$Post() = Action { implicit request: MessagesRequest[AnyContent] =>
$model;format="camel"$Form.bindFromRequest().fold(
formWithErrors => {
// binding failure, you retrieve the form containing errors:
BadRequest(views.html.$model;format="camel"$.form(formWithErrors))
},
$model;format="camel"$Data => {
/* binding success, you get the actual value. */
/* flashing uses a short lived cookie */
Redirect(routes.$model;format="Camel"$Controller.$model;format="camel"$Get()).flashing("success" -> ("Successful " + $model;format="camel"$Data.toString))
}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@($model;format="camel"$Form: Form[$model;format="Camel"$Data])(implicit request: MessagesRequestHeader)

<h1>$model;format="camel"$ form</h1>

@request.flash.get("success").getOrElse("")

@helper.form(action = routes.$model;format="Camel"$Controller.$model;format="camel"$Post()) {
@helper.CSRF.formField
@helper.inputText($model;format="camel"$Form("name"))
@helper.inputText($model;format="camel"$Form("age"))
<input type="submit" value="submit"/>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
description = Generates a Controller with form handling
model = user
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package controllers

import play.api.mvc._
import play.api.i18n._
import org.scalatestplus.play._
import org.scalatestplus.play.guice.GuiceOneAppPerTest
import play.api.http.FileMimeTypes
import play.api.test._
import play.api.test.Helpers._
import play.api.test.CSRFTokenHelper._

import scala.concurrent.ExecutionContext

/**
* $model;format="Camel"$ form controller specs
*/
class $model;format="Camel"$ControllerSpec extends PlaySpec with GuiceOneAppPerTest with Injecting {

// Provide stubs for components based off Helpers.stubControllerComponents()
class StubComponents(cc:ControllerComponents = stubControllerComponents()) extends MessagesControllerComponents {
override val parsers: PlayBodyParsers = cc.parsers
override val messagesApi: MessagesApi = cc.messagesApi
override val langs: Langs = cc.langs
override val fileMimeTypes: FileMimeTypes = cc.fileMimeTypes
override val executionContext: ExecutionContext = cc.executionContext
override val actionBuilder: ActionBuilder[Request, AnyContent] = cc.actionBuilder
override val messagesActionBuilder: MessagesActionBuilder = new DefaultMessagesActionBuilderImpl(parsers.default, messagesApi)(executionContext)
}

"$model;format="Camel"$Controller GET" should {

"render the index page from a new instance of controller" in {
val controller = new $model;format="Camel"$Controller(new StubComponents())
val request = FakeRequest().withCSRFToken
val home = controller.$model;format="camel"$Get().apply(request)

status(home) mustBe OK
contentType(home) mustBe Some("text/html")
}

"render the index page from the application" in {
val controller = inject[$model;format="Camel"$Controller]
val request = FakeRequest().withCSRFToken
val home = controller.$model;format="camel"$Get().apply(request)

status(home) mustBe OK
contentType(home) mustBe Some("text/html")
}

"render the index page from the router" in {
val request = CSRFTokenHelper.addCSRFToken(FakeRequest(GET, "/$model;format="camel"$"))
val home = route(app, request).get

status(home) mustBe OK
contentType(home) mustBe Some("text/html")
}
}

"$model;format="Camel"$Controller POST" should {
"process form" in {
val request = {
FakeRequest(POST, "/$model;format="camel"$")
.withFormUrlEncodedBody("name" -> "play", "age" -> "4")
}
val home = route(app, request).get
status(home) mustBe SEE_OTHER
}
}
}
3 changes: 3 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Note: Delete this file if you are copying the code in this repository into your own project.

* @heroku/languages
9 changes: 9 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
logs
target
/.bsp
/.idea
/.idea_modules
/.classpath
/.project
/.settings
/RUNNING_PID
21 changes: 21 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2023 Salesforce, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion buildpacks/buildpack-scala/tests/scala/Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: target/universal/stage/bin/hello
web: target/universal/stage/bin/scala-getting-started -Dhttp.port=${PORT}
1 change: 1 addition & 0 deletions buildpacks/buildpack-scala/tests/scala/Procfile.windows
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: target\universal\stage\bin\scala-getting-started.bat -Dhttp.port=${PORT}
21 changes: 21 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Scala: Getting Started

A barebones Scala app, which can easily be deployed to Heroku.

## Deploying to Heroku

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.

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).

Eligible students can apply for platform credits through our new [Heroku for GitHub Students program](https://blog.heroku.com/github-student-developer-program).

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.

Alternatively, you can deploy it using this Heroku Button:

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

For more information about using Scala on Heroku, see these Dev Center articles:

- [Scala on Heroku](https://devcenter.heroku.com/categories/scala)
5 changes: 5 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Start on Heroku: Scala",
"description": "A barebones Scala app, which can easily be deployed to Heroku.",
"addons": ["heroku-postgresql"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package controllers

import javax.inject._
import play.api._
import play.api.db.Database
import play.api.mvc._

@Singleton
class Application @Inject()(val controllerComponents: ControllerComponents, val database: Database) extends BaseController {

def index(): Action[AnyContent] = Action { implicit request: Request[AnyContent] =>
Ok("scala")
}

def db(): Action[AnyContent] = Action { implicit request: Request[AnyContent] =>
// In this getting started app, we don't use a custom execution context to keep the code and configuration simple.
// For real-world apps, consult the Play documentation on how to configure custom contexts and how to use them:
// https://www.playframework.com/documentation/2.8.19/AccessingAnSQLDatabase#Using-a-CustomExecutionContext
database.withConnection { connection =>
val statement = connection.createStatement()
statement.executeUpdate("CREATE TABLE IF NOT EXISTS ticks (tick timestamp)")
statement.executeUpdate("INSERT INTO ticks VALUES (now())")

val output = new StringBuilder();
val resultSet = statement.executeQuery("SELECT tick FROM ticks")
while (resultSet.next()) {
output.append("Read from DB: " + resultSet.getTimestamp("tick") + "\n")
}

Ok(output.toString())
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@()
@main {
scala
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@(content: Html)
@content
33 changes: 33 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/app/views/nav.scala.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<nav class="navbar navbar-default navbar-static-top navbar-inverse">
<div class="container">
<ul class="nav navbar-nav">
<li class="active">
<a href="/"><span class="glyphicon glyphicon-home"></span> Home</a>
</li>
<li>
<a href="https://devcenter.heroku.com/articles/how-heroku-works"><span class="glyphicon glyphicon-user"></span> How Heroku Works</a>
</li>
<li class="dropdown">
<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>
<ul class="dropdown-menu" role="menu">
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-ruby">Getting Started with Ruby on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-nodejs">Getting Started with Node on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-php">Getting Started with PHP on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-python">Getting Started with Python on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-scala">Getting Started with Java on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-go">Getting Started with Go on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-clojure">Getting Started with Clojure on Heroku</a></li>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-scala">Getting Started with Scala on Heroku</a></li>
<li class="divider"></li>
<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>
<li><a href="https://devcenter.heroku.com/articles/getting-started-with-jruby">Getting Started with Ruby on Heroku (Microsoft Windows)</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="navbar-right">
<a href="https://devcenter.heroku.com"><span class="glyphicon glyphicon-book"></span> Heroku Dev Center</a>
</li>
</ul>
</div>
</nav>
26 changes: 17 additions & 9 deletions buildpacks/buildpack-scala/tests/scala/build.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import NativePackagerKeys._
name := """scala-getting-started"""
organization := "com.heroku"

packageArchetype.java_application
version := "1.0-SNAPSHOT"

name := "hello"
lazy val root = (project in file(".")).enablePlugins(PlayScala)

version := "1.0"

scalaVersion := "2.10.4"

mainClass in Compile := Some("Web")
scalaVersion := "2.13.10"

libraryDependencies += guice
libraryDependencies += jdbc
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
libraryDependencies ++= Seq(
"com.twitter" % "finagle-http_2.10" % "6.18.0"
"com.google.inject" % "guice" % "5.1.0",
"com.google.inject.extensions" % "guice-assistedinject" % "5.1.0",
"org.postgresql" % "postgresql" % "42.6.0"
)

// Adds additional packages into Twirl
//TwirlKeys.templateImports += "com.heroku.controllers._"

// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "com.heroku.binders._"
10 changes: 10 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/build.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import mill._
import $ivy.`com.lihaoyi::mill-contrib-playlib:`, mill.playlib._

object scalagettingstarted extends PlayModule with SingleModule {

def scalaVersion = "2.13.10"
def playVersion = "2.8.19"
def twirlVersion = "1.5.1"

}
23 changes: 23 additions & 0 deletions buildpacks/buildpack-scala/tests/scala/conf/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://www.playframework.com/documentation/latest/Configuration

# Allows all hosts to be valid hosts for requests to this app. This is necessary since this getting started guide
# makes users deploy their own app of which we don't know the hostname in advance. For production apps, set this
# to the correct host of your application.
# More info: https://www.playframework.com/documentation/2.8.x/AllowedHostsFilter
play.filters.hosts {
allowed = ["."]
}

# Sets the secret key if the APPLICATION_SECRET environment variable isn't set. It is recommended to set the
# application secret for production apps via heroku config:set on the command line.
# More info: https://www.playframework.com/documentation/2.8.x/ApplicationSecret
play.http.secret.key = "YWRmNTNmZDYtMTE5NS00MTc1LWI4YmMtMGU3ZmY2NTE1NDI0Cg=="
play.http.secret.key = ${?APPLICATION_SECRET}

# Default to "jdbc:postgresql://example.com:5432/database" so that the application at least starts up when
# JDBC_DATABASE_URL is not set. We use this here to reduce friction when newcomers work with this getting started
# application. Production applications should not have a default like this, especially not ones that have credentials
# in them!
db.default.url = "jdbc:postgresql://example.com:5432/database"
db.default.url = ${?JDBC_DATABASE_URL}
db.default.driver = org.postgresql.Driver
Loading

0 comments on commit 9a49a5c

Please sign in to comment.