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

Feature/da opschonen #3

Merged
merged 36 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
37633d2
Cleanup.
dasscheman Jun 21, 2024
d4972e6
Use nginx on openshift.
dasscheman Jun 21, 2024
a00b900
syntax error.
dasscheman Jun 21, 2024
7878b41
Testing.
dasscheman Jun 21, 2024
b729be2
Correct tittle.
dasscheman Jun 21, 2024
654fcf0
Testing.
dasscheman Jun 21, 2024
3811a90
Testing.
dasscheman Jun 21, 2024
a3a9f77
Testing.
dasscheman Jun 21, 2024
74313cd
Testing.
dasscheman Jun 21, 2024
f57127d
Testing.
dasscheman Jun 21, 2024
a2f1330
Testing.
dasscheman Jun 21, 2024
9316834
Testing.
dasscheman Jun 21, 2024
c7c79e6
Testing.
dasscheman Jun 21, 2024
d5d7e0b
Testing.
dasscheman Jun 21, 2024
c678d74
testing port numbers.
dasscheman Jun 24, 2024
4f0873a
testing port numbers.
dasscheman Jun 24, 2024
ea68a2a
testing port numbers.
dasscheman Jun 24, 2024
d22373a
Remove database credentials
dasscheman Jun 24, 2024
441f655
Add database credentials
dasscheman Jun 24, 2024
abef788
Add database credentials
dasscheman Jun 24, 2024
f9ab309
Add database credentials
dasscheman Jun 24, 2024
b063ac7
Export database credentials to env
dasscheman Jun 25, 2024
1ba3ba1
Export database credentials to env TYPO
dasscheman Jun 25, 2024
37aeaac
Export database credentials to env WIP
dasscheman Jun 25, 2024
6129a00
Export database credentials to env WIP
dasscheman Jun 25, 2024
2e4a48c
Export database credentials to env WIP
dasscheman Jun 25, 2024
3f51934
Export database credentials to env WIP
dasscheman Jun 25, 2024
2965d6e
Export database credentials to env WIP 2
dasscheman Jun 25, 2024
dfff02a
Export database credentials to env WIP 3
dasscheman Jun 25, 2024
55bf548
Export database credentials to env WIP 4
dasscheman Jun 25, 2024
d351a64
Export database credentials to env WIP 4
dasscheman Jun 25, 2024
ecc66b0
Export database credentials to env WIP 5
dasscheman Jun 25, 2024
51b3959
Export database credentials to env WIP 6
dasscheman Jun 25, 2024
2bbf814
Export database credentials to env WIP 7
dasscheman Jun 25, 2024
1b46562
Export database credentials to env WIP 8
dasscheman Jun 25, 2024
13300a3
Removed obsolete code.
dasscheman Jun 25, 2024
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
34 changes: 34 additions & 0 deletions .github/workflows/docker-image-Laravel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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 }}
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 from Dockerfile
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: fsw-openshift
tags: latest
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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ https://www.redhat.com/sysadmin/codeready-containers

Soms wil hij niet starten, dan moet je de vm verwijderen en opnieuw starten:
`crc cleanup`


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

``` 127.0.0.1 openshift.docker.dev```

run the following command in the root of the project:

```docker compose up -d --build```
10 changes: 5 additions & 5 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'host' => env('DB_HOST', getenv('LARAVEL_DATABASE_HOST')),
'database' => env('DB_DATABASE', getenv('LARAVEL_DATABASE_NAME')),
'username' => env('DB_USERNAME', getenv('LARAVEL_DATABASE_USER')),
'password' => env('DB_PASSWORD', getenv('LARAVEL_DATABASE_PASSWORD')),
'port' => env('DB_PORT', getenv('LARAVEL_DATABASE_PORT_NUMBER')),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
Expand Down
26 changes: 12 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ services:
container_name: openshift_frontend
build:
dockerfile: docker/frontend.dockerfile
args:
- APP_ENV=local
environment:
- APP_ENV=local
volumes:
- ./:/var/www/public
working_dir: /var/www/public
Expand All @@ -33,17 +33,15 @@ services:
context: ./
dockerfile: docker/nginx.dockerfile
environment:
- VIRTUAL_HOST=app.openshift.fss.uu.nl
- VIRTUAL_PROTO=http
- VIRTUAL_PORT=80
- NGINX_HOST=app.openshift.fss.uu.nl
- NGINX_PORT=8080
- VIRTUAL_HOST=openshift.docker.dev
- VIRTUAL_PROTO=http
- VIRTUAL_PORT=80
volumes:
- ./:/var/www
- ./storage/logs/:/var/log/nginx
- ./:/var/www
- ./storage/logs/:/var/log/nginx
networks:
- default
- hts-appteam-local-dev
- default
- hts-appteam-local-dev
mariadb:
hostname: openshift_mariadb.docker.dev
container_name: openshift_mariadb
Expand All @@ -56,8 +54,8 @@ services:
MYSQL_USER: "development"
MYSQL_PASSWORD: "secret"
networks:
- default
- hts-appteam-local-dev
- default
- hts-appteam-local-dev
networks:
hts-appteam-local-dev:
external: true
external: true
15 changes: 3 additions & 12 deletions docker/backend-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
#!/usr/bin/env bash
echo " ⭐️️️️️⭐️️️️️⭐️️️️️⭐️ VERSIE: 1 "
# run artisan migrate & seed
ls -la /var/www
#if [ "$APP_ENV" = "local" ]; then
# ## in de dockerfile worden de dev packages verwijderd, dus die moeten we eerst installeren
# php composer.phar install
echo "⭐️ Run artisan migrate";
php artisan migrate --seed

