apolopena / gitpod-laravel-starter

Configurable LAMP or LEMP stack starter project powered by Laravel and Gitpod. Supports Laravel 6, 7, and 8. Out of the box support for React, Vue, and Bootstrap frontends, with or without built-in auth .
https://github.com/apolopena/gitpod-laravel-starter/wiki
MIT License
40 stars 44 forks source link

starter.ini: Allow the choice of which PPA to use for an optional install of PHP #172

Closed apolopena closed 2 years ago

apolopena commented 2 years ago

Problem this feature will solve

See https://github.com/apolopena/gitpod-laravel-starter/issues/156#issuecomment-1018883245

Background

Proposed Solution

See https://github.com/apolopena/gitpod-laravel-starter/issues/156#issuecomment-1018883245

Constraints and Assumptions

<! -- Any constraints and/or assumption relevant for the development and use of this feature? -->

Alternatives or Workarounds

Additional context

Add any other context or screenshots about the feature request here.

apolopena commented 2 years ago

Depends on https://github.com/apolopena/gitpod-laravel-starter/issues/177

strausmann commented 2 years ago

I once wanted to test a PHP8 workspace. For this I changed the PHP version in the starter.ini to "version=gitpodlatest".

https://github.com/apolopena/gitpod-laravel-starter/blob/1294ebe5666ba1a26808b5cceebb6af6af9bc32a/starter.ini#L39

Then I started a GitPod workspace, unfortunately again a cached image was used for the workspace and PHP 7.4 was active in it.

I first had to change the .gitpod.Dockerfile and increment the value "INVALIDATE_CACHE".

https://github.com/apolopena/gitpod-laravel-starter/blob/1294ebe5666ba1a26808b5cceebb6af6af9bc32a/.gitpod.Dockerfile#L56

Is this desired to be able to change only the PHP version via this way?

Then came this error, PHP 8 does not build correctly.

8 [4/9] RUN sudo bash -c ". /tmp/php.sh" && rm /tmp/php.sh

8 0.359 BEGIN: php.sh

8 0.365 Using the existing 'gitpodlatest' version of PHP (8.0) as specified in https://github.com/gitpod-io/workspace-images/blob/master/full/Dockerfile

8 0.366 /tmp/php.sh: line 123: generate_php_fpm_conf: command not found

8 0.477 Get:1 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease [23.8 kB]

8 0.477 Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]

8 0.498 Get:3 https://download.docker.com/linux/ubuntu focal InRelease [57.7 kB]

8 0.506 Get:4 https://apt.llvm.org/focal llvm-toolchain-focal InRelease [6,824 B]

8 0.509 Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease [23.9 kB]

8 0.529 Get:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]

8 0.542 Get:7 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]

8 0.619 Get:8 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]

8 0.651 Get:9 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main amd64 Packages [3,162 B]

8 0.774 Get:10 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages [14.9 kB]

8 0.900 Get:11 https://pkgs.tailscale.com/stable/ubuntu focal InRelease

8 1.071 Get:12 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]

8 1.085 Get:13 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]

8 1.169 Get:14 https://apt.llvm.org/focal llvm-toolchain-focal/main amd64 Packages [12.4 kB]

8 1.215 Get:15 http://ppa.launchpad.net/ondrej/php/ubuntu focal/main amd64 Packages [169 kB]

8 1.222 Get:16 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]

8 1.223 Get:17 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1,275 kB]

8 1.373 Get:18 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [952 kB]

8 1.394 Get:19 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,120 kB]

8 1.410 Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,895 kB]

8 1.433 Get:21 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [33.7 kB]

8 1.531 Get:22 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [50.8 kB]

8 1.542 Get:23 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [22.4 kB]

8 1.747 Get:24 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [839 kB]

8 1.943 Get:25 https://pkgs.tailscale.com/stable/ubuntu focal/main amd64 Packages [4,899 B]

8 2.066 Get:26 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [30.1 kB]

8 2.068 Get:27 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,470 kB]

8 2.190 Get:28 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [889 kB]

8 2.625 Fetched 21.1 MB in 2s (9,573 kB/s)

8 2.625 Reading package lists...

8 3.652 Purging existing PHP 8.0 installation

