Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set correct ownership on an RPM installation #709

Closed
umatrangolo opened this issue Dec 3, 2015 · 2 comments
Closed

Unable to set correct ownership on an RPM installation #709

umatrangolo opened this issue Dec 3, 2015 · 2 comments
Labels

Comments

@umatrangolo
Copy link
Contributor

Hi,

I'm trying to correctly deploy a toy Play 2.4 app RPM packaged and I'm having problems in setting the correct ownership for all the files/folders installed.

The build.sbt is:

import gilt.sbt.resolvers.GiltRepos
import com.typesafe.sbt.packager.SettingsHelper._

name := """play-rpm"""
version := "0.0.1"

lazy val root = (project in file("."))
  .enablePlugins(PlayScala, RpmPlugin, RpmDeployPlugin)

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test
)

// publish configuration for Nexus
publishTo := Some(GiltRepos.Resolvers.head)
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
publishMavenStyle := false

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator

// RPM generation
maintainer in Linux := "Ugo Matrangolo <umatrangolo@gilt.com>"
packageSummary in Linux := "Play-Rpm"
packageDescription := "Simple Play svc that uses RPM"
rpmRelease := "1"
rpmVendor := "Ugo Matrangolo"
rpmUrl := Some("http://umatrangolo.com")
rpmLicense := Some("Apache v2")
rpmGroup := Some("TEST")
rpmBrpJavaRepackJars := true
rpmPrefix := Some("/opt")

javaOptions in Universal ++= Seq(
  // -J params will be added as jvm parameters
  "-J-Xmx2048m",
  "-J-Xms2048m",

  // others will be added as app parameters
  "-Dpidfile.path=/var/run/play-rpm/play.pid"
)

With the above I do a simple sbt rpm:packageBin that gets installed on an EC2 instance producing the following layout:

/usr/share/play-rpm/
├── [drwxr-xr-x root    ]  bin
├── [drwxr-xr-x root    ]  conf
├── [drwxr-xr-x root    ]  lib
├── [lrwxrwxrwx root    ]  logs -> /var/log/play-rpm
└── [drwxr-xr-x root    ]  share
    └── [drwxr-xr-x root    ]  doc
        └── [drwxr-xr-x root    ]  api
            ├── [drwxr-xr-x root    ]  controllers
            │   └── [drwxr-xr-x root    ]  javascript
            ├── [drwxr-xr-x root    ]  index
            ├── [drwxr-xr-x root    ]  lib
            ├── [drwxr-xr-x root    ]  router
            └── [drwxr-xr-x root    ]  views
                └── [drwxr-xr-x root    ]  html

and

/var/run/
├── [drwxr-xr-x newrelic]  newrelic
├── [drwxr-xr-x play-rpm]  play-rpm

and

/var/log
└── [drwxr-xr-x play-rpm]  play-rpm

Please note that while all the files/folders in the var folder have correct ownership (play-rpm) all the rest is owned by root.

Is this a correct layout ? I was expecting that everything should be owned by the play-rpmuser but I might be wrong.

Please, advice.

@muuki88 muuki88 added the rpm label Dec 3, 2015
@muuki88
Copy link
Contributor

muuki88 commented Dec 3, 2015

This is the correct layout. Files in /usr/share are owned by root as they should remain unchanged. If your application needs access to the filesystem, this must be granted explicitly (like /var/run/<app>). All other files are readable (and in bin also executable) by everyone.

@muuki88 muuki88 closed this as completed Dec 3, 2015
@umatrangolo
Copy link
Contributor Author

Thank you for clearing out this for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants