Skip to content

Commit b55beca

Browse files
committed
Merge branch 'release/v3.9.0'
2 parents c69ddb4 + ec24e06 commit b55beca

25 files changed

+352
-71
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ src
3434
.ruby-version
3535

3636
.bundle
37-
docker-compose/.env
37+
38+
# docker compose specific
39+
dev/.env

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,22 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [Unreleased](https://github.com/passbolt/passbolt_docker/compare/v3.8.1...HEAD)
5+
## [Unreleased](https://github.com/passbolt/passbolt_docker/compare/v3.9.0...HEAD)
6+
7+
## [3.9.0](https://github.com/passbolt/passbolt_docker/compare/v3.8.1...v3.9.0) - 2023-01-31
8+
9+
### Changed
10+
11+
- Now environment is dumped during entrypoint script running instead of during cron runs
12+
- Migrations are executed without clearing the cache by default and only core and model caches are cleared.
13+
14+
### Added
15+
16+
- Development only: Configuration for xdebug to ease working with IDES
17+
18+
### Fixed
19+
20+
- Ports for rootless version pointing to 4433 on docker-compose files
621

722
## [3.8.1](https://github.com/passbolt/passbolt_docker/compare/v3.8.0...v3.8.1) - 2023-01-18
823

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ GEM
66
docker-api (2.2.0)
77
excon (>= 0.47.0)
88
multi_json
9-
excon (0.97.0)
9+
excon (0.98.0)
1010
method_source (1.0.0)
1111
multi_json (1.15.0)
1212
net-scp (4.0.0)
@@ -29,7 +29,7 @@ GEM
2929
rspec-its (1.3.0)
3030
rspec-core (>= 3.0.0)
3131
rspec-expectations (>= 3.0.0)
32-
rspec-mocks (3.12.2)
32+
rspec-mocks (3.12.3)
3333
diff-lcs (>= 1.2.0, < 2.0)
3434
rspec-support (~> 3.12.0)
3535
rspec-support (3.12.0)
@@ -39,7 +39,7 @@ GEM
3939
rspec-its
4040
specinfra (~> 2.72)
4141
sfl (2.3)
42-
specinfra (2.84.0)
42+
specinfra (2.84.1)
4343
net-scp
4444
net-ssh (>= 2.7)
4545
net-telnet (= 0.1.1)
@@ -55,4 +55,4 @@ DEPENDENCIES
5555
serverspec
5656

5757
BUNDLED WITH
58-
2.4.1
58+
2.4.5

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,6 @@ $ export PASSBOLT_GPG_SERVER_KEY_FINGERPRINT="$(su -c "gpg --homedir $GNUPGHOME
180180
$ bin/cake passbolt healthcheck
181181
```
182182

183-
## CI passbolt Docker images building
184-
185-
In order to pull custom images from the Gitlab registry, you need to set this variables and assuming you are not using a self-hosted gitlab instance:
186-
187-
REGISTRY_USERNAME=<username>
188-
REGISTRY_PASSWORD=<password>
189-
REGISTRY_EMAIL=<email>
190-
191183
## Docker secrets support
192184

193185
As an alternative to passing sensitive information via environment variables, _FILE may be appended to the previously listed environment variables, causing the initialization script to load the values for those variables from files present in the container. In particular, this can be used to load passwords from Docker secrets stored in /run/secrets/<secret_name> files. For example:
@@ -210,3 +202,9 @@ This feature is only supported for:
210202
- PASSBOLT_SSL_SERVER_KEY_FILE that points to /etc/ssl/certs/certificate.key
211203
- PASSBOLT_GPG_SERVER_KEY_PRIVATE_FILE that points to /etc/passbolt/gpg/serverkey_private.asc
212204
- PASSBOLT_GPG_SERVER_KEY_PUBLIC_FILE that points to /etc/passbolt/gpg/serverkey.asc
205+
206+
## Develop on Passbolt
207+
208+
This repository also provides a way to quickly setup Passbolt for development purposes. This way should never be used in production, as this would be unsafe.
209+
You can use the docker-compose files under [docker-compose/](./docker-compose/) to spin up Passbolt for production using docker compose.
210+
If you would like to setup Passbolt for development purposes, please follow the steps described [here](./dev/README.md).

conf/supervisor/cron.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[program:cron]
2-
command=/bin/bash -c "declare -p | grep -Ev 'BASHOPTS|BASH_VERSINFO|EUID|PPID|SHELLOPTS|UID' > /etc/environment; cron -f -l"
2+
command=cron -f -l
33
autostart=true
44
priority=20
55
stdout_logfile=/dev/stdout

conf/xdebug.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
zend_extension=xdebug
2+
3+
[xdebug]
4+
xdebug.mode=develop,debug
5+
xdebug.client_host=host.docker.internal
6+
xdebug.start_with_request=yes
7+
xdebug.client_port=9003
8+
xdebug.log=/var/log/xdebug.log

debian/Dockerfile.rootless

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ RUN sed -i 's,listen 80;,listen 8080;,' /etc/nginx/sites-enabled/nginx-passbolt.
7575
&& touch /var/www/.profile \
7676
&& chown www-data:www-data /var/www/.profile \
7777
&& sed -i 's,www-data\s,,' /etc/cron.d/$PASSBOLT_PKG \
78-
&& sed -i "s,__PASSBOLT_PACKAGE__,$PASSBOLT_PKG," /etc/supervisor/conf.d/cron.conf
78+
&& sed -i "s,__PASSBOLT_PACKAGE__,$PASSBOLT_PKG," /etc/supervisor/conf.d/cron.conf \
79+
&& touch /etc/environment \
80+
&& chown www-data:www-data /etc/environment \
81+
&& chmod 600 /etc/environment
7982

8083
COPY conf/supervisor/nginx.conf /etc/supervisor/conf.d/nginx.conf
8184
COPY conf/supervisor/php.conf /etc/supervisor/conf.d/php.conf

dev/Dockerfile

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
FROM composer:2.4 AS composer
22

3-
FROM php:8-fpm
3+
FROM php:8.1-fpm
44

55
LABEL maintainer="Passbolt SA <contact@passbolt.com>"
66

7-
ARG PASSBOLT_VERSION="3.2.1"
7+
ARG PASSBOLT_VERSION="3.8.3"
88
ARG PASSBOLT_URL="https://github.com/passbolt/passbolt_api/archive/v${PASSBOLT_VERSION}.tar.gz"
99
ARG PASSBOLT_CURL_HEADERS=""
1010
ARG PASSBOLT_FLAVOUR="ce"
@@ -15,30 +15,33 @@ ARG PHP_EXTENSIONS="gd \
1515
pdo_mysql \
1616
opcache \
1717
xsl \
18-
ldap"
18+
ldap\
19+
xdebug"
1920

2021
ARG PECL_PASSBOLT_EXTENSIONS="gnupg \
2122
redis \
22-
mcrypt"
23+
mcrypt\
24+
xdebug"
2325

2426
ARG PASSBOLT_DEV_PACKAGES="libgpgme11-dev \
2527
libpng-dev \
2628
libjpeg62-turbo-dev \
2729
libicu-dev \
2830
libxslt1-dev \
2931
libmcrypt-dev \
32+
libldap2-dev \
3033
libzip-dev \
31-
zip \
3234
unzip \
33-
libldap2-dev"
35+
zip"
3436

3537
ARG PASSBOLT_BASE_PACKAGES="nginx \
36-
gnupg \
37-
libgpgme11 \
38-
libmcrypt4 \
39-
mariadb-client \
40-
supervisor \
41-
cron"
38+
git \
39+
gnupg \
40+
libgpgme11 \
41+
libmcrypt4 \
42+
mariadb-client \
43+
supervisor \
44+
cron"
4245

4346
ENV PECL_BASE_URL="https://pecl.php.net/get"
4447
ENV PHP_EXT_DIR="/usr/src/php/ext"
@@ -78,11 +81,15 @@ RUN apt-get update \
7881
&& mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" \
7982
&& echo "* * * * * su -c \"source /etc/environment ; /var/www/passbolt/bin/cake EmailQueue.sender\" -s /bin/bash www-data >> /var/log/cron.log 2>&1" >> /etc/cron.d/passbolt_email \
8083
&& crontab /etc/cron.d/passbolt_email \
81-
&& ln -s $(which php-fpm) $(which php-fpm)7.3
84+
&& ln -s $(which php-fpm) $(which php-fpm)7.3 \
85+
&& touch /var/log/xdebug.log \
86+
&& chown www-data:www-data /var/log/xdebug.log \
87+
&& chmod 664 /var/log/xdebug.log
8288

8389
COPY conf/passbolt.conf /etc/nginx/conf.d/default.conf
8490
COPY conf/supervisor/*.conf /etc/supervisor/conf.d/
8591
COPY conf/supervisor/php-dev.conf /etc/supervisor/conf.d/php.conf
92+
COPY conf/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
8693
COPY dev/bin/docker-entrypoint.sh /docker-entrypoint.sh
8794
COPY scripts/wait-for.sh /usr/bin/wait-for.sh
8895

dev/README.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
```
2+
____ __ ____ .-.
3+
/ __ \____ _____ ____/ /_ ____ / / /_ .--./ / _.---.,
4+
/ /_/ / __ `/ ___/ ___/ __ \/ __ \/ / __/ '-, (__..-` \
5+
/ ____/ /_/ (__ |__ ) /_/ / /_/ / / /_ \ |
6+
/_/ \__,_/____/____/_,___/\____/_/\__/ `,.__. ^___.-/
7+
`-./ .'...--`
8+
The open source password manager for teams `'
9+
(c) 2023 Passbolt SA
10+
https://www.passbolt.com
11+
```
12+
13+
# Setting up a working development environment using docker
14+
15+
Please note that these instructions are for setting a functional development environment only. Refer to the [installation guide](https://help.passbolt.com/hosting/install) if you want to use Passbolt securely to share passwords with your team.
16+
17+
## Prerequisites
18+
- [Git](https://git-scm.com/)
19+
- [Docker](https://docs.docker.com/get-docker/) v20 or newer
20+
21+
## Preparing Local Environment
22+
23+
1. Clone the repos
24+
Fork the Passbolt API repository. Please read [Fork a repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo?tool=webui) if you've never done this before.
25+
26+
Clone the forked repository onto your local machine:
27+
```bash
28+
git clone git@github.com:<YOUR_FORK_HERE>/passbolt_api.git
29+
```
30+
31+
In addition to the Passbolt API repository, you'll also require the [passbolt_docker](https://github.com/passbolt/passbolt_docker) repository to spin up the stack using docker compose.
32+
```bash
33+
git clone https://github.com/passbolt/passbolt_docker.git
34+
```
35+
36+
2. Copy the initial app.php into a new one for passbolt_api (the new file will be used by the passbolt server)
37+
```
38+
cd passbolt_api
39+
cp config/app.default.php config/app.php
40+
```
41+
42+
3. Run composer install to update all the dependencies. A new vendor directory will be created with all the required libraries
43+
```
44+
cd passbolt_api
45+
docker run --rm --interactive --tty --volume $PWD:/app composer install --ignore-platform-reqs
46+
```
47+
48+
4. Map the passbolt.local to the localhost in the /etc/hosts
49+
```
50+
127.0.0.1 passbolt.local
51+
```
52+
53+
5. Copy the .env.example file into .env and replace the PATH_TO_PASSBOLT_API variable with the path to the passbolt_api repository on your machine
54+
55+
6. Spin-up the docker-compose containers (mariadb and passbolt server)
56+
```
57+
cd passbolt_docker
58+
docker-compose -f dev/docker-compose-dev.yml up -d
59+
```
60+
61+
7. Create the first user (the administrator) by replacing the below command with your own data. More details [here](https://help.passbolt.com/hosting/install/ce/docker).
62+
```
63+
cd passbolt_docker
64+
docker-compose -f dev/docker-compose-ce.yaml exec passbolt /bin/bash -c \
65+
'su -m -c "/var/www/passbolt/bin/cake passbolt register_user -u myuser@passbolt.local \
66+
-f name -l lastname -r admin" -s /bin/sh www-data'
67+
```
68+
69+
8. Copy-paste the output in the browser and you are ready!
70+
71+
# Setup xDebug
72+
73+
In order to setup xDebug with an IDE or code editor, please use dev/Dockerfile or docker-compose/docker-compose-dev.yaml to spin up a development stack, which already contains xDebug configured to run within the Passbolt server.
74+
You will then have to configure your IDE to connect to xDebug. Below are the steps required for a few IDEs:
75+
76+
## Visual Studio Code
77+
78+
1. From the Extensions tab, install the "PHP Debug" extension from the "Xdebug" publisher
79+
2. In the "Run and Debug" tab, click the gear icon at the very top of the panel to "Open 'launch.json'"
80+
3. Under "configurations", add a new JSON object with the following content:
81+
```
82+
{
83+
"name": "Listen for Xdebug on Docker",
84+
"type": "php",
85+
"request": "launch",
86+
"port": 9003,
87+
"pathMappings": {
88+
"/var/www/passbolt": "${workspaceFolder}"
89+
}
90+
},
91+
```
92+
4. Check for errors by adding `xdebug_info(); die();` to the Passbolt `webroot/index.php` file and visiting the Passbolt server root page. If you don't see anything under the "Diagnosis" section, you can remove this change and start using xDebug
93+
5. In the "Run and Debug" tab, select the debug profile we added in "launch.json" ("Listen for Xdebug on Docker") and click the green arrow to connect to xDebug
94+
95+
In case the "${workspaceFolder}" value is not mapped correctly (this seems to be the case on MacOS), you can provide the full path of the open workspace folder:
96+
* Either manually: `<ABSOLUTE_PATH_TO_WORKSPACE_FOLDER>`
97+
* Or if you store all your code fodlers in a common code place:
98+
- `<ABSOLUTE_PATH_TO_COMMON_CODE_FOLDER>/${workspaceFolderBasename}` OR
99+
- `${workspaceRoot}` (deprecated in vscode but still works, though only works in single-workspace setup)
100+
101+
## PHPStorm
102+
103+
1. Configure your IDE so that it can properly connect with Docker: under Settings/Preferences -> Build, Execution, Deployment -> Docker. Here is a tutorial: https://www.jetbrains.com/help/phpstorm/docker.html#enable_docker
104+
2. Then, under Settings/Preferences -> PHP -> Debug, in the "External connections" section, make sure the "Break at first line in PHP scripts" checkbox is unchecked
105+
3. Thereafter, we need to configure a PHP server, which can be done by going to File > Settings > PHP > Servers. Click on the plus sign twice to create two servers:
106+
- The first server should be set to xDebug: Name="Docker - Passbolt", Host="passbolt.local", Port="9003", Debugger="Xdebug", ProjectFiles="<PATH_TO_PASSBOLT_API_REPO>", AbsolutePath="/var/www/passbolt"
107+
- The second server should be set to the web server (passbolt.local): Name="passbolt.local", Host="passbolt.local", Port="443", Debugger="Xdebug", ProjectFiles="<PATH_TO_PASSBOLT_API_REPO>", AbsolutePath="/var/www/passbolt"
108+
4. Save and close the Settings/Preferences window
109+
5. At the top of the main window, click the "Add Configuration..." button, then "Add new..." > "PHP Remote Debug"
110+
6. Check the "Filter debug connection by IDE key", and fill in the form with: Name="Docker - Passbolt", Server="Docker - Passbolt", IDEKey="docker_passbolt"
111+
7. At the top of the main window, click the "Listen for PHP debug connection" button and start a debugging session
112+
113+
**Note:** If you want to debug tests, you will need to properly setup the PHPUnit library under Settings/Preferences -> PHP -> Test Frameworks by adding a configuration and setting the path to phpunit.phar to "/var/www/passbolt/vendor/bin/phpunit" (the docker path mapping must be setup for it to work with this path)

0 commit comments

Comments
 (0)