Getting started with Starter Projects, and putting a site on the Net

Enonic version: 6.6.0
OS: Linux w/ Docker

Hi,

I’ve just ran into Enonic XP, and like it very much, thanks in part to the fact that I could get it up and running in no time thanks to the Docker container … anyway, after playing with it for a while, I tried to actually do something with it, and ran into a problem trying to set up the bootstrap starter project … I followed the docs, which state to just run the command

toolbox.sh init-project -n com.company.myapp -r starter-bootstrap3

which also seemed to have worked (at least I didn’t get any errors), but somehow I do not have any idea how to actually get to this starter project now … the GUI does not show any hint of it showing up … what am I missing here? I reckon it’s just something basic I didn’t understand yet …

Also, once I have a site set up, how do I actually get to it? I know my way around Apache et al, but somehow I seem to fail in finding the actual document that describes how to make a site provided by XP available to the internet … and that under a specific address, not a (somewhat long) path inside of the regular URL … e.g. if I have the project “onepager”, and I want it to show up under the url “http://www.mydomain.com” …

Thanks in advance!

Hi Garry!

In regards to learn more about building and deploying apps I recommend that you complete this tutorial: http://docs.enonic.com/en/stable/tutorials/my-first-app/index.html

To put an Enonic xp site online you should configure a vhost mapping: http://docs.enonic.com/en/stable/operations/configuration.html

Finally set up a standard reverse proxy in apache or similar to XP’s port 8080 (you should enable host forwarding too). This is apparently missing from our docs, thanks for ponting this out - we’ll get it fixed!

Hi Gary,

The following worked for me. In the XP vhost properties file $XP_HOME/config/com.enonic.xp.web.vhost.cfg

mapping.mysite.host = example.com
mapping.mysite.source = /
mapping.mysite.target = /portal/master/site-name
mapping.mysite.userStore = system

mapping.admin.host = example.com
mapping.admin.source = /admin
mapping.admin.target = /admin
mapping.admin.userStore = system

In the above configuration, replace “mysite” with whatever name you want to use. Replace the target “site-name” with the name of the site content in the XP Content Studio. This will cause requests to example.com/ to show the published content on your site. Requests to example.com/admin will go to the XP admin console. You don’t have to restart XP after making changes to this file.

Now to send port 80 requests to XP on port 8080: In the Apache sites-enabled/000-default.conf

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/
</VirtualHost>

Make sure to enable mod proxy and proxy_http. I’m not sure this is the best way to run things but it is working for me on an AWS server that I set up for testing. I’m not using Docker. I hope our hosting expert @esu can look this over and let us know if there is a better way. You need to restart Apache after making these changes.

By the way, the BootstrapStarter is for helping people set up the project files for making an app. If you used the line of code “toolbox.sh init-project -n com.company.myapp -r starter-bootstrap3” then you probably created the project files in the $XP_INATALL/toolbox folder which is not a good place to have your project files. Once you have your project files in a good location, run gradle build. Then log into the admin console http://localhost:8080/admin and open the applications tool. Then click the “Install” button and upload the project/build/libs/project-1.0.0.jar file. Then you can create a site content in the Content Studio and configure it to use the app you just uploaded.

Here is an article for a good way to set up multiple XP projects on a development machine. http://labs.enonic.com/articles/working-with-multiple-xp-projects

1 Like

Hi mla

I was wondering if you can help setting up my server on an AWS server.

I followed the steps you indicated above, but after mod proxy and proxy_http was enabled the apache started to return an 404 error.

virtualhost

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

ProxyPreserveHost On
ProxyRequests Off
ServerName www.xvy.com
ServerAlias xvy.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

vhost

enabled = true

mapping.a.host = xvy.com
mapping.a.source = /admin
mapping.a.target = /admin
mapping.a.userStore = system

mapping.b.host = xvy.com
mapping.b.source = /
mapping.b.target = /portal/master/x-v-y

Do you see anything wrong ? Am I missing something ?

