File: application-setup.2gg

package info (click to toggle)
golf 601.4.41-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,824 kB
  • sloc: ansic: 20,020; sh: 1,171; makefile: 292
file content (124 lines) | stat: -rw-r--r-- 2,377 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
.TH GOLF 2gg $VERSION $DATE Development Tools
.SH NAME
application-setup \- Golf documentation (running-application)
.SH DESCRIPTION

.LP
.B INITIALIZE APPLICATION
.LP

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: 

.RS 4
.EX

sudo mgrg -i -u $(whoami) <app name>

.EE
.RE


.LP
.B SETUP DATABASE(S)
.LP

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 \fBdatabase-config-file\fP 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:

.RS 4
.EX

run-query @mydb = ...

//or

begin-transaction @sales_db 

.EE
.RE

then you must have files "mydb" and "sales_db" present. For example, MariaDB config file might look like:

.RS 4
.EX

[client]
user=golfuser
password=pwd
database=golfdb
protocol=TCP
host=127.0.0.1
port=3306

.EE
.RE

or for PostgreSQL:

.RS 4
.EX

user=myuser password=mypwd dbname=mydb

.EE
.RE


.LP
.B MAKE APPLICATION
.LP

To compile and link the application that doesn't use database(s):

.RS 4
.EX

gg -q 

.EE
.RE

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:

.RS 4
.EX

gg -q --db="mariadb:mydb postgres:sales_db sqlite:contacts" 

.EE
.RE

See \fBgg\fP for more options.

.LP
.B START APPLICATION
.LP

Stop the application first in case it was running, then start the application - for example:

.RS 4
.EX

mgrg -m quit <app name>
mgrg -w 3 <app name>

.EE
.RE

See \fBmgrg\fP for more details.

.LP
.B RUNNING APPLICATION
.LP

You can run your application as \fBservice\fP, \fBCGI\fP or \fBcommand-line\fP.
.SH SEE ALSO
 Running application

\fBapplication-setup\fP  
\fBCGI\fP  
\fBcommand-line\fP  
\fBservice\fP   
See all 
\fBdocumentation\fP