Skip to content

Commit b937537

Browse files
committed
Merge #243 Devcontainer on arm, cleaned network, MC specific setups
2 parents 4998f0b + cd583c1 commit b937537

9 files changed

+122
-17
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ RUN apt-get -y install \
5757
apt-transport-https \
5858
ca-certificates \
5959
curl \
60+
jq \
6061
gnupg-agent \
6162
software-properties-common && \
6263
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
6364
add-apt-repository \
64-
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
65+
"deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu \
6566
$(lsb_release -cs) \
6667
stable" && \
6768
apt-get update -y && \

.devcontainer/apps.config.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
$CONFIG = array (
3+
'apps_paths' => array (
4+
0 => array (
5+
'path' => OC::$SERVERROOT.'/customapps',
6+
'url' => '/customapps',
7+
'writable' => true,
8+
),
9+
1 => array (
10+
'path' => OC::$SERVERROOT.'/apps',
11+
'url' => '/apps',
12+
'writable' => true,
13+
),
14+
),
15+
);

.devcontainer/codespace.config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'mail_smtpmode' => 'smtp',
99
'mail_sendmailmode' => 'smtp',
1010
'mail_domain' => 'example.com',
11-
'mail_smtphost' => 'localhost',
11+
'mail_smtphost' => 'mailhog',
1212
'mail_smtpport' => '1025',
1313
'memcache.local' => '\OC\Memcache\APCu',
1414
];

.devcontainer/docker-compose.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,48 @@ services:
66
- .:/workspace:cached
77
- /var/run/docker.sock:/var/run/docker-host.sock
88
- ..:/var/www/html
9+
- ../../customapps:/var/www/html/customapps
10+
- ../../data:/var/www/html/data
11+
- ../../config:/var/www/html/config
912
command: /var/www/html/.devcontainer/entrypoint.sh
1013
ports:
1114
- 80:80
12-
- 8080:8080
13-
- 8025:8025
14-
15+
depends_on:
16+
db:
17+
condition: service_healthy
18+
mailhog:
19+
condition: service_started
20+
1521
db:
1622
image: postgres
1723
restart: always
1824
environment:
1925
POSTGRES_PASSWORD: postgres
2026
PGDATA: /data/postgres
2127
volumes:
22-
- db:/data/postgres
23-
network_mode: service:nextclouddev
24-
28+
- ../../data/db:/data/postgres
29+
expose:
30+
- "5432"
31+
healthcheck:
32+
test: ["CMD-SHELL", "pg_isready"]
33+
interval: 10s
34+
timeout: 5s
35+
retries: 10
36+
37+
2538
adminer:
2639
image: adminer
2740
restart: always
28-
network_mode: service:nextclouddev
41+
ports:
42+
- 8080:8080
43+
depends_on:
44+
db:
45+
condition: service_healthy
2946

3047
mailhog:
3148
image: mailhog/mailhog
3249
restart: always
33-
network_mode: service:nextclouddev
50+
ports:
51+
- 8025:8025
52+
3453

35-
volumes:
36-
db:

.devcontainer/lock.config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
$CONFIG = array (
3+
'config_is_read_only' => true,
4+
);

.devcontainer/nmc.config.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
$CONFIG = array (
3+
'htaccess.RewriteBase' => '/',
4+
'default_language' => 'de_DE',
5+
'integrity.check.disabled' => true, // not recommended for prod, but for customisation
6+
'auth.authtoken.v1.disabled' => true,
7+
'sharing.force_share_accept' => true,
8+
'status-email-message-provider' => '\\OCA\\EmailTemplateExample\\MessageProvider',
9+
'mail_template_class' => 'OCA\\EmailTemplateExample\\EMailTemplate',
10+
// "logfile_office_report" => "/var/log/nextcloud/office.log",
11+
);

