@@ -7,41 +7,63 @@ $[ D "compiler input files to generate the application." ]
77$[ let repoTag = "production" ]
88$[ let stdLibRepoName = "ec-std-lib" ]
99$[ let stdLibRepoTag = "v0.10.0" ]
10+ $[ let appFolderName = (#SetupDirectoryName:"BasicWebApp") ]
1011
1112$[* -------------- PROMPTS -------------- *]
12- $[ log ]$[/ log ]
13+ $[ log ]
14+
15+ ----------------------------------------------------------------------------------
16+ Configure your Microservice
17+ ----------------------------------------------------------------------------------
18+
19+ $[/ log ]
1320
1421$[* APPLICATION NAME *]
1522$[ let appName = (#appName:"MyApp") ]
1623$[ prompt appName: string ]Enter the name of the application [${appName}]: $[/ prompt ]
1724$[ if !(appName|is:identifier) ]
18- $[ log fatal ]The application name must start with a letter and only contain letters and numbers.$[/ log ]
25+ $[ log fatal ]The application name must start with a capital letter and only contain letters and numbers.$[/ log ]
1926$[/ if ]
2027$[ if appName|is:uncapitalized ]
2128 $[ let appName = appName|capitalize ]
2229 $[ log info ]Capitalizing application name: ${appName}$[/ log ]
2330$[/ if ]
2431
32+ $[ log ]$[/ log ]
33+
2534$[* API PREFIX NAMESPACE *]
26- $[ let urlPrefix = #urlPrefix ]
27- $[ prompt urlPrefix: string ]Enter optional URL prefix for the application (e.g., my/app) : $[/ prompt ]
35+ $[ let urlPrefix = ( #urlPrefix:"my/app") ]
36+ $[ prompt urlPrefix: string ]Enter optional URL prefix for the application [${urlPrefix}] : $[/ prompt ]
2837$[ if urlPrefix == null ]
2938 $[ let urlPrefix = "" ]
3039$[/ if ]
3140$[ if !(urlPrefix|is:path) ]
3241 $[ log fatal ]The URL prefix must be a valid URL path (letters, numbers, '-' and '/').$[/ log ]
3342$[/ if ]
3443
44+ $[ log ]$[/ log ]
45+
3546$[* APP BASE JAVA PACKAGE *]
36- $[ let appBasePackage = #appBasePackage ]
37- $[ prompt appBasePackage: string ]Enter the base Java package for all installed/generated source files: $[/ prompt ]
47+ $[ let appBasePackage = ( #appBasePackage:"com.example.service") ]
48+ $[ prompt appBasePackage: string ]Enter the base Java package for all installed/generated source files [${appBasePackage}] : $[/ prompt ]
3849$[ if appBasePackage == null || appBasePackage.length == 0 ]
3950 $[ log fatal ]You must specify at least one level of package.$[/ log ]
4051$[/ if ]
4152$[ if !(appBasePackage|is:namespace) ]
4253 $[ log fatal ]The specified package is not a valid Java package.$[/ log ]
4354$[/ if ]
4455
56+ $[ log ]$[/ log ]
57+
58+ $[* DATABASE NAME *]
59+ $[ let databaseName = (#databaseName:"postgres") ]
60+ $[ prompt databaseName: string ]Enter the name of the postgres database to use [${databaseName}]: $[/ prompt ]
61+ $[ if !(databaseName|is:identifier) ]
62+ $[ log fatal ]The database name must start with a letter and contain only letters and numbers.$[/ log ]
63+ $[/ if ]
64+
65+ $[ log ]$[/ log ]
66+
4567$[* ENTITY NAME *]
4668$[ let entityName = (#entityName:"Widget") ]
4769$[ prompt entityName: string ]Enter an entity name to get things started [${entityName}]: $[/ prompt ]
@@ -53,6 +75,8 @@ $[ if entityName|is:uncapitalized ]
5375 $[ log info ]Capitalizing entity name: ${entityName}$[/ log ]
5476$[/ if ]
5577
78+ $[ log ]$[/ log ]
79+
5680$[ let protobufOption = (#protobuf:"n") ]
5781$[ prompt protobufOption: boolean ]Would you like to include Protobuf support (y/n)? [${protobufOption}]: $[/ prompt ]
5882
@@ -61,6 +85,8 @@ $[ if protobufOption ]
6185 $[ do extraDomains.add("ProtobufDTO") ]
6286$[/ if ]
6387
88+ $[ log ]$[/ log ]
89+
6490$[* -------------- INSTALLS -------------- *]
6591
6692$[* Entities *]
@@ -77,4 +103,49 @@ $[ install "authors/PomAuthor.eml" "authors" ]
77103
78104$[* Base *]
79105$[ install "basicWebApp/Configuration.edl" "" ]
80- $[ install "basicWebApp/Space.edl" "" ]
106+ $[ install "basicWebApp/Space.edl" "" ]
107+
108+ $[log]
109+
110+ ----------------------------------------------------------------------------------
111+ Build and Bring up Microservice
112+ ----------------------------------------------------------------------------------
113+
114+ An Entity Compiler project has been created in a folder named "${appFolderName}". You will need to do the following:
115+
116+ 1) You need to have Postgres installed on your local machine.
117+
118+ 2) In Postgres, create a database named "${databaseName}" owned by username "postgres" with password "postgres".
119+ These are defaults, you can edit the projects "application.yaml" file to change these settings to be more secure.
120+
121+ 3) With a command line, go into the "${appFolderName}" directory and run the "runec.sh" script:
122+ % cd ${appFolderName}
123+ % ./runec.sh
124+ This will run the Entity Compiler to generate all the microservice files.
125+
126+ 4) You should now see a script called "build.sh", run this:
127+ % ./build.sh
128+ This will enscure that the source files for the microservice were generated properly. If you receive an error,
129+ go to the Github repository https://github.com/entityc/ec-springboot-lib and create an issue describing the
130+ error you received.
131+
132+ 5) Now you are ready to bring up the microservice. Run the "start.sh" script:
133+ % ./start.sh
134+ This will startup the microservice and setup the database. However, you do not yet have an initial admin user.
135+
136+ 6) Shutdown the microservice by hitting Ctrl-C.
137+
138+ 7) Run the "restore_admin_user.sh" script:
139+ % ./restore_admin_user.sh
140+ This will install an admin user directly into the database.
141+
142+ 8) Bring up the microservice again:
143+ % ./start.sh
144+
145+ $[let prefix = urlPrefix != "" ? urlPrefix + "/" : ""]
146+ 9) Open a web browser to http://localhost:8080/${prefix}auth/login
147+ You will need to login with:
148+ 149+ Password: admin
150+ This will bring you to the main admin page where you can see a button for your entity "${entityName}"
151+ $[/log]
0 commit comments