@@ -173,14 +173,25 @@ export async function startNextcloud(branch = 'master', mountApp: boolean|string
173
173
const container = await docker . createContainer ( {
174
174
Image : SERVER_IMAGE ,
175
175
name : getContainerName ( ) ,
176
- Env : [ `BRANCH=${ branch } ` ] ,
176
+ Env : [ `BRANCH=${ branch } ` , 'APCU=1' ] ,
177
177
HostConfig : {
178
178
Binds : mounts . length > 0 ? mounts : undefined ,
179
179
PortBindings,
180
+ // Mount data directory in RAM for faster IO
181
+ Mounts : [ {
182
+ Target : '/var/www/html/data' ,
183
+ Source : '' ,
184
+ Type : 'tmpfs' ,
185
+ ReadOnly : false ,
186
+ } ] ,
180
187
} ,
181
188
} )
182
189
await container . start ( )
183
190
191
+ // Set proper permissions for the data folder
192
+ await runExec ( container , [ 'chown' , '-R' , 'www-data:www-data' , '/var/www/html/data' ] , false , 'root' )
193
+ await runExec ( container , [ 'chmod' , '0770' , '/var/www/html/data' ] , false , 'root' )
194
+
184
195
// Get container's IP
185
196
const ip = await getContainerIP ( container )
186
197
console . log ( `├─ Nextcloud container's IP is ${ ip } 🌏` )
@@ -217,6 +228,19 @@ export const configureNextcloud = async function(apps = ['viewer'], vendoredBran
217
228
await runExec ( container , [ 'php' , 'occ' , 'config:system:set' , 'force_locale' , '--value' , 'en_US' ] , true )
218
229
await runExec ( container , [ 'php' , 'occ' , 'config:system:set' , 'enforce_theme' , '--value' , 'light' ] , true )
219
230
231
+ // Checking apcu
232
+ console . log ( '├─ Checking APCu configuration... 👀' )
233
+ const distributed = await runExec ( container , [ 'php' , 'occ' , 'config:system:get' , 'memcache.distributed' ] )
234
+ const local = await runExec ( container , [ 'php' , 'occ' , 'config:system:get' , 'memcache.local' ] )
235
+ const hashing = await runExec ( container , [ 'php' , 'occ' , 'config:system:get' , 'hashing_default_password' ] )
236
+ if ( ! distributed . includes ( 'Memcache\\APCu' )
237
+ || ! local . includes ( 'Memcache\\APCu' )
238
+ || ! hashing . includes ( 'true' ) ) {
239
+ console . log ( '└─ APCu is not properly configured 🛑' )
240
+ throw new Error ( 'APCu is not properly configured' )
241
+ }
242
+ console . log ( '│ └─ OK !' )
243
+
220
244
// Build app list
221
245
const json = await runExec ( container , [ 'php' , 'occ' , 'app:list' , '--output' , 'json' ] , false )
222
246
// fix dockerode bug returning invalid leading characters
0 commit comments