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

/var/log/app_name permissions fixed #111

Merged
merged 1 commit into from
Dec 18, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ trait GenericPackageSettings

// Default place to install code.
defaultLinuxInstallLocation := "/usr/share",
defaultLinuxLogsLocation := "/var/log",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somebody fixing my TODOs. Thanks :)


// First we look at the src/linux files
linuxPackageMappings <++= (sourceDirectory in Linux) map { dir =>
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/com/typesafe/sbt/packager/Keys.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ object Keys extends linux.Keys
| APP_DEFINES - the defines to go into the app
| """.stripMargin)
val defaultLinuxInstallLocation = SettingKey[String]("defaultLinuxInstallLocation", "The location where we will install generic linux packages.")
val defaultLinuxLogsLocation = SettingKey[String]("defaultLinuxLogsLocation", "The location where application logs will be stored.")
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ object JavaServerAppPackaging {
s <- script.toSeq
} yield LinuxPackageMapping(Seq(s -> path)).withPerms(permissions)
},
// TODO the /var/log should be generalized like defaultLinuxInstallLocation
linuxPackageMappings in Debian <+= (normalizedName) map {
name => packageTemplateMapping("/var/log/" + name)()
// TODO should we specify daemonGroup in configs?
linuxPackageMappings in Debian <+= (normalizedName, defaultLinuxLogsLocation, target in Debian, daemonUser in Debian) map {
(name, logsDir, target, user) =>
// create empty var/log directory
val d = target / logsDir
d.mkdirs()
LinuxPackageMapping(Seq(d -> s"$logsDir/$name"), LinuxFileMetaData(user, user))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. This now makes sense to me.

Another question: IS this something we'd need for RPM packages too? I'd like to try to port your init.d stuff for RPM as well, if I can get a local CentOS machine running in time for testing before the next sbt-native-packager release.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about RPM. But I could check this tomorrow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does string interpolation work in this build? On my system the build is set to scala 2.9.x?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no. I forgot about 2.9. Excuse me, I'll fix

Regards, Alexey
On Dec 18, 2013 9:17 PM, "Muki" notifications@github.com wrote:

In
src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala:

@@ -62,9 +62,13 @@ object JavaServerAppPackaging {
s <- script.toSeq
} yield LinuxPackageMapping(Seq(s -> path)).withPerms(permissions)
},

  •  // TODO the /var/log should be generalized like defaultLinuxInstallLocation
    
  •  linuxPackageMappings in Debian <+= (normalizedName) map {
    
  •    name => packageTemplateMapping("/var/log/" + name)()
    
  •  // TODO should we specify daemonGroup in configs?
    
  •  linuxPackageMappings in Debian <+= (normalizedName, defaultLinuxLogsLocation, target in Debian, daemonUser in Debian) map {
    
  •    (name, logsDir, target, user) =>
    
  •      // create empty var/log directory
    
  •      val d = target / logsDir
    
  •      d.mkdirs()
    
  •      LinuxPackageMapping(Seq(d -> s"$logsDir/$name"), LinuxFileMetaData(user, user))
    

Does string interpolation work in this build? On my system the build is
set to scala 2.9.x?


Reply to this email directly or view it on GitHubhttps://github.com//pull/111/files#r8438638
.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DOH, good catch @muuki88. Still too many 0.12 users for us to mirate off of it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already fix this in #110 )

},
linuxPackageSymlinks in Debian <+= (normalizedName, defaultLinuxInstallLocation) map {
(name, install) => LinuxSymlink(install + "/" + name + "/logs", "/var/log/" + name)
Expand Down