Add possibility run play-cms-demo without Docker

parent 94d3900b
-Dsbt.global.base=project/.sbtboot
-Dsbt.boot.directory=project/.boot
-Dsbt.ivy.home=project/.ivy
-Dplaycms.version=local
#-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
-Denvironment=docker
-Dconfig.resource=docker.conf
#-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9999
-J-Xms256m
-J-Xmx2g
-J-XX:MaxMetaspaceSize=512m
# Please uncomment next line if you want want to develop the play-cms modules
# -Dplaycms.version=local
......@@ -12,7 +12,7 @@ Check out the [play-cms](http://www.play-cms.com) website for more information a
## Quick start
Either do a local installation (if you have the play framework installed) using H2 by default, or run it in Docker which
Either do a local installation (if you have the sbt installed) using H2 by default, or run it with Docker which
uses MySQL database by default.
### Local installation ###
......@@ -41,38 +41,40 @@ starting new projects.
### Use the development environment ###
- Make sure you have `docker` and `docker-compose` installed
- The `services.sh` is a helper script which initializes required environment variables and forwards a passed command to
either `docker-compose` or `sbt` commands:
- `services.sh [docker-compose arguments...]` - run full docker stack
- `services.sh sbt [sbt arguments...]` - run `sbt` command along with all docker containers except `app` container
- The bound tcp ports at `services.yml` and `sbt.yml` are configurable via environment variables which may be overridden
in `./devops/.env` file
- Make sure you have `docker` and `sbt` installed
- SBT options can be specified in `./.sbtopts` file, but it must be noted that a line feed is required at file end
because otherwise the last option will be ignored by sbt
- To enable based on docker environment execute the following command in your project root folder:
-cp .sbtopts-example .sbtopts
To quick start the project with this setup, run
cp devops/.env-example devops/.env
devops/services.sh sbt
and then navigate to [http://localhost/](). Please be aware that on computers using `docker-machine`, you'll have to
change `localhost` with the IP of your Docker machine, in the browser as well as the `.env` file.
sbt run
The application will be running on [http://localhost:9000/]().
The environment features these dockerized applications:
- MySQL with PHPMyAdmin under [http://localhost/~pma/]()
- Mailhog SMTP server and mail viewer under [http://localhost/~mail/]()
- MySQL on port 3306, database: db_play-cms-demo, user: play-cms-demo, password: s3cr3t
- Mailhog SMTP server and mail viewer under [http://localhost:8025/]()
- Filemanager under [http://localhost:8035/]()
As with the setup not using docker, you will have to call the `/reset` route after starting the application for the
first time.
Sometimes(depends from your OS system settings: umask) you will need add permissions in ./data folder (where all docker volumes mapped)
### Developing the play modules ##
If you want to develop the play-cms modules, execute the following commands in your project root folder:
If you want to develop the play-cms modules, uncomment next line in `./.sbtopts` file:
```
cp .sbtopts-example .sbtopts
-Dplaycms.version=local
```
Then execute the following commands in your project root folder:
```
mkdir modules
cd modules
git clone ssh://git@sshgit.insign.rocks:10022/open-source/play-cms/play-cms.git
......
......@@ -59,8 +59,9 @@ lazy val server = (project in file("server"))
// -J params will be added as jvm parameters
"-J-Xmx2g",
"-J-Xms256m"
),
)
)
.settings(if (Settings.withDocker) Seq(
devSettings := {
val envVars = Map(
"APPLICATION_HOST" -> "localhost",
......@@ -83,7 +84,6 @@ lazy val server = (project in file("server"))
}
envVars.toSeq
},
dockerContainers := Seq(
/*DockerContainer(
id = "elasticsearch",
......@@ -147,7 +147,20 @@ lazy val server = (project in file("server"))
)
)
)
)
) else Seq(
devSettings := {
val envVars = Map(
"APPLICATION_HOST" -> "localhost",
"MYSQL_DATABASE" -> "db_play-cms-demo",
"MYSQL_USER" -> "play-cms-demo",
"MYSQL_PASSWORD" -> "s3cr3t"
)
envVars.foreach { case (k, v) =>
java.lang.System.setProperty(k, v)
}
envVars.toSeq
}
))
.enablePlugins(PlayJava, SbtWeb, DockerPlugin, DockerRun)
.dependsOn(sharedJvm)
.devModules(
......
......@@ -97,6 +97,9 @@ object Settings {
val playCmsVersion: String = devmodVersion("playcms.version", versions.playCms)
val playCmsLocal: Boolean = devmodIsLocal("playcms.version")
/** Environment: dockerized or simple*/
val withDocker: Boolean = isRunWithDocker("environment")
/** Dependencies only used by the JS project (note the use of %%% instead of %%) */
val scalajsDependencies = Def.setting(Seq(
"org.scala-js" %%% "scalajs-dom" % versions.scalajsDom,
......@@ -133,4 +136,8 @@ object Settings {
sys.props.get(prop).filter(_ != "local").getOrElse(default)
}
private def isRunWithDocker(prop: String): Boolean = {
sys.props.get(prop).exists(_ == "docker")
}
}
......@@ -36,8 +36,8 @@ application.cdn = ""
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
db.default {
driver = com.mysql.jdbc.Driver
url = "jdbc:mysql://"${MYSQL_HOST}":"${MYSQL_PORT}"/"${MYSQL_DATABASE}"?autoReconnect=true&sessionVariables=default_storage_engine=MyISAM,sql_mode=ANSI_QUOTES"
driver = org.h2.Driver
url = "jdbc:h2:mem:play-cms;MODE=MySQL"
username = ${?MYSQL_USER}
password = ${?MYSQL_PASSWORD}
jndiName = "DefaultDS"
......@@ -108,8 +108,8 @@ cms {
wwwroot = /uploads
}
filemanager.enable = true
filemanager.urlPrefix = ${FILEMANAGER_BASE_URL}
filemanager.enable = false
filemanager.urlPrefix = ""
enableResetRoute = true
......
include "application.conf"
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
db.default {
driver = com.mysql.jdbc.Driver
url = "jdbc:mysql://"${MYSQL_HOST}":"${MYSQL_PORT}"/"${MYSQL_DATABASE}"?autoReconnect=true&sessionVariables=default_storage_engine=MyISAM,sql_mode=ANSI_QUOTES"
username = ${?MYSQL_USER}
password = ${?MYSQL_PASSWORD}
jndiName = "DefaultDS"
# You can turn on SQL logging for any datasource
# https://www.playframework.com/documentation/latest/Highlights25#Logging-SQL-statements
#default.logSql=true
}
cms {
filemanager.enable = true
filemanager.urlPrefix = ${FILEMANAGER_BASE_URL}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment