diff --git a/.github/workflows/docker-image-Laravel.yml b/.github/workflows/docker-image-Laravel.yml new file mode 100644 index 0000000..4b02441 --- /dev/null +++ b/.github/workflows/docker-image-Laravel.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/docker-image-Nginx.yml b/.github/workflows/docker-image-Nginx.yml new file mode 100644 index 0000000..f6cfed7 --- /dev/null +++ b/.github/workflows/docker-image-Nginx.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index ba997dc..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -jobs: - - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build the Docker image - run: docker build . --file docker/backend.dockerfile --tag my-image-name:$(date +%s) diff --git a/.github/workflows/openshift.yml b/.github/workflows/openshift.yml index 455cec1..b64ebd1 100644 --- a/.github/workflows/openshift.yml +++ b/.github/workflows/openshift.yml @@ -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 diff --git a/README.md b/README.md index 8e12e1e..d442926 100644 --- a/README.md +++ b/README.md @@ -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``` diff --git a/config/database.php b/config/database.php index 137ad18..e09b53f 100644 --- a/config/database.php +++ b/config/database.php @@ -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', diff --git a/docker-compose.yml b/docker-compose.yml index c3955cf..8ad394d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/docker/backend-entrypoint.sh b/docker/backend-entrypoint.sh index a2608b1..ed4cdf1 100644 --- a/docker/backend-entrypoint.sh +++ b/docker/backend-entrypoint.sh @@ -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 \ No newline at end of file diff --git a/docker/backend.dockerfile b/docker/backend.dockerfile index 9fff760..d1eb1f1 100644 --- a/docker/backend.dockerfile +++ b/docker/backend.dockerfile @@ -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 \ @@ -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"] - diff --git a/docker/docker.env b/docker/docker.env index 3c8a98e..698d740 100644 --- a/docker/docker.env +++ b/docker/docker.env @@ -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 diff --git a/docker/frontend-entrypoint.sh b/docker/frontend-entrypoint.sh index dad7df4..a1231a5 100644 --- a/docker/frontend-entrypoint.sh +++ b/docker/frontend-entrypoint.sh @@ -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 diff --git a/docker/mariadb.dockerfile b/docker/mariadb.dockerfile deleted file mode 100644 index 80f17ea..0000000 --- a/docker/mariadb.dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM mariadb:latest - -# entrypoint -COPY ./docker/frontend-entrypoint.sh /frontend-entrypoint.sh -RUN chmod ugo+x /frontend-entrypoint.sh -RUN dos2unix /frontend-entrypoint.sh - -ENTRYPOINT /frontend-entrypoint.sh diff --git a/docker/nginx-entrypoint.sh b/docker/nginx-entrypoint.sh deleted file mode 100644 index ee5b699..0000000 --- a/docker/nginx-entrypoint.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env sh - -NOT USED FOR NOW -#echo " ⭐️️️️️copy conf file" -#ls -la -##if [ "$APP_ENV" = "local" ]; then -## cp /var/www/docker/vhost.conf /etc/nginx/conf.d/default.conf -##fi -#systemctl status nginx -#systemctl start nginx diff --git a/docker/vhost.conf b/docker/vhost.conf index 555b965..559435a 100644 --- a/docker/vhost.conf +++ b/docker/vhost.conf @@ -17,4 +17,4 @@ server { fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; } -} +} \ No newline at end of file diff --git a/openshift/sample/1_mariadb-secret.yaml b/openshift/config/01_mariadb-secret.yaml similarity index 69% rename from openshift/sample/1_mariadb-secret.yaml rename to openshift/config/01_mariadb-secret.yaml index abe9f6d..01f4870 100644 --- a/openshift/sample/1_mariadb-secret.yaml +++ b/openshift/config/01_mariadb-secret.yaml @@ -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-password: diff --git a/openshift/sample/2_mariadb-cm.yaml b/openshift/config/02_mariadb-cm.yaml similarity index 50% rename from openshift/sample/2_mariadb-cm.yaml rename to openshift/config/02_mariadb-cm.yaml index 812d7e4..0ec1bed 100644 --- a/openshift/sample/2_mariadb-cm.yaml +++ b/openshift/config/02_mariadb-cm.yaml @@ -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 diff --git a/openshift/sample/3_mariadb-statefulset.yaml b/openshift/config/03_mariadb-statefulset.yaml similarity index 100% rename from openshift/sample/3_mariadb-statefulset.yaml rename to openshift/config/03_mariadb-statefulset.yaml diff --git a/openshift/sample/4_mariadb-svc.yaml b/openshift/config/04_mariadb-svc.yaml similarity index 98% rename from openshift/sample/4_mariadb-svc.yaml rename to openshift/config/04_mariadb-svc.yaml index 80e18ac..e6bac8f 100644 --- a/openshift/sample/4_mariadb-svc.yaml +++ b/openshift/config/04_mariadb-svc.yaml @@ -1,4 +1,3 @@ ---- apiVersion: v1 kind: Service metadata: diff --git a/openshift/config/05_sample-app-cm.yaml b/openshift/config/05_sample-app-cm.yaml new file mode 100644 index 0000000..7356fb7 --- /dev/null +++ b/openshift/config/05_sample-app-cm.yaml @@ -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 \ No newline at end of file diff --git a/openshift/sample/6_sample-app.yaml b/openshift/config/06_sample-app.yaml similarity index 74% rename from openshift/sample/6_sample-app.yaml rename to openshift/config/06_sample-app.yaml index 02ff18d..752ede0 100644 --- a/openshift/sample/6_sample-app.yaml +++ b/openshift/config/06_sample-app.yaml @@ -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: @@ -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: @@ -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 ---- diff --git a/openshift/config/07_sample-svc.yaml b/openshift/config/07_sample-svc.yaml new file mode 100644 index 0000000..b1a686f --- /dev/null +++ b/openshift/config/07_sample-svc.yaml @@ -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 diff --git a/openshift/config/08_nginx.yaml b/openshift/config/08_nginx.yaml new file mode 100644 index 0000000..2fa2176 --- /dev/null +++ b/openshift/config/08_nginx.yaml @@ -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 \ No newline at end of file diff --git a/openshift/config/09_nginx-svc.yaml b/openshift/config/09_nginx-svc.yaml new file mode 100644 index 0000000..0457b3e --- /dev/null +++ b/openshift/config/09_nginx-svc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx + labels: + app: fsw-sample-app + app.kubernetes.io/part-of: fsw-sample-app +spec: + selector: + app: nginx + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 \ No newline at end of file diff --git a/openshift/sample/7_sample-ingress.yaml b/openshift/config/10_sample-ingress.yaml similarity index 79% rename from openshift/sample/7_sample-ingress.yaml rename to openshift/config/10_sample-ingress.yaml index f05c4d1..1a93e55 100644 --- a/openshift/sample/7_sample-ingress.yaml +++ b/openshift/config/10_sample-ingress.yaml @@ -5,6 +5,7 @@ metadata: namespace: uu-0219959 annotations: cert-manager.io/cluster-issuer: sectigo + haproxy.router.openshift.io/ip_whitelist: "131.211.0.0/16" spec: tls: - hosts: @@ -18,6 +19,6 @@ spec: pathType: Prefix backend: service: - name: sample-app + name: nginx port: - number: 80 + number: 8080 diff --git a/openshift/nginx.dockerfile b/openshift/nginx.dockerfile new file mode 100644 index 0000000..12c65e7 --- /dev/null +++ b/openshift/nginx.dockerfile @@ -0,0 +1,8 @@ +FROM nginxinc/nginx-unprivileged:stable-alpine + +ADD ./openshift/vhost.conf /etc/nginx/conf.d/default.conf + +# Expose port 8443 and start php-fpm server +EXPOSE 8080 + +#CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/openshift/openshift-entrypoint.sh b/openshift/openshift-entrypoint.sh new file mode 100644 index 0000000..1d9697c --- /dev/null +++ b/openshift/openshift-entrypoint.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +echo " ⭐️️️️️⭐️️️️️⭐️️️️️⭐️ VERSIE: 1 " + +php artisan config:clear + +# run artisan migrate & seed +echo "⭐️ Run artisan migrate"; +php artisan migrate --seed +##composer install --no-dev --no-scripts +npm run build + +#php artisan serve --host=0.0.0.0 --port=8080 +php-fpm diff --git a/openshift/openshift.dockerfile b/openshift/openshift.dockerfile new file mode 100644 index 0000000..49a19f7 --- /dev/null +++ b/openshift/openshift.dockerfile @@ -0,0 +1,58 @@ +FROM php:8.2-fpm + +COPY composer.lock composer.json /var/www/ +# set workdir +WORKDIR /var/www + +# upgrades! +RUN apt-get update +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 \ + libmagickwand-dev --no-install-recommends \ + && pecl install mcrypt-1.0.7 \ + && docker-php-ext-install pdo_mysql \ + && docker-php-ext-enable mcrypt + +RUN apt-get clean -y + +# set corrent TimeZone +ENV TZ=Europe/Amsterdam +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# copy webapp files +COPY .. /var/www + +# install composer +RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer +# run composer + +RUN composer install + +COPY ./openshift/openshift.env /var/www/.env + +RUN chmod -R a+rw /var/www/storage +RUN chmod -R a+rw /var/www/bootstrap/cache +RUN php artisan key:generate + +# entrypoint +COPY ./openshift/openshift-entrypoint.sh /entrypoint.sh +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"] + diff --git a/openshift/openshift.env b/openshift/openshift.env new file mode 100644 index 0000000..ca1c81b --- /dev/null +++ b/openshift/openshift.env @@ -0,0 +1,54 @@ +APP_NAME=Openshift +APP_ENV=acceptance +APP_KEY= +APP_DEBUG=true +APP_URL=https://app.openshift.fss.uu.nl/ + +LOG_CHANNEL=stack +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=mysql + +BROADCAST_DRIVER=log +CACHE_DRIVER=file +FILESYSTEM_DISK=local +QUEUE_CONNECTION=sync +SESSION_DRIVER=file +SESSION_LIFETIME=120 + +MEMCACHED_HOST=127.0.0.1 + +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=smtp +MAIL_HOST=mailpit +MAIL_PORT=1025 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_ENCRYPTION=null +MAIL_FROM_ADDRESS="hello@example.com" +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +PUSHER_APP_ID= +PUSHER_APP_KEY= +PUSHER_APP_SECRET= +PUSHER_HOST= +PUSHER_PORT=443 +PUSHER_SCHEME=https +PUSHER_APP_CLUSTER=mt1 + +VITE_APP_NAME="${APP_NAME}" +VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" +VITE_PUSHER_HOST="${PUSHER_HOST}" +VITE_PUSHER_PORT="${PUSHER_PORT}" +VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" +VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" diff --git a/openshift/sample/5_sample-app-cm.yaml b/openshift/sample/5_sample-app-cm.yaml deleted file mode 100644 index 7ad0928..0000000 --- a/openshift/sample/5_sample-app-cm.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: sample-config -data: - database-type: mysql - database-host: mariadb-sample - database-port-number: '3306' - database-name: development -# laravel-storage: /var/www/laravel/ -# wordpress-enable-https: 'yes' -# wordpress-enable-reverse-proxy: 'yes' - # Change the following to your blog name, email, first name and last name \ No newline at end of file diff --git a/openshift/scripts/sample-app.sh b/openshift/scripts/sample-app.sh index 1ac26d9..788e01b 100755 --- a/openshift/scripts/sample-app.sh +++ b/openshift/scripts/sample-app.sh @@ -9,21 +9,44 @@ # Function to create the list of resource yamls create_app() { - search_dir=../sample + search_dir=../config for entry in "$search_dir"/* do - echo "$entry" - oc apply -f $entry + filename=$(basename -- "$entry") + if [ -f ../temp/"$filename" ]; then + echo "Use previously made file with credentials" + oc apply -f ../temp/"$filename" + continue + fi + + echo "Check for file with credential" + match=$(grep -o \<.*\> "$entry" | wc -l) + if [ "$match" -ne "0" ]; then + echo "Found credentials in file" + # TODO: Create loop and ceck ninimal length of password + word1=$(shuf -n1 /usr/share/dict/american-english | sed "s/'//g") + word2=$(shuf -n1 /usr/share/dict/american-english | sed "s/'//g") + word3=$(shuf -n1 /usr/share/dict/american-english | sed "s/'//g") + word="${word1}-${word2}-${word3}" + echo "used password: $word for $filename" + hash="$(echo -n $word | base64)" + echo $hash + sed "s/<.*>/"$hash"/g" "$entry" > ../temp/"$filename" + oc apply -f ../temp/"$filename" + continue + fi + echo "$entry" + oc apply -f "$entry" done } # Function to create the list of resource yamls delete_app() { - search_dir=../sample + search_dir=../config for entry in "$search_dir"/* do echo "$entry" - oc delete -f $entry + oc delete -f "$entry" done } diff --git a/openshift/temp/.gitignore b/openshift/temp/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/openshift/temp/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/openshift/vhost.conf b/openshift/vhost.conf new file mode 100644 index 0000000..89f7c6e --- /dev/null +++ b/openshift/vhost.conf @@ -0,0 +1,20 @@ +server { + listen 8080; + server_name app.openshift.fss.uu.nl; + index index.php index.html; + root /var/www/public; + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + location / { + try_files $uri /index.php?$args; + } + + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass sample-app:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } +} \ No newline at end of file