echo "⭐️ Run artisan migrate";
php artisan migrate --seed

# echo "⭐️ generate key";
# php artisan key:generate
#fi
php artisan serve --host=0.0.0.0 --port=8080
php-fpm
php-fpm
8 changes: 4 additions & 4 deletions docker/backend.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ RUN apt-get -y dist-upgrade
RUN apt-get install -y zip

RUN apt-get install -y sudo nano
RUN apt-get install -y mariadb-client

# install mysql
RUN docker-php-ext-install pdo_mysql mysqli

# install additional PHP extensions
RUN apt-get install -y libmcrypt-dev \
Expand Down Expand Up @@ -50,10 +54,6 @@ RUN chmod ugo+x /entrypoint.sh

RUN php artisan optimize

# Expose port 8443 and start php-fpm server
EXPOSE 8080

ENTRYPOINT /entrypoint.sh

CMD ["php-fpm"]

4 changes: 2 additions & 2 deletions docker/docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ APP_NAME=Openshift
APP_ENV=acceptance
APP_KEY=
APP_DEBUG=true
APP_URL=https://app.openshift.fss.uu.nl/
APP_URL=http://openshift.docker.dev

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mariadb-sample
DB_HOST=mariadb
DB_PORT=3306
DB_DATABASE=development
DB_USERNAME=development
Expand Down
6 changes: 2 additions & 4 deletions docker/frontend-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env sh

if [ "$APP_ENV" = "local" ]; then
echo "⭐️ Start dev server"
npm run dev
fi
echo "⭐️ Start dev server"
npm run dev
8 changes: 0 additions & 8 deletions docker/mariadb.dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions docker/nginx-entrypoint.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docker/vhost.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ type: Opaque
data:
# Use the following command to generate a random password:
# echo -n 'ChangeThisSuperSecretPassword' | base64
mariadb-root-password: c2VjcmV0
mariadb-password: c2VjcmV0
mariadb-root-password: <mariadb-root-password>
mariadb-password: <mariadb-password>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ kind: ConfigMap
metadata:
name: mariadb-config
data:
mariadb-database: development
mariadb-user: development
mariadb-database: sample-database
mariadb-user: sample-database-user
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
apiVersion: v1
kind: Service
metadata:
Expand Down
10 changes: 10 additions & 0 deletions openshift/config/05_sample-app-cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-config
data:
database-type: mysql
database-host: mariadb-sample
database-port-number: '3306'
database-name: sample-database
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ spec:
containers:
- name: sample-app
image: ghcr.io/utrechtuniversity/fsw-openshift:latest
# image: bitnami/laravel:latest
ports:
- containerPort: 8080
- containerPort: 9000
env:
- name: LARAVEL_DATABASE_TYPE
valueFrom:
Expand All @@ -42,11 +41,6 @@ spec:
configMapKeyRef:
name: sample-config
key: database-name
# - name: LARAVEL_STORAGE_PATH
# valueFrom:
# configMapKeyRef:
# name: sample-config
# key: laravel-storage
- name: LARAVEL_DATABASE_USER
valueFrom:
configMapKeyRef:
Expand All @@ -57,19 +51,3 @@ spec:
secretKeyRef:
name: mariadb-secret
key: mariadb-password
---
apiVersion: v1
kind: Service
metadata:
name: fsw-sample-app
labels:
app: fsw-sample-app
app.kubernetes.io/part-of: fsw-sample-app
spec:
selector:
app: fsw-sample-app
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
13 changes: 13 additions & 0 deletions openshift/config/07_sample-svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: sample-app
labels:
app: fsw-sample-app
app.kubernetes.io/part-of: fsw-sample-app
spec:
ports:
- port: 9000
targetPort: 9000
selector:
app: sample-app
22 changes: 22 additions & 0 deletions openshift/config/08_nginx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
labels:
app: fsw-nginx
app.kubernetes.io/part-of: fsw-sample-app
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: ghcr.io/utrechtuniversity/nginx:latest
ports:
- containerPort: 8080
Loading
Loading