|
|
|
|
|
## The following steps must be done to setup the development or production environment
|
|
|
|
|
|
### FileHooks
|
|
|
SetUp Filehooks (Reference to filehooks documentation)
|
|
|
|
|
|
## Automatic way:
|
|
|
|
|
|
### Pipeline
|
|
|
|
|
|
You can deploy both the staging environment and the production environment via a manual pipeline step. All you have to do is go to CI/CD -> Pipelines -> Select the commit you want to deploy and click on the deploy step after all the tests have passed
|
|
|
|
|
|
### Script
|
|
|
|
|
|
You can use the following script, which loads all the necessary environment variables form src/main/docker/.env:
|
|
|
|
|
|
[Here](https://sharing-codeability.uibk.ac.at/sharing/codeability-sharing-platform/-/blob/development/manual_deploy.sh)
|
|
|
|
|
|
|
|
|
|
|
|
## Manual way:
|
|
|
|
|
|
### GitSearch (Staging)
|
|
|
|
|
|
- ssh into the codeability-austria server using the following account: `ssh contDeploy@codeability-austria -p 1022`
|
|
|
- Go to the gitsearch directory: `cd /home/contDeploy/gitsearch2/gitsearch/`
|
|
|
- Set the environment variable for which branch you want to deploy: export GITBRANCH=<ENTER BRANCH>
|
|
|
- Stash possible current changes, checkout the branch you want to deploy and pull the changes: `git fetch && git stash && git checkout $BRANCH && git pull`
|
|
|
- _Remark:_ Set the CI_BUILD_TOKEN environment variable: The CI_BUILD_TOKEN can be found in the Settings->CI/CD-Settings->Variables of this project.
|
|
|
- Sometimes it might be necessary to login to the image registry using the following command : `docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN sharing-codeability.uibk.ac.at:5051`
|
|
|
- Create the image of the maven application and push it to the container registry:
|
|
|
``export MAVEN_USER_HOME=`pwd`/.maven && ./mvnw package -DskipTests jib:build -Djib.to.image=sharing-codeability.uibk.ac.at:5051/sharing/codeability-sharing-platform/gitsearch/$BRANCH -Djib.to.auth.username=gitlab-ci-token -Djib.to.auth.password=$CI_BUILD_TOKEN -Dmaven.repo.local=$MAVEN_USER_HOME``
|
|
|
- Change into the docker directory: `cd src/main/docker/`
|
|
|
- Pull your previously created image: `docker pull sharing-codeability.uibk.ac.at:5051/sharing/codeability-sharing-platform/gitsearch/$BRANCH`
|
|
|
- Export the wished environment variables: `export SPRING_PROFILES_ACTIVE=staging,swagger`
|
|
|
- Start the docker-compose file of gitsearch using the following command:
|
|
|
` docker-compose -f gitsearch.yml up -d --no-deps --build --force-recreate gitsearch-app`
|
|
|
- The application should be up and running, verify with: `docker logs --follow sharing_search`
|
|
|
|
|
|
### GitSearch (Production)
|
|
|
|
|
|
* ssh into the codeability server using the following account: `ssh contDeploy@sharing-codeability -p 1022`
|
|
|
* Go to the gitsearch directory: `cd /home/contDeploy/gitsearch`
|
|
|
* Activate the environment variables: `cd src/main/docker && source .env`
|
|
|
* Go to the gitsearch directory: `cd /home/contDeploy/gitsearch`
|
|
|
* Stash possible current changes, checkout the branch you want to deploy and pull the changes: `git fetch && git stash && git pull`
|
|
|
* Checkout the branch you want to deploy: `git checkout master`
|
|
|
* _Remark:_ Set the CI_BUILD_TOKEN environment variable: The CI_BUILD_TOKEN can be found in the Settings->CI/CD-Settings->Variables of this project.
|
|
|
* Sometimes it might be necessary to login to the image registry using the following command : `docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN sharing-codeability.uibk.ac.at:5051`
|
|
|
* Create the image of the maven application and push it to the container registry: `` export MAVEN_USER_HOME=`pwd`/.maven && export IMAGE_TAG=sharing-codeability.uibk.ac.at:5051/sharing/codeability-sharing-platform/gitsearch/master && GITBRANCH=master && ./mvnw -Pprod package -DskipTests jib:build -Djib.to.image=$IMAGE_TAG -Djib.to.auth.username=gitlab-ci-token -Djib.to.auth.password=$CI_BUILD_TOKEN -Dmaven.repo.local=$MAVEN_USER_HOME ``
|
|
|
* Change into the docker directory: `cd src/main/docker/`
|
|
|
* Pull your previously created image: `docker pull sharing-codeability.uibk.ac.at:5051/sharing/codeability-sharing-platform/gitsearch/master`
|
|
|
* Start the docker-compose file of gitsearch using the following command: `docker-compose -f gitsearch.yml up -d --no-deps --build --force-recreate gitsearch-app`
|
|
|
* The application should be up and running, verify with: `docker logs --follow sharing_search`
|
|
|
|
|
|
####
|
|
|
|
|
|
The deployment process to development can also be manually triggered via the gitlab ci or run the manual_deploy.sh script: gitsearch/manual_depoy.sh
|
|
|
|
|
|
## Connection to Gitlab
|
|
|
- OAuth-Connection to Sharing Gitlab
|
|
|
- Get AccessToken for Sharing (Admin Area -> Applications -> new Application)
|
|
|
- Select all scopes, trusted, non confidential: Attention: [`#F00`with Gitlab V. 13.12.4 the confidential option must be disabled]
|
|
|
|
|
|

|
|
|
- JWT token secret erzeugen mit ```openssl rand -base64 172 | tr -d '\n'```
|
|
|
- Guest Account (mit minimalen Rechten) anlegen, und personal Access Token generieren:
|
|
|
 |
|
|
\ No newline at end of file |