Skip to content

Commit

Permalink
Merge branch 'release/v0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dasscheman committed Jul 1, 2024
2 parents e236e37 + 3fecaae commit 7a5b271
Show file tree
Hide file tree
Showing 60 changed files with 3,276 additions and 639 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/docker-image-Laravel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker Image Laravel
env:
# 🖊️ EDIT to change the image registry settings.
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
IMAGE_REGISTRY: ghcr.io/utrechtuniversity
IMAGE_REGISTRY_USER: ${{ github.actor }}
IMAGE_REGISTRY_PASSWORD: ${{ github.token }}
COMPOSER_TOKEN: ${{ secrets.ACCESS_TOKEN_GITHUB }}
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{secrets.ACCESS_TOKEN_GITHUB}}"} }' # [tl! **]
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN_GITHUB }}
on:
push:
branches: [ "master", "develop", "feature/da_add_la_basepackage"]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build from Dockerfile
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: fsw-openshift
tags: latest develop
dockerfiles: |
./openshift/openshift.dockerfile
- name: Push to registry
id: push-image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}
34 changes: 34 additions & 0 deletions .github/workflows/docker-image-Nginx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Docker Image Nginx
env:
# 🖊️ EDIT to change the image registry settings.
# Registries such as GHCR, Quay.io, and Docker Hub are supported.
IMAGE_REGISTRY: ghcr.io/utrechtuniversity
IMAGE_REGISTRY_USER: ${{ github.actor }}
IMAGE_REGISTRY_PASSWORD: ${{ github.token }}
on:
push:
branches: [ "master", "develop", "feature/da_opschonen" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: Nginx
tags: latest
dockerfiles: |
./openshift/nginx.dockerfile
- name: Push to registry
id: push-image
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_REGISTRY_USER }}
password: ${{ env.IMAGE_REGISTRY_PASSWORD }}
18 changes: 0 additions & 18 deletions .github/workflows/docker-image.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
# Or, perform a source-to-image build using https://github.com/redhat-actions/s2i-build
# Otherwise, point this to your Dockerfile/Containerfile relative to the repository root.
dockerfiles: |
./docker/backend.dockerfile
./openshift/openshift.dockerfile
# https://github.com/redhat-actions/push-to-registry#readme
- name: Push to registry
Expand Down
36 changes: 36 additions & 0 deletions DEMO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
## DEMO FSW-Openshift

https://docs.cp.its.uu.nl/

https://github.com/UtrechtUniversity/containerplatform-docs

`sshuttle --r shell 131.211.0.0/16`

https://console.cp.its.uu.nl/

https://github.com/UtrechtUniversity/FSW-Openshift

https://github.com/UtrechtUniversity/FSW-Openshift/pkgs/container/fsw-openshift

https://github.com/UtrechtUniversity/wordpress-example-app

local testing:
https://www.redhat.com/sysadmin/codeready-containers
Console:
https://console-openshift-console.apps-crc.testing



CNAME ingress.cp.its.uu.nl
solid.net.uu.nl

wp.openshift.fss.uu.nl
app.openshift.fss.uu.nl
laravel.openshift.fss.uu.nl

registry.cp.its.uu.nl

app grouperen met labels.

desktop init: https://medium.com/@bisinet/simplify-application-dockerization-with-docker-init-6bc4c99db26f

69 changes: 12 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,21 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
## About FSW-Openshift

<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
A first default laravel project with openshift.

## About Laravel
local testing:
https://www.redhat.com/sysadmin/codeready-containers

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
`crc start -p /<path-to-the-pull-secret-file>/pull-secret.txt`

- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Soms wil hij niet starten, dan moet je de vm verwijderen en opnieuw starten:
`crc cleanup`

Laravel is accessible, powerful, and provides tools required for large, robust applications.

## Learning Laravel
### Local development:
Add the following to your /etc/hosts file:

Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
``` 127.0.0.1 openshift.docker.dev```

You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
run the following command in the root of the project:

If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

## Laravel Sponsors

We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).

### Premium Partners

- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**

## Contributing

Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).

## Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).

## Security Vulnerabilities

If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [[email protected]](mailto:[email protected]). All security vulnerabilities will be promptly addressed.

## License

The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
```docker compose up -d --build```
137 changes: 137 additions & 0 deletions app/Http/Helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<?php

if (! function_exists('getCountriesByIso')) {

function getCountriesByIso()
{
$fileContents = file(storage_path('app/country_list.csv'));
foreach ($fileContents as $line) {
$tempLine = str_getcsv($line);
$tempLine[0] = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $tempLine[0]);
$data[$tempLine[0]] = [
$tempLine[0],
$tempLine[1],
$tempLine[2],
$tempLine[3],
];
}

return $data;
}
}

if (! function_exists('getCountriesByName')) {
function getCountriesByName()
{
$fileContents = file(storage_path('app/country_list.csv'));

foreach ($fileContents as $line) {
$tempLine = str_getcsv($line);
$tempLine[0] = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $tempLine[0]);
$data[$tempLine[1]] = [
$tempLine[0],
$tempLine[1],
$tempLine[2],
$tempLine[3],
];
}

return $data;
}
}

if (! function_exists('csvToArray')) {
function csvToArray($filename = '', $headers = null, $delimiter = ';')
{
if (! file_exists($filename) || ! is_readable($filename)) {
return false;
}

$data = [];
if (($handle = fopen($filename, 'r')) !== false) {
$headerSet = false;
while (($row = fgetcsv($handle, 1000, $delimiter)) !== false) {
if (empty($headers) && ! $headerSet) {
$headers = $row;
$headerSet = true;

continue;
}
$data[] = array_combine($headers, $row);
}
fclose($handle);
}

return $data;
}
}

if (! function_exists('get_flag_for_locale')) {
function get_flag_for_locale($locale): string
{
switch ($locale) {
case 'en':
return 'gb';
case 'nl':
return 'nl';
case 'fr':
return 'fr';
default:
return 'sr';
}
}
}

if (! function_exists('printWithQuestionOptions')) {
function printWithQuestionOptions($text, $replace, $key = null): string
{
if (is_array($replace) && isset($replace[$key])) {
$replace = $replace[$key];
}
if (empty($replace)) {
$replace = '';
}
return str_replace(':questionOptions', $replace, $text);
}
}

if (! function_exists('echoArray')) {
function echoArray($text): string
{
$print = '';
if (! is_array($text)) {

return $print;

return $text;
}

foreach ($text as $line) {
$print .= $line.'<br>';
}

return $print;
}
}

//if (! function_exists('compareVariables')) {
// function compareVariables($value1, $operator, $value2): string
// {
// switch ($operator) {
// case '<':
// return $value1 < $value2;
// case '<=':
// return $value1 <= $value2;
// case '>':
// return $value1 > $value2;
// case '>=':
// return $value1 >= $value2;
// case '==':
// return $value1 == $value2;
// case '!=':
// return $value1 != $value2;
// default:
// return false;
// }
// }
//}
38 changes: 38 additions & 0 deletions app/Models/Role.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

/**
* Created by Reliese Model.
*/

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
* Class Role
*
* @property int $id
* @property string $name
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Collection|User[] $users
*/
class Role extends Model
{
protected $table = 'roles';

const USER = 1;

const ADMINISTRATOR = 2;

protected $fillable = [
'name',
];

public function users()
{
return $this->hasMany(User::class);
}
}
Loading

0 comments on commit 7a5b271

Please sign in to comment.