8 3.719 Reading package lists...

8 4.753 Building dependency tree...

8 4.941 Reading state information...

8 4.998 Package 'php8.0' is not installed, so not removed

8 4.998 Package 'php8.0-amqp' is not installed, so not removed

8 4.998 Package 'php8.0-apcu' is not installed, so not removed

8 4.998 Package 'php8.0-ast' is not installed, so not removed

8 4.998 Package 'php8.0-bcmath' is not installed, so not removed

8 4.998 Package 'php8.0-bz2' is not installed, so not removed

8 4.998 Package 'php8.0-cgi' is not installed, so not removed

8 4.998 Package 'php8.0-cli' is not installed, so not removed

8 4.998 Package 'php8.0-common' is not installed, so not removed

8 4.998 Package 'php8.0-curl' is not installed, so not removed

8 4.998 Package 'php8.0-dba' is not installed, so not removed

8 4.998 Package 'php8.0-decimal' is not installed, so not removed

8 4.998 Package 'php8.0-dev' is not installed, so not removed

8 4.998 Package 'php8.0-ds' is not installed, so not removed

8 4.998 Package 'php8.0-enchant' is not installed, so not removed

8 4.998 Package 'php8.0-fpm' is not installed, so not removed

8 4.998 Package 'php8.0-gd' is not installed, so not removed

8 4.998 Package 'php8.0-gearman' is not installed, so not removed

8 4.998 Package 'php8.0-gmagick' is not installed, so not removed

8 4.998 Package 'php8.0-gmp' is not installed, so not removed

8 4.998 Package 'php8.0-gnupg' is not installed, so not removed

8 4.998 Package 'php8.0-grpc' is not installed, so not removed

8 4.998 Package 'php8.0-http' is not installed, so not removed

8 4.998 Package 'php8.0-igbinary' is not installed, so not removed

8 4.998 Package 'php8.0-imagick' is not installed, so not removed

8 4.998 Package 'php8.0-imap' is not installed, so not removed

8 4.998 Package 'php8.0-inotify' is not installed, so not removed

8 4.998 Package 'php8.0-interbase' is not installed, so not removed

8 4.998 Package 'php8.0-intl' is not installed, so not removed

8 4.998 Package 'php8.0-ldap' is not installed, so not removed

8 4.998 Package 'php8.0-lz4' is not installed, so not removed

8 4.998 Package 'php8.0-mailparse' is not installed, so not removed

8 4.998 Package 'php8.0-maxminddb' is not installed, so not removed

8 4.998 Package 'php8.0-mbstring' is not installed, so not removed

8 4.998 Package 'php8.0-mcrypt' is not installed, so not removed

8 4.998 Package 'php8.0-memcache' is not installed, so not removed

8 4.998 Package 'php8.0-memcached' is not installed, so not removed

8 4.998 Package 'php8.0-mongodb' is not installed, so not removed

8 4.998 Package 'php8.0-msgpack' is not installed, so not removed

8 4.998 Package 'php8.0-mysql' is not installed, so not removed

8 4.998 Package 'php8.0-oauth' is not installed, so not removed

8 4.998 Package 'php8.0-odbc' is not installed, so not removed

8 4.998 Package 'php8.0-opcache' is not installed, so not removed

8 4.998 Package 'php8.0-pcov' is not installed, so not removed

8 4.998 Package 'php8.0-pgsql' is not installed, so not removed

8 4.998 Package 'php8.0-phpdbg' is not installed, so not removed

8 4.998 Package 'php8.0-protobuf' is not installed, so not removed

8 4.998 Package 'php8.0-ps' is not installed, so not removed

8 4.998 Package 'php8.0-pspell' is not installed, so not removed

8 4.998 Package 'php8.0-psr' is not installed, so not removed

8 4.998 Package 'php8.0-raphf' is not installed, so not removed

8 4.998 Package 'php8.0-readline' is not installed, so not removed

8 4.998 Package 'php8.0-redis' is not installed, so not removed

8 4.998 Package 'php8.0-rrd' is not installed, so not removed

8 4.998 Package 'php8.0-smbclient' is not installed, so not removed

8 4.998 Package 'php8.0-snmp' is not installed, so not removed

