application-setup - Golf documentation (running-application)
Contents
Description
INITIALIZEAPPLICATION
A Golf application must be initialized first. This means creating a directory structure owned by
application owner, which can be any Operating System user. To initialize application <app name> while
logged-in as application owner:
sudo mgrg -i -u $(whoami) <app name>
SETUPDATABASE(S)
If your application does not use database(s), you can skip this part.
You can setup your database(s) in any way you see fit, and this includes creating the database objects
(such as tables or indexes) used by your application; all Golf needs to know is the connection
parameters, which include database login information (but can include other things as well). For each
database in use, you must provide a database-config-file in the same directory as your Golf source code.
This file contains the database connection parameters - these parameters are database-specific. For
example, if your code has statements like:
run-query @mydb = ...
//or
begin-transaction @sales_db
then you must have files "mydb" and "sales_db" present. For example, MariaDB config file might look like:
[client]
user=golfuser
password=pwd
database=golfdb
protocol=TCP
host=127.0.0.1
port=3306
or for PostgreSQL:
user=myuser password=mypwd dbname=mydb
MAKEAPPLICATION
To compile and link the application that doesn't use database(s):
gg -q
When you have database(s) in use, for instance assuming in above example that "mydb" is MariaDB database,
"sales_db" is PostgreSQL, and "contacts" is SQLite database:
gg -q --db="mariadb:mydb postgres:sales_db sqlite:contacts"
See gg for more options.
STARTAPPLICATION
Stop the application first in case it was running, then start the application - for example:
mgrg -m quit <app name>
mgrg -w 3 <app name>
See mgrg for more details.
RUNNINGAPPLICATION
You can run your application as service, CGI or command-line.
Name
application-setup - Golf documentation (running-application)
See Also
Running application
application-setupCGIcommand-lineservice See all documentation
$DATE $VERSION GOLF(2gg)