.devcontainer/nmcsetup.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )"
3+
4+
cd $DIR/
5+
6+
# after installation, do some MagentaCLOUD specific setups to start closer to production
7+
8+
# customapps directory split
9+
cp .devcontainer/apps.config.php config/apps.config.php
10+
cp .devcontainer/nmc.config.php config/nmc.config.php
11+
12+
# disable user themeing
13+
sudo -u ${APACHE_RUN_USER} php occ theming:config disable-user-theming yes
14+
15+
# fixed themeing for MagentaCLOUD
16+
cp .devcontainer/theme.config.php config/theme.config.php
17+
18+
# refresh .htaccess for short URL notation
19+
sudo -u ${APACHE_RUN_USER} php occ maintenance:update:htaccess
20+
21+
# "Organisational" setting
22+
sudo -u ${APACHE_RUN_USER} php occ theming:config color "#e20074" # don't use uppercase letters!
23+
sudo -u ${APACHE_RUN_USER} php occ theming:config name MagentaCLOUD
24+
sudo -u ${APACHE_RUN_USER} php occ theming:config slogan "Alle Dateien sicher an einem Ort"
25+
sudo -u ${APACHE_RUN_USER} php occ theming:config imprintUrl "http://www.telekom.de/impressum"
26+
sudo -u ${APACHE_RUN_USER} php occ theming:config privacyUrl "https://static.magentacloud.de/Datenschutz"
27+
28+
# app settings
29+
sudo -u ${APACHE_RUN_USER} php occ config:app:set theming AndroidClientUrl --value \
30+
"https://play.google.com/store/apps/details?=com.t_systems.android.webdav"
31+
sudo -u ${APACHE_RUN_USER} php occ config:app:set theming iTunesAppId --value "312838242"
32+
sudo -u ${APACHE_RUN_USER} php occ config:app:set theming iOSClientUrl --value \
33+
"https://apps.apple.com/us/app/magentacloud-cloud-speicher/id312838242"
34+
35+
# enable/disable apps
36+
sudo -u ${APACHE_RUN_USER} php occ app:enable nmctheme
37+
sudo -u ${APACHE_RUN_USER} php occ app:disable dashboard # may remove as soon as dashboard CR is implemented
38+
39+
# there are side effects when using devcontainer and
40+
# doing the main settings via webapp. For the moment, the best
41+
# workaround is to lock config and avoid overwrite by nextcloud
42+
# esp. on container rebuild
43+
cp .devcontainer/lock.config.php config/lock.config.php

.devcontainer/setup.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,37 @@
22
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )"
33

44
cd $DIR/
5-
65
git submodule update --init
76

8-
# Codespace config
9-
cp .devcontainer/codespace.config.php config/codespace.config.php
10-
117
# VSCode debugger profile
128
mkdir -p .vscode && cp .devcontainer/launch.json .vscode/launch.json
139

1410
# Onetime installation setup
1511
if [[ ! $(sudo -u ${APACHE_RUN_USER} php occ status) =~ installed:[[:space:]]*true ]]; then
1612
echo "Running NC installation"
13+
14+
# we could be faced with an externalized, empty config dir
15+
touch config/CAN_INSTALL
16+
17+
# this produces the plain config file without any overwriting
1718
sudo -u ${APACHE_RUN_USER} php occ maintenance:install \
1819
--verbose \
1920
--database=pgsql \
2021
--database-name=postgres \
21-
--database-host=127.0.0.1 \
22+
--database-host=db \
2223
--database-port=5432 \
2324
--database-user=postgres \
2425
--database-pass=postgres \
2526
--admin-user admin \
2627
--admin-pass admin
2728
fi
2829

30+
# Codespace config; do it late to avoid duplication into config.php
31+
# (which removed the conditional code!)
32+
# may consider setting 'config_is_read_only' => true,
33+
cp .devcontainer/codespace.config.php config/codespace.config.php
34+
35+
# add MagentaCLOUD convenience setup
36+
source .devcontainer/nmcsetup.sh
37+
2938
sudo service apache2 restart

.devcontainer/theme.config.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
$CONFIG = array (
3+
'enforce_theme' => 'default', // or any other theme contained in the app
4+
'theme' => '', // disable old themeing
5+
);

0 commit comments

Comments
 (0)