8 4.998 Package 'php8.0-soap' is not installed, so not removed

8 4.998 Package 'php8.0-solr' is not installed, so not removed

8 4.998 Package 'php8.0-sqlite3' is not installed, so not removed

8 4.998 Package 'php8.0-ssh2' is not installed, so not removed

8 4.998 Package 'php8.0-swoole' is not installed, so not removed

8 4.998 Package 'php8.0-sybase' is not installed, so not removed

8 4.998 Package 'php8.0-tidy' is not installed, so not removed

8 4.998 Package 'php8.0-uopz' is not installed, so not removed

8 4.998 Package 'php8.0-uploadprogress' is not installed, so not removed

8 4.998 Package 'php8.0-uuid' is not installed, so not removed

8 4.998 Package 'php8.0-vips' is not installed, so not removed

8 4.998 Package 'php8.0-xdebug' is not installed, so not removed

8 4.998 Package 'php8.0-xhprof' is not installed, so not removed

8 4.998 Package 'php8.0-xml' is not installed, so not removed

8 4.998 Package 'php8.0-xmlrpc' is not installed, so not removed

8 4.998 Package 'php8.0-xsl' is not installed, so not removed

8 4.998 Package 'php8.0-yac' is not installed, so not removed

8 4.998 Package 'php8.0-yaml' is not installed, so not removed

8 4.998 Package 'php8.0-zip' is not installed, so not removed

8 4.998 Package 'php8.0-zmq' is not installed, so not removed

8 4.998 Package 'php8.0-zstd' is not installed, so not removed

8 4.998 Package 'php8.1' is not installed, so not removed

8 4.998 Package 'php8.1-amqp' is not installed, so not removed

8 4.998 Package 'php8.1-apcu' is not installed, so not removed

8 4.998 Package 'php8.1-ast' is not installed, so not removed

8 4.998 Package 'php8.1-bcmath' is not installed, so not removed

8 4.998 Package 'php8.1-bz2' is not installed, so not removed

8 4.998 Package 'php8.1-cgi' is not installed, so not removed

8 4.998 Package 'php8.1-cli' is not installed, so not removed

8 4.998 Package 'php8.1-common' is not installed, so not removed

8 4.998 Package 'php8.1-curl' is not installed, so not removed

8 4.998 Package 'php8.1-dba' is not installed, so not removed

8 4.998 Package 'php8.1-decimal' is not installed, so not removed

8 4.998 Package 'php8.1-dev' is not installed, so not removed

8 4.998 Package 'php8.1-ds' is not installed, so not removed

8 4.998 Package 'php8.1-enchant' is not installed, so not removed

8 4.998 Package 'php8.1-fpm' is not installed, so not removed

8 4.998 Package 'php8.1-gd' is not installed, so not removed

8 4.998 Package 'php8.1-gearman' is not installed, so not removed

8 4.998 Package 'php8.1-gmagick' is not installed, so not removed

8 4.998 Package 'php8.1-gmp' is not installed, so not removed

8 4.998 Package 'php8.1-gnupg' is not installed, so not removed

8 4.998 Package 'php8.1-grpc' is not installed, so not removed

8 4.998 Package 'php8.1-http' is not installed, so not removed

8 4.998 Package 'php8.1-igbinary' is not installed, so not removed

8 4.998 Package 'php8.1-imagick' is not installed, so not removed

8 4.998 Package 'php8.1-imap' is not installed, so not removed

8 4.998 Package 'php8.1-inotify' is not installed, so not removed

8 4.998 Package 'php8.1-interbase' is not installed, so not removed

8 4.998 Package 'php8.1-intl' is not installed, so not removed

8 4.998 Package 'php8.1-ldap' is not installed, so not removed

8 4.998 Package 'php8.1-lz4' is not installed, so not removed

8 4.998 Package 'php8.1-mailparse' is not installed, so not removed

8 4.998 Package 'php8.1-maxminddb' is not installed, so not removed

8 4.998 Package 'php8.1-mbstring' is not installed, so not removed

8 4.998 Package 'php8.1-mcrypt' is not installed, so not removed

8 4.998 Package 'php8.1-memcache' is not installed, so not removed

