summaryrefslogtreecommitdiff
path: root/README.md
blob: e463f3b9e1382a1280f096d6d130ea316a23ec43 (plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# x-anom 
(another MVC framework)



## pre-Check

Update ```~./container/config/composer-copy.json``` according to
```~./composer.json``` or vice-versa. You actualy need just one of them;
if pulling the project into a server (bare-metar/vps/shared etc) you only
need the first; if pulling into container you need the second/


On a Linux system you can also create a link from the one file to the other
(then you need to use ralative paths on autoload.classmap section).

When deploying on PRODUCTION make sure that all development routes are deleted
and debuging messages are disabled.




## Build

    docker build -t x-anom .

Force build without using cache:

    docker build --no-cache -t x-anom .




## Run

    docker-compose up

Force rebuild; then run:

    docker-compose up --build




## Remove builded containers

    docker-compose down




## While developing...

By default autoloading is handled by Composer (this is highly recommended).
While developing your application (or the framework itself) you will need to
update the autoloading of your new classes. To do so, attach a shell, change
to ```/var/www``` directory and run ```composer dump-autoload```

    cd /var/www

    composer dump-autoload

If Composer is not an option and you use the framework's autoload implementation
(enabling ```define('AUTOLOADER' , '../core/helpers/autoload.php');```),
do not forger to update the (new) paths to your new classes in the ```CLASSPATHS```
array . Both ```AUTOLOADER``` and ```CLASSPATHS``` definitions can be found
into ```core/confing/anom_settings.php``` file.




## XDebug

anom comes with most configuration of XDebug ready; all you need is

1. on Doockerfile: uncoomment the commands under XDebug section

2. on docker-compose.yml: uncomment the services.web.extra_hosts section

3. you may need configure your ide to listen onto XDebuger host port

example: 
for vscode you need to add a ~./.vscode/launch.json file like this:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Listen for Xdebug",
                "type": "php",
                "request": "launch",
                "port": 9003,
                "pathMappings": {
                    "/var/www/html": "${workspaceRoot}/html"
                }
            }
        ]
    }




## Customization

The project includes several almost-ready-to-use technologies;
You can enable / customize / disable / configure all these with a few edits.

Each time you change the configuration of your environment, do not forget to set the
related parameters on the main configuration file (```/core/config/anom_settings.php)```
and/or define environmental variables or credentials to the ```/core/auth/.env``` file.

NOTE: #1
We assume that you use composer; if not, then whatever composer does you have to
make it manually (copy dependency files and setup the autoloader's paths).

NOTE: #2
There is no need to use both Redis and Memcached, thus I have not test if these
two caching technologies will work together using the proposed comfiguration.



#### Redis

To enable Redis...

Onto docker-compose.yml:

1. Uncomment the lines of 'redis' section; Your Redis-server host name will be the one that is specified in the container_name field (default: redis)

2. Uncomment the networks subsections; web-server and Redis-server will communicate through a bridge network

3. With composer:

Include predis/redis into your project's requirements using ```/docker/config/composer-redis.json```
as your composer.json file -or- install it via:

    composer require predis/predis



#### Memcached

To host the Memcached service:

1. Onto docker-compose.yml: uncomment the lines of 'memcached' section; Memcached-server host name will be the one that is specified in the container_name field (default: anomemcached)

2. Onto Dockerfile: uncomment the lines under subsection 'Install Memcached'



* TODO: Maria database


* TODO: Adminer
(https://stackoverflow.com/questions/33631085/how-to-use-adminer-with-composer-autoload-php)


* TODO: phpMyAdmin


* Apache


* Opcache and JIT


TODO:

## Staging

#### Build

#### Deploy


## Production

### Build

### Deploy

! Run the above commands ONLY when you need to manually deploy the app to Cloud Run, otherwise everything is automated using Cloud Builds




## Notes

* '~./' refers to the root of the project

* Furhter documentation about the framework can be found in ~./core/README.md