org-apache-sling-app-cms - start.sh & stop.sh

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

org-apache-sling-app-cms - start.sh & stop.sh

Miroslav Beranič
Hi all,

I've followed documentation to build Sling CMS APP
at org-apache-sling-app-cms/docs/building.md, where it says:

To run the Sling CMS, build the code and copy the files
builder/src/main/scripts/start.sh builder/src/main/scripts/stop.sh and
builder/target/org.apache.sling.cms-{VERSION].jar to a directory. Execute
the script ./start.sh to start Sling CMS.

Well, when I do this, I get error:
$ /bin/sh
 /path/to/workspace/org-apache-sling-app-cms/target/distro/start.sh ( copy
of a builder/src/main/scripts/start.sh ).
ls: cannot access '*cms*.jar': No such file or directory
Application started on port 8080!

Well, I run this from inside InteliJ IDEA, and I guess it is more of a
missing feature on iDEA to set home/working directory, but eather way, if
start.sh and stop.sh would be changed in a way, to set/switch to working
directory like this:

( start.sh:23 )
script="$0"
basename="$(dirname $script)"
cd $basename

With added check if JAR file was found like this:

JARFILE=`ls *cms*.jar | head -1`
if [ -z "$JARFILE" ]; then
  echo "No JAR file found."
  exit
fi
mkdir -p sling/logs


Now it works as expected:

Application started on port 8080!

Also, variable APP_PORT is set, if not defined. I guess it would make sense
to pre-set APP_DEBUG_PORT if missing, as I guess this is almost-always used
for debug/testing purposes and not in production environment.

Other than this, Sling CMS app works out-of-the box. Very, very nice.
Cheers to the authors.

Master git branch from GitHub.

Kind Regards,
Miroslav


--
Miroslav Beranič
MIBESIS
[hidden email]
https://www.mibesis.si
Reply | Threaded
Open this post in threaded view
|

Re: org-apache-sling-app-cms - start.sh & stop.sh

Daniel Klco-2
Hi Miroslav,

Thanks for the feedback!

Good point with the working directory of the start script. I added a ticket
to capture the the enhancement:
https://issues.apache.org/jira/browse/SLING-8697

Regarding the debugging port, the idea of the start script is to run both
in development and production setups so I would think setting a debugging
script would be an optional parameter as it is currently rather than set by
default.

Thanks,
Dan


On Tue, Sep 10, 2019 at 1:03 PM Miroslav Beranič <
[hidden email]> wrote:

> Hi all,
>
> I've followed documentation to build Sling CMS APP
> at org-apache-sling-app-cms/docs/building.md, where it says:
>
> To run the Sling CMS, build the code and copy the files
> builder/src/main/scripts/start.sh builder/src/main/scripts/stop.sh and
> builder/target/org.apache.sling.cms-{VERSION].jar to a directory. Execute
> the script ./start.sh to start Sling CMS.
>
> Well, when I do this, I get error:
> $ /bin/sh
>  /path/to/workspace/org-apache-sling-app-cms/target/distro/start.sh ( copy
> of a builder/src/main/scripts/start.sh ).
> ls: cannot access '*cms*.jar': No such file or directory
> Application started on port 8080!
>
> Well, I run this from inside InteliJ IDEA, and I guess it is more of a
> missing feature on iDEA to set home/working directory, but eather way, if
> start.sh and stop.sh would be changed in a way, to set/switch to working
> directory like this:
>
> ( start.sh:23 )
> script="$0"
> basename="$(dirname $script)"
> cd $basename
>
> With added check if JAR file was found like this:
>
> JARFILE=`ls *cms*.jar | head -1`
> if [ -z "$JARFILE" ]; then
>   echo "No JAR file found."
>   exit
> fi
> mkdir -p sling/logs
>
>
> Now it works as expected:
>
> Application started on port 8080!
>
> Also, variable APP_PORT is set, if not defined. I guess it would make sense
> to pre-set APP_DEBUG_PORT if missing, as I guess this is almost-always used
> for debug/testing purposes and not in production environment.
>
> Other than this, Sling CMS app works out-of-the box. Very, very nice.
> Cheers to the authors.
>
> Master git branch from GitHub.
>
> Kind Regards,
> Miroslav
>
>
> --
> Miroslav Beranič
> MIBESIS
> [hidden email]
> https://www.mibesis.si
>