diff --git a/README.md b/README.md index 1252d07d..79a38f79 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,25 @@ We use submodules, either clone them with this repo or after `git submodule update --init` -### Hosts File +### Development with docker-compose + +The docker-compose stuff is not suitable for production. It probably +could be made to be production ready, but for now it's only for dev. + +1. Set the `FONTAWSEOME_TOKEN` in your local shell + `export FONTAWESOME_TOKEN=` +2. Make read/write to the containers `chmod a+rw -R .` +3. Start everything with `docker compose up` + +After a minute or two you should be able to access: + +* HMS at http://localhost:8080 +* phpMyAdmin at http://localhost:8081 +* mailpit at http://localhost:8025 + +### Development with Vagrant + +#### Hosts File Most of the development environment is taken care of by vagrant, you just need to `vagrant up` to load it. @@ -31,9 +49,9 @@ You can find your file in the following location: * Mac: /private/etc/hosts * Linux: /etc/hosts -### Running commands on the Virtual Machine +#### Running commands on the Virtual Machine -#### Artisan +##### Artisan To run an artisan command on the VM, (for example if you don't have PHP installed on your local machine) use the ```php-artisan``` script that you can find in the dev/ folder. @@ -41,13 +59,13 @@ Simply pass it the artisan command you want to run, e.g: ```./dev/php-artisan make:controller``` -### Vagrant re-provisioning notes +#### Vagrant re-provisioning notes When re-provisioning the box (`vagrnat up`) you must make sure that the `.env` file has `QUEUE_CONNECTION=sync` in order the to the `db:seed` to correctly populate the `mailserver` database entries. If the `mailserver.mailbox` tables it empty you can do a datebase reset and reseed with `dev/reseed.sh` -### Vagrant suspend notes +#### Vagrant suspend notes When bringing up vagrant box after a suspend or halt some of the service my not start correctly due to the shared folder, run this script to restart them diff --git a/dev/Dockerfile.nginx b/dev/Dockerfile.nginx new file mode 100644 index 00000000..d8718497 --- /dev/null +++ b/dev/Dockerfile.nginx @@ -0,0 +1,26 @@ +FROM trafex/php-nginx:3.10.0 AS build + +USER root + +RUN cd / && \ + apk add --no-cache php84-pear php84-dev gcc musl-dev make krb5-dev && \ + wget https://pecl.php.net/get/krb5-1.2.4.tgz && \ + tar zxf krb5-1.2.4.tgz && cd krb5-1.2.4 && \ + phpize84 && \ + ./configure --with-krb5kadm=S && \ + make -j8 && make install + +FROM trafex/php-nginx:3.10.0 AS final + +COPY --from=build /usr/lib/php84/modules/krb5.so /usr/lib/php84/modules/krb5.so + +USER root + +RUN apk add --no-cache php84-pdo_mysql php84-redis krb5 krb5-pkinit \ + php84-pcntl php84-posix php84-sodium php84-simplexml git npm && \ + echo 'extension=krb5.so' > /etc/php84/conf.d/krb5.ini && \ + echo -e '[safe]\ndirectory = *' > /.gitconfig && \ + wget https://getcomposer.org/download/2.9.7/composer.phar -O /usr/bin/composer && \ + chmod a+x /usr/bin/composer + +USER nobody diff --git a/dev/docker-hms-init.sh b/dev/docker-hms-init.sh new file mode 100755 index 00000000..e6da8d20 --- /dev/null +++ b/dev/docker-hms-init.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +HOME=/tmp/hms +mkdir -p $HOME + +cd /hms + +# Stuff to happen on the first run only +[ -f .env ] || ( + cp .env.example .env + sed -i '/MAIL_HOST/cMAIL_HOST=hms-mailpit/' .env + sed -i '/REDIS_HOST/cREDIS_HOST=hms-redis/' .env + sed -i '/MEMCACHED_HOST/cMEMCACHED_HOST=hms-memcached/' .env + + composer install --no-security-blocking + + php artisan key:generate + php artisan migrate + php artisan doctrine:migration:refresh -n + php artisan hms:database:refresh-views + php artisan hms:database:refresh-procedures + php artisan permissions:defaults + php artisan meta:sync + php artisan db:seed + yes | php artisan passport:install + yes | php artisan ziggy:generate + + npm ci + npm run dev +) + diff --git a/dev/docker-init.sql b/dev/docker-init.sql new file mode 100644 index 00000000..3adcc43e --- /dev/null +++ b/dev/docker-init.sql @@ -0,0 +1 @@ +CREATE DATABASE IF NOT EXISTS hms; diff --git a/dev/docker-krb5-init.sh b/dev/docker-krb5-init.sh new file mode 100755 index 00000000..55545588 --- /dev/null +++ b/dev/docker-krb5-init.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +sleep 5 + +# Setup kerberos keytab +export KRB5_CONFIG=/shared/krb5.conf +cat > "$KRB5_CONFIG" <