8 4.998 Package 'php8.1-memcached' is not installed, so not removed

8 4.998 Package 'php8.1-mongodb' is not installed, so not removed

8 4.998 Package 'php8.1-msgpack' is not installed, so not removed

8 4.998 Package 'php8.1-mysql' is not installed, so not removed

8 4.998 Package 'php8.1-oauth' is not installed, so not removed

8 4.998 Package 'php8.1-odbc' is not installed, so not removed

8 4.998 Package 'php8.1-opcache' is not installed, so not removed

8 4.998 Package 'php8.1-pcov' is not installed, so not removed

8 4.998 Package 'php8.1-pgsql' is not installed, so not removed

8 4.998 Package 'php8.1-phpdbg' is not installed, so not removed

8 4.998 Package 'php8.1-protobuf' is not installed, so not removed

8 4.998 Package 'php8.1-ps' is not installed, so not removed

8 4.998 Package 'php8.1-pspell' is not installed, so not removed

8 4.998 Package 'php8.1-psr' is not installed, so not removed

8 4.998 Package 'php8.1-raphf' is not installed, so not removed

8 4.998 Package 'php8.1-readline' is not installed, so not removed

8 4.998 Package 'php8.1-redis' is not installed, so not removed

8 4.998 Package 'php8.1-rrd' is not installed, so not removed

8 4.998 Package 'php8.1-smbclient' is not installed, so not removed

8 4.998 Package 'php8.1-snmp' is not installed, so not removed

8 4.998 Package 'php8.1-soap' is not installed, so not removed

8 4.998 Package 'php8.1-solr' is not installed, so not removed

8 4.998 Package 'php8.1-sqlite3' is not installed, so not removed

8 4.998 Package 'php8.1-ssh2' is not installed, so not removed

8 4.998 Package 'php8.1-swoole' is not installed, so not removed

8 4.998 Package 'php8.1-sybase' is not installed, so not removed

8 4.998 Package 'php8.1-tidy' is not installed, so not removed

8 4.998 Package 'php8.1-uopz' is not installed, so not removed

8 4.998 Package 'php8.1-uploadprogress' is not installed, so not removed

8 4.998 Package 'php8.1-uuid' is not installed, so not removed

8 4.998 Package 'php8.1-vips' is not installed, so not removed

8 4.998 Package 'php8.1-xdebug' is not installed, so not removed

8 4.998 Package 'php8.1-xhprof' is not installed, so not removed

8 5.189 Package 'php8.1-xml' is not installed, so not removed

8 5.189 Package 'php8.1-xmlrpc' is not installed, so not removed

8 5.189 Package 'php8.1-xsl' is not installed, so not removed

8 5.189 Package 'php8.1-yac' is not installed, so not removed

8 5.189 Package 'php8.1-yaml' is not installed, so not removed

8 5.189 Package 'php8.1-zip' is not installed, so not removed

8 5.189 Package 'php8.1-zmq' is not installed, so not removed

8 5.189 Package 'php8.1-zstd' is not installed, so not removed

8 5.189 0 upgraded, 0 newly installed, 0 to remove and 139 not upgraded.

8 5.192 SUCCESS: Purging existing PHP 8.0 installation

8 5.195 Cleaning up from the purge of PHP 8.0

8 5.264 Reading package lists...

8 6.269 Building dependency tree...

8 6.457 Reading state information...

8 6.548 Reading package lists...

8 7.581 Building dependency tree...

8 7.772 Reading state information...

8 7.977 0 upgraded, 0 newly installed, 0 to remove and 139 not upgraded.

8 7.981 SUCCESS: Cleaning up from the purge of PHP 8.0

8 8.040 sh: 1: /etc/apache2/envvars: gp: not found

8 8.053 Module php8.0 disabled.

8 8.059 Module mpm_prefork disabled.

8 8.059 To activate the new configuration, you need to run:

8 8.059 service apache2 restart

8 8.067 Removing ppa:ondrej/php (as specified in starter.ini)

8 9.303 SUCCESS: Removing ppa:ondrej/php (as specified in starter.ini)

8 9.303 The standard OS ppa will be used to install PHP gitpodlatest

8 9.305 Installing PHP gitpodlatest as specified in starter.ini

