Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make .devcontainer independent of processor architecture #39464

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ RUN apt-get -y install \
apt-transport-https \
ca-certificates \
curl \
jq \
gnupg-agent \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
"deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable" && \
apt-get update -y && \
Expand Down
15 changes: 15 additions & 0 deletions .devcontainer/apps.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
$CONFIG = array (
'apps_paths' => array (
0 => array (
'path' => OC::$SERVERROOT.'/customapps',
'url' => '/customapps',
'writable' => true,
),
1 => array (
'path' => OC::$SERVERROOT.'/apps',
'url' => '/apps',
'writable' => true,
),
),
);
2 changes: 1 addition & 1 deletion .devcontainer/codespace.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_domain' => 'example.com',
'mail_smtphost' => 'localhost',
'mail_smtphost' => 'mailhog',
'mail_smtpport' => '1025',
'memcache.local' => '\OC\Memcache\APCu',
];
Expand Down
37 changes: 27 additions & 10 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,48 @@ services:
- .:/workspace:cached
- /var/run/docker.sock:/var/run/docker-host.sock
- ..:/var/www/html
- ../../customapps:/var/www/html/customapps
- ../../data:/var/www/html/data
- ../../config:/var/www/html/config
command: /var/www/html/.devcontainer/entrypoint.sh
ports:
- 80:80
- 8080:8080
- 8025:8025

depends_on:
db:
condition: service_healthy
mailhog:
condition: service_started

db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: postgres
PGDATA: /data/postgres
volumes:
- db:/data/postgres
network_mode: service:nextclouddev

- ../../data/db:/data/postgres
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 10


adminer:
image: adminer
restart: always
network_mode: service:nextclouddev
ports:
- 8080:8080
depends_on:
db:
condition: service_healthy

mailhog:
image: mailhog/mailhog
restart: always
network_mode: service:nextclouddev
ports:
- 8025:8025


volumes:
db:
4 changes: 4 additions & 0 deletions .devcontainer/lock.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
$CONFIG = array (
'config_is_read_only' => true,
);
11 changes: 11 additions & 0 deletions .devcontainer/nmc.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'default_language' => 'de_DE',
'integrity.check.disabled' => true, // not recommended for prod, but for customisation
'auth.authtoken.v1.disabled' => true,
'sharing.force_share_accept' => true,
'status-email-message-provider' => '\\OCA\\EmailTemplateExample\\MessageProvider',
'mail_template_class' => 'OCA\\EmailTemplateExample\\EMailTemplate',
// "logfile_office_report" => "/var/log/nextcloud/office.log",
);
43 changes: 43 additions & 0 deletions .devcontainer/nmcsetup.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR appears to include a bunch of unrelated changes. Was that intentional?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say keep them as an example for custom setup, like separated here, which can be adapted by others

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tsdicloud feel free to remove the nmc specific files of course, since I would expect you wouldn't want them in the Nextcloud repo instead of just the nmc one

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )"

cd $DIR/

# after installation, do some MagentaCLOUD specific setups to start closer to production

# customapps directory split
cp .devcontainer/apps.config.php config/apps.config.php
cp .devcontainer/nmc.config.php config/nmc.config.php

# disable user themeing
sudo -u ${APACHE_RUN_USER} php occ theming:config disable-user-theming yes

# fixed themeing for MagentaCLOUD
cp .devcontainer/theme.config.php config/theme.config.php

# refresh .htaccess for short URL notation
sudo -u ${APACHE_RUN_USER} php occ maintenance:update:htaccess

# "Organisational" setting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look perhaps to be personal settings that I don't think belong in the PR

sudo -u ${APACHE_RUN_USER} php occ theming:config color "#e20074" # don't use uppercase letters!
sudo -u ${APACHE_RUN_USER} php occ theming:config name MagentaCLOUD
sudo -u ${APACHE_RUN_USER} php occ theming:config slogan "Alle Dateien sicher an einem Ort"
sudo -u ${APACHE_RUN_USER} php occ theming:config imprintUrl "http://www.telekom.de/impressum"
sudo -u ${APACHE_RUN_USER} php occ theming:config privacyUrl "https://static.magentacloud.de/Datenschutz"

# app settings
sudo -u ${APACHE_RUN_USER} php occ config:app:set theming AndroidClientUrl --value \
"https://play.google.com/store/apps/details?=com.t_systems.android.webdav"
sudo -u ${APACHE_RUN_USER} php occ config:app:set theming iTunesAppId --value "312838242"
sudo -u ${APACHE_RUN_USER} php occ config:app:set theming iOSClientUrl --value \
"https://apps.apple.com/us/app/magentacloud-cloud-speicher/id312838242"

# enable/disable apps
sudo -u ${APACHE_RUN_USER} php occ app:enable nmctheme
sudo -u ${APACHE_RUN_USER} php occ app:disable dashboard # may remove as soon as dashboard CR is implemented

# there are side effects when using devcontainer and
# doing the main settings via webapp. For the moment, the best
# workaround is to lock config and avoid overwrite by nextcloud
# esp. on container rebuild
cp .devcontainer/lock.config.php config/lock.config.php
19 changes: 14 additions & 5 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,37 @@
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )"

cd $DIR/

git submodule update --init

# Codespace config
cp .devcontainer/codespace.config.php config/codespace.config.php

# VSCode debugger profile
mkdir -p .vscode && cp .devcontainer/launch.json .vscode/launch.json

# Onetime installation setup
if [[ ! $(sudo -u ${APACHE_RUN_USER} php occ status) =~ installed:[[:space:]]*true ]]; then
echo "Running NC installation"

# we could be faced with an externalized, empty config dir
touch config/CAN_INSTALL

# this produces the plain config file without any overwriting
sudo -u ${APACHE_RUN_USER} php occ maintenance:install \
--verbose \
--database=pgsql \
--database-name=postgres \
--database-host=127.0.0.1 \
--database-host=db \
--database-port=5432 \
--database-user=postgres \
--database-pass=postgres \
--admin-user admin \
--admin-pass admin
fi

# Codespace config; do it late to avoid duplication into config.php
# (which removed the conditional code!)
# may consider setting 'config_is_read_only' => true,
cp .devcontainer/codespace.config.php config/codespace.config.php

# add MagentaCLOUD convenience setup
source .devcontainer/nmcsetup.sh

sudo service apache2 restart
5 changes: 5 additions & 0 deletions .devcontainer/theme.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
$CONFIG = array (
'enforce_theme' => 'default', // or any other theme contained in the app
'theme' => '', // disable old themeing
);