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

Say goodbye to Vagrant #718

Merged
merged 1 commit into from
Feb 15, 2025
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
21 changes: 0 additions & 21 deletions .gitmodules
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
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ reset: clean
rm -rf public/build
rm -rf public/bundles
rm -rf public/components
rm -rf .vagrant/
rm -f ansible/playbook.retry
rm -rf var/log/*
rm -rf var/cache/*
Expand Down
37 changes: 0 additions & 37 deletions Vagrantfile

This file was deleted.

79 changes: 0 additions & 79 deletions ansible/playbook.yml

This file was deleted.

1 change: 0 additions & 1 deletion ansible/roles/andyceo.phpcsfixer
Submodule andyceo.phpcsfixer deleted from e72cc4
1 change: 0 additions & 1 deletion ansible/roles/geerlingguy.composer
Submodule geerlingguy.composer deleted from 4022d5
1 change: 0 additions & 1 deletion ansible/roles/geerlingguy.nodejs
Submodule geerlingguy.nodejs deleted from f9f236
1 change: 0 additions & 1 deletion ansible/roles/geerlingguy.php
Submodule geerlingguy.php deleted from 377516
1 change: 0 additions & 1 deletion ansible/roles/mariadb
Submodule mariadb deleted from 675b89
5 changes: 0 additions & 5 deletions ansible/roles/nginx/handlers/main.yml

This file was deleted.

11 changes: 0 additions & 11 deletions ansible/roles/nginx/tasks/main.yml

This file was deleted.

25 changes: 0 additions & 25 deletions ansible/roles/nginx/templates/default.j2

This file was deleted.

1 change: 0 additions & 1 deletion ansible/roles/oefenweb.yarn
Submodule oefenweb.yarn deleted from fd876c
1 change: 0 additions & 1 deletion ansible/roles/systemli.dovecot
Submodule systemli.dovecot deleted from bd8f66
104 changes: 40 additions & 64 deletions docs/development/index.md
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`.
42 changes: 22 additions & 20 deletions docs/development/tests.md
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
```

Loading
Loading