8 9.587 Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease

8 9.587 Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease

8 9.587 Hit:3 http://ppa.launchpad.net/git-core/ppa/ubuntu focal InRelease

8 9.589 Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease

8 9.594 Hit:5 https://apt.llvm.org/focal llvm-toolchain-focal InRelease

8 9.599 Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease

8 9.602 Hit:7 https://download.docker.com/linux/ubuntu focal InRelease

8 10.03 Get:8 https://pkgs.tailscale.com/stable/ubuntu focal InRelease

8 10.73 Fetched 5,536 B in 1s (4,584 B/s)

8 10.73 Reading package lists...

8 11.81 Reading package lists...

8 12.80 Building dependency tree...

8 12.99 Reading state information...

8 13.22 0 upgraded, 0 newly installed, 0 to remove and 127 not upgraded.

8 13.23 SUCCESS: Installing PHP gitpodlatest as specified in starter.ini

8 13.23 The following packages were installed:

8 13.23 Setting PHP config, phar and phpize from 8.0 to gitpodlatest

8 13.25 update-alternatives: error: alternative /usr/bin/phpgitpodlatest for php not registered; not setting

8 13.26 ERROR: Setting PHP config, phar and phpize from 8.0 to gitpodlatest

8 13.26 php.sh was aborted: Optional php installation failed to be configured!

8 ERROR: process "/bin/sh -c sudo bash -c \". /tmp/php.sh\" && rm /tmp/php.sh" did not complete successfully: exit code: 1


[4/9] RUN sudo bash -c ". /tmp/php.sh" && rm /tmp/php.sh:

8 9.602 Hit:7 https://download.docker.com/linux/ubuntu focal InRelease

8 10.03 Get:8 https://pkgs.tailscale.com/stable/ubuntu focal InRelease

8 13.22 0 upgraded, 0 newly installed, 0 to remove and 127 not upgraded.

8 13.23 SUCCESS: Installing PHP gitpodlatest as specified in starter.ini

8 13.23 The following packages were installed:

8 13.23 Setting PHP config, phar and phpize from 8.0 to gitpodlatest

8 13.25 update-alternatives: error: alternative /usr/bin/phpgitpodlatest for php not registered; not setting

8 13.26 ERROR: Setting PHP config, phar and phpize from 8.0 to gitpodlatest

8 13.26 php.sh was aborted: Optional php installation failed to be configured!


.gitpod.Dockerfile:38

36 |
37 | # Configure php as specified in starter.ini 38 | >>> RUN sudo bash -c ". /tmp/php.sh" && rm /tmp/php.sh 39 |
40 | # Install core packages for gitpod-laravel-starter

error: failed to solve: process "/bin/sh -c sudo bash -c \". /tmp/php.sh\" && rm /tmp/php.sh" did not complete successfully: exit code: 1 {"@type":"type.googleapis.com/google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent","command":"build","error":"exit status 1","level":"error","message":"build failed","serviceContext":{"service":"bob","version":""},"severity":"ERROR","time":"2022-01-22T21:35:16Z"} exit exit

Error: headless task failed: exit status 1

I also saw that in the install_xdebug the PHP version is determined dynamically, but then this line is found there to build xdebug.

https://github.com/apolopena/gitpod-laravel-starter/blob/1294ebe5666ba1a26808b5cceebb6af6af9bc32a/.gp/bash/install-xdebug.sh#L40

strausmann commented 2 years ago

Error by PHP8 is this here:

/tmp/php.sh: line 123: generate_php_fpm_conf: command not found

apolopena commented 2 years ago

in regard to cached values in starter.ini

Is this desired to be able to change only the PHP version via this way?

Any code/values that are used in the docker build image step has to be invalidated when they change or it gets cached so I dont think there is any other way to handle this. All values that dont require a docker cache buster (invalidate_cache) when they are changed should be documented as such in starter.ini. See the comment header in starter.ini.

Note: When a user creates a new project for the first time the docker cache will be busted so they can change thier values in starter.ini before they create their very first workspace from that project and they wont have to bust the docker cache.

As for the hardcoded values for xdebug and gitpodlatest fallbaback I will look into those today or tomorrow.