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

[stable29] feat: implement support to devcontainer #3398

Merged
merged 7 commits into from
Jul 19, 2024
Merged
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
43 changes: 43 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Starting devcontainer

- Use vscode (codium don't will work)
- Stup the extension devcontainer
- Open libresign folder at vscode
- After open you will see a message "Reopen in container", do this

## Stopping devcontainer

```bash
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
```
## Cleaning all volumes

This will be necessary when you want to have a new clean environment

```bash
docker volume rm $(docker volume ls -q )
```
## Looking logs

### Nginx

```bash
docker logs libresign_devcontainer-nginx-1 -f --tail 100
```

### Nextcloud

- Open the console inside vscode
- Run:
```bash
tail -f data/nextcloud.log
```

### Database

- Open the console inside vscode
- Run:
```bash
tail -f data/database.log
```
43 changes: 43 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"dockerComposeFile": "docker-compose.yml",
"service": "nextcloud",
"forwardPorts": [
80,
8025
],
"containerEnv": {
"XDEBUG_MODE": "debug",
"XDEBUG_CONFIG": "client_host=127.0.0.1 client_port=9003 start_with_request=yes"
},
"customizations": {
"vscode": {
"extensions": [
"MehediDracula.php-namespace-resolver",
"bmewburn.vscode-intelephense-client",
"neilbrayfield.php-docblocker",
"xdebug.php-debug",
"Vue.volar"
],
"settings": {
"php.suggest.basic": false,
"git.alwaysSignOff": true
}
}
},
"workspaceFolder": "/var/www/html",
"overrideCommand": true,
"postAttachCommand": "bash /var/www/html/apps-extra/libresign/.devcontainer/setup.sh",
"portsAttributes": {
"80": {
"label": "http",
"protocol": "http"
},
"8025": {
"label": "mailhog",
"protocol": "http"
},
"9000": {
"label": "xdebug"
}
}
}
78 changes: 78 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
services:
# pgsql:
# image: postgres:13-alpine
# restart: unless-stopped
# volumes:
# - ./volumes/postgres/data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=${POSTGRES_DB:-nextcloud}
# - POSTGRES_USER=${POSTGRES_USER:-nextcloud}
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nextcloud}
# ports:
# - 127.0.0.1:5432:5432
# command: postgres -c log_statement=all
mysql:
image: mariadb:10.6
volumes:
- ./.docker/config/mysql:/etc/mysql/conf.d
- mysql-init:/docker-entrypoint-initdb.d
- mysql-data:/var/lib/mysql
ports:
- 127.0.0.1:3306:3306
restart: unless-stopped
environment:
- TZ=${TZ:-CET}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}
- MYSQL_DATABASE=${MYSQL_DATABASE:-nextcloud}
- MYSQL_USER=${MYSQL_USER:-nextcloud}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nextcloud}
nextcloud:
image: ghcr.io/librecodecoop/nextcloud-dev-php${PHP_VERSION:-82}:latest
volumes:
- ~/.composer:/var/www/.composer/
- ~/.npm:/var/www/.npm/
- nextcloud:/var/www/html
- ../:/var/www/html/apps-extra/libresign
restart: unless-stopped
environment:
- HOST_UID=${HOST_UID:-1000}
- HOST_GID=${HOST_GID:-1000}
- DEFAULT_PHONE_REGION=${DEFAULT_PHONE_REGION:-UTC}
- NEXTCLOUD_ADMIN_USER=${NEXTCLOUD_ADMIN_USER:-admin}
- NEXTCLOUD_ADMIN_PASSWORD=${NEXTCLOUD_ADMIN_PASSWORD:-admin}
- NEXTCLOUD_ADMIN_EMAIL=${NEXTCLOUD_ADMIN_EMAIL:[email protected]}
- DB_HOST=${DB_HOST:-mysql}
- MYSQL_DATABASE=${MYSQL_DATABASE:-nextcloud}
- MYSQL_USER=${MYSQL_USER:-nextcloud}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-nextcloud}
- POSTGRES_DB=${POSTGRES_DB:-nextcloud}
- POSTGRES_USER=${POSTGRES_USER:-nextcloud}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-nextcloud}
- MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS:-nextcloud}
- MAIL_DOMAIN=${MAIL_DOMAIN:-mailhog}
- MAIL_SMTPPORT=${MAIL_SMTPPORT:-1025}
- MAIL_SMTPHOST=${MAIL_SMTPHOST:-mailhog}
- VERSION_NEXTCLOUD=${VERSION_NEXTCLOUD:-master}
- AUTOINSTALL=${AUTOINSTALL:-1}
- XDEBUG_CONFIG
- HTTP_PORT=${HTTP_PORT:-80}
extra_hosts:
- host.docker.internal:host-gateway
nginx:
image: ghcr.io/librecodecoop/nextcloud-dev-nginx:latest
restart: unless-stopped
volumes:
- nextcloud:/var/www/html:ro
- ../:/var/www/html/apps-extra/libresign:ro
ports:
- 127.0.0.1:${HTTP_PORT:-80}:80
mailhog:
image: blueimp/mailhog
ports:
- 127.0.0.1:${MAILHOG_PORT:-8025}:8025
redis:
image: redis
volumes:
mysql-init:
mysql-data:
nextcloud:
19 changes: 19 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

(
. /var/www/scripts/entrypoint.sh && php-fpm --daemonize
)

git config --global --add safe.directory /var/www/html
git config --global --add safe.directory /var/www/htm/apps-extra/libresign
cd /var/www/html/apps-extra/libresign
if [[ ! -d "vendor" ]]; then
composer install
fi
occ app:enable libresign
if [[ ! -d "node_modules" ]]; then
npm ci
npm run dev
fi
echo "✍️ LibreSign is up!"
echo "If you want to develop at frontend, run the command 'npm run watch'"