Update- I was able to fix this. I wasn’t aware that I need to go through initial project setup for the Starter packs as well. As suggested above, following the “My First App” tutorial, I was able to get it working for vanilla starter.

@mla thanks for the tip on uploading the starter as Application. Following that I’m able to see the Application but when I do that I cant find it in the Application Dropdown of site area.

I tried various approach as follow:

  1. Build the jar file in local dev and uploded to remote hosted app.
  2. Changed the Dockerfile settings to grab the starter from the url instead looking locally
  3. Downloaded the enonic hosted Jar & uploaded directly as Application.

In all three cases I am unable to select the applicatiom PWA+Starter for a new site.

Any suggestions is much appreciated.

ps : first comment, Big thumbs up to enonic team for building top of the market product.

Starters are a special type of apps. They won’t show in the “Install application” dialog of the Applications module and they will not show up in the site config dropdown. The purpose of a starter is to help you kick off a new site or application, not extend functionality of an existing site.

I am providing my view as a new comer with 20hrs strike on record…

The concept of starters, as I read in documentation and also mentioned here is a bit unclear and misleading at first. the fact that there exist applications which seem to be improved versions of starters (i.e One Page Landing & Corporate) makes it difficult to separate the two in terms of UX. Also starters are uploaded though application panel & visible in there, so I assume it is natural for the user to treat them as one.

I think one solution could be to add a single site in a starter pack and treat it the same as One Page Landing etc… ,including a short description about the started in this sample site/application can help educate the users and get them onboard faster.

Neither OnePager nor Corporate are starters. They might be built based on starters but that doesn’t mean they are starters themselves. As a rule, a starter is just a shell, sometimes it includes a framework (Typescript, Bootstrap) or some plugins, but usually no visual content.

It’s true that the concept might not be well explained (or, actually, not explained at all), so we will try to improve that.

What are you looking for I guess is a sample app that has some content types, content, templates etc., so that you could apply it to an empty site to get some meaningful content? You can try looking at this: https://github.com/enonic/app-features, this is our showcase app which we try to keep current with the main functionality like input types with various configs, templates, sample libs etc.

1 Like

Hi Monsen and thanks for valuable input.

Essentially, any application or even library where the source code is available can be used as a starter for your project. As long as you like what it does of course :slight_smile:

The “toolbox init-project” script does the dirty work, and rips the “source” project and replaces repo and app settings with your new project values.

What we call starters in the market place https://market.enonic.com/starters are simply projects that are packaged and documented to be good starting points for building apps from scratch. We are working to bring more starters to developers, providing best practice and setup of XP projects. We are for instance looking at both eCommernce starters and a React starter these days.

So, to your suggestion: Are you proposing to include a more ready-to-run example in starters, or simply document how to use existing apps or libraries as starters?

Hi, I’m not quite sure exactly what your problem is here? You describe a not being able to select an app from the site if I understand you correctly?

  • An important detail: For an app to be selectable from a site, it must at least contain a site.xml file. Otherwise this app is not considered relevant for sites.
  • Also, if you have a starter (if it is an app starter) you will in many cases simply be able to build and install it, even without using the toolbox init-project script (which will convert it to an app of your own).

Remember an app can do a lot of other things than contribute to a site…

Hi @tsi

Thanks for pointers. Re. Problem:

  1. Not completing the “My First App” turorial first
  2. There is non! All good and I’m in love with enonic :smile:

My original issue rose from not getting myself familiar with some of the terminologies that is used in the platform. For instance, Application/App is referenced by multiple objects which share the same foundation but, as I understand it, have different limitations and use cases. Maybe adding a visual hint can make it easier for the user to distinguish. I noticed when I upload a starter and viewed it in the Application tab, there’s a blue badge above the app icon which only appears on starters. I see that as something helpful (if the intention was to mark the starter pack)

this video from enonic youtube channel was very helpful clarifying that.

Thanks alot again for following up on this.

3 Likes