-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #718 from systemli/bye-bye-vagrant
Say goodbye to Vagrant
- Loading branch information
Showing
19 changed files
with
68 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +0,0 @@ | ||
[submodule "ansible/roles/geerlingguy.composer"] | ||
path = ansible/roles/geerlingguy.composer | ||
url = https://github.com/geerlingguy/ansible-role-composer.git | ||
[submodule "ansible/roles/geerlingguy.nodejs"] | ||
path = ansible/roles/geerlingguy.nodejs | ||
url = https://github.com/geerlingguy/ansible-role-nodejs.git | ||
[submodule "ansible/roles/oefenweb.yarn"] | ||
path = ansible/roles/oefenweb.yarn | ||
url = https://github.com/Oefenweb/ansible-yarn.git | ||
[submodule "ansible/roles/andyceo.phpcsfixer"] | ||
path = ansible/roles/andyceo.phpcsfixer | ||
url = https://github.com/andyceo/ansible-role-php-cs-fixer.git | ||
[submodule "ansible/roles/systemli.dovecot"] | ||
path = ansible/roles/systemli.dovecot | ||
url = https://github.com/systemli/ansible-role-dovecot.git | ||
[submodule "ansible/roles/geerlingguy.php"] | ||
path = ansible/roles/geerlingguy.php | ||
url = https://github.com/geerlingguy/ansible-role-php.git | ||
[submodule "ansible/roles/mariadb"] | ||
path = ansible/roles/mariadb | ||
url = https://github.com/systemli/ansible-role-mariadb.git | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Submodule andyceo.phpcsfixer
deleted from
e72cc4
Submodule geerlingguy.composer
deleted from
4022d5
Submodule geerlingguy.nodejs
deleted from
f9f236
Submodule geerlingguy.php
deleted from
377516
Submodule mariadb
deleted from
675b89
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Submodule oefenweb.yarn
deleted from
fd876c
Submodule systemli.dovecot
deleted from
bd8f66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,61 @@ | ||
# Development | ||
# Getting started | ||
|
||
## Development with Vagrant | ||
The easiest way to get started with Userli is to use podman or docker. | ||
We provide a `docker-compose.yml` file that starts Userli, Dovecot and MariaDB. | ||
|
||
### Requirements | ||
!!! info | ||
If you don't have podman or docker installed, you can find the installation instructions on the [podman website](https://podman.io/getting-started/installation) or the [docker website](https://docs.docker.com/get-docker/). | ||
|
||
- [Vagrant](https://vagrantup.com/) to set up a virtual machine as development environment. | ||
- [VirtualBox](https://www.virtualbox.org/) as a [virtualisation provider](https://developer.hashicorp.com/vagrant/docs/providers/virtualbox) for Vagrant. | ||
- [Ansible](https://www.ansible.com/) for provisioning the virtual machine. | ||
|
||
!!! note | ||
Start Userli, Dovecot and MariaDB with podman or docker: | ||
|
||
The provisioning of the development environment is defined in `.Vagrantfile` and `.ansible/playbook.yml`. | ||
If you're unfamiliar with Vagrant, you might want to check out its [Quick Start guide](https://developer.hashicorp.com/vagrant/tutorials/getting-started). | ||
=== "podman" | ||
|
||
### Start Vagrant box | ||
```shell | ||
podman compose up -d | ||
``` | ||
|
||
````shell | ||
# pull ansible roles for provisioning: | ||
git submodule update --init | ||
=== "docker" | ||
|
||
# start vagrant box. | ||
# Implies "vagrant up --provision" when run for first time | ||
vagrant up | ||
```shell | ||
docker compose up -d | ||
``` | ||
|
||
## ssh into the virtual environment | ||
vagrant ssh | ||
|
||
# create database and schema | ||
bin/console doctrine:schema:create | ||
|
||
# get node modules | ||
yarn | ||
|
||
# update assets | ||
yarn encore dev | ||
```` | ||
|
||
Visit you local instance at [http://192.168.60.99/](http://192.168.60.99). | ||
|
||
## Development on macOS | ||
|
||
### Requirements | ||
|
||
- [Homebrew](https://brew.sh/index_de) | ||
- [Docker](https://www.docker.com/) | ||
|
||
### Start the environment | ||
Install dependencies and run composer scripts: | ||
|
||
```shell | ||
# spin up mariadb | ||
docker-compose up -d | ||
composer install --ignore-platform-reqs | ||
``` | ||
|
||
brew install [email protected] | ||
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH" | ||
Initialize the database: | ||
|
||
# install dependencies and run composer scripts | ||
composer install --ignore-platform-reqs | ||
=== "podman" | ||
|
||
# create database and schema | ||
bin/console doctrine:schema:create | ||
```shell | ||
podman compose exec userli bin/console doctrine:schema:create | ||
``` | ||
|
||
# get node modules | ||
yarn | ||
=== "docker" | ||
```shell | ||
docker compose exec userli bin/console doctrine:schema:create | ||
``` | ||
|
||
# update assets | ||
yarn encore dev | ||
Install sample data: | ||
|
||
# start the server | ||
bin/console server:run | ||
``` | ||
=== "podman" | ||
```shell | ||
podman compose exec userli bin/console doctrine:fixtures:load | ||
``` | ||
|
||
## Install sample data | ||
=== "docker" | ||
```shell | ||
docker compose exec userli bin/console doctrine:fixtures:load | ||
``` | ||
|
||
```shell | ||
bin/console doctrine:fixtures:load | ||
``` | ||
Open your browser and go to [http://localhost:8000](http://localhost:8000) | ||
|
||
The `doctrine:fixtures:load` command will create four new accounts with | ||
corresponding roles (`admin`, `user`, `support`, `suspicious`) as well | ||
as some random aliases and vouchers. The domain for all accounts is | ||
"example.org" and the password is "password". | ||
|
||
If you want to see more details about how the users are created, see | ||
`src/DataFixtures`. | ||
!!! info | ||
The `doctrine:fixtures:load` command will create four new accounts with corresponding roles (`admin`, `user`, `support`, `suspicious`) as well as some random aliases and vouchers. The domain for all accounts is "example.org" and the password is "password". | ||
|
||
If you want to see more details about how the users are created, see `src/DataFixtures`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
# Tests | ||
|
||
## Linting, unit tests and functional tests | ||
|
||
```shell | ||
vagrant up && vagrant ssh | ||
make test | ||
make integration | ||
``` | ||
Create sample test data: | ||
|
||
## Test checkpassword script | ||
=== "podman" | ||
```shell | ||
podman compose exec userli bin/console doctrine:fixtures:load --group=basic --env=test --no-interaction | ||
``` | ||
|
||
```shell | ||
# Start vagrant box and login | ||
vagrant up && vagrant ssh | ||
# Create DB schema and load fixtures | ||
bin/console doctrine:schema:create | ||
bin/console doctrine:fixture:load | ||
# Run `app:users:checkpassword` locally. First should return `0`, second `1` | ||
echo -en '[email protected]\0password' | ./bin/console app:users:checkpassword /bin/true; echo $? | ||
echo -en '[email protected]\0wrong' | ./bin/console app:users:checkpassword /bin/true; echo $? | ||
# Logout from vagrant and test via IMAP login | ||
exit | ||
./tests/test_checkpassword_login.sh | ||
``` | ||
=== "docker" | ||
```shell | ||
docker compose exec userli bin/console doctrine:fixtures:load --group=basic --env=test --no-interaction | ||
``` | ||
|
||
Run tests: | ||
|
||
=== "podman" | ||
```shell | ||
podman compose exec userli bin/phpunit | ||
``` | ||
|
||
=== "docker" | ||
```shell | ||
docker compose exec userli bin/phpunit | ||
``` | ||
|
Oops, something went wrong.