# yCrash upgrade - best practices
This document summarizes the best practices that one can follow when upgrading to a new version of yCrash.
# Standalone Server Setup (Bare Metal/Virtual Machine)
# 1. Installation Folder
Make sure the folder in which yCrash is installed has its current version number.
Example: if you have downloaded the 'yc-2_0.zip' installation file, then unzip its contents in to the /opt/ycrash/yc-2_0 folder.
# 2. Copy old launch script settings
In the earlier installations, you might have increased the memory size, enabled SSL,... by modifying the settings in launch-yc-server.sh (or launch-yc-server.bat). Make sure you copy these launch script settings from the old version to the new installation.
💡 Tip: Carry out the below steps only if you haven't done so in earlier installations. You don't have to do it in every upgrade.
# 3. Separate Upload Directory
By default, yCrash tool stores all the uploaded dump files in the same directory in which it has been installed. It's best practice to store them in a different directory outside the installed directory, for the following reasons:
a. When you upgrade to a new version of yCrash, you will not lose the historically uploaded incidents.
b. You can allocate sufficient storage for the dumps on a different file mount.
In the launch-yc-server.sh (or launch-yc-server.bat) file there is a -DuploadDir=. property. By default, it points to the current directory. This is the directory where uploaded dump files are stored. Let's say you want to store the dumps in the /opt/ycrash/dumps folder, then specify this new directory path in the property i.e.,
-DuploadDir=/opt/ycrash/dumps
# 4. Separate Log Directory
By default, yCrash tool stores all its logs in the same directory in which it has been installed. It's best practice to store them in a different directory which has sufficient storage.
In the launch-yc-server.sh (or launch-yc-server.bat) file there is a -DlogDir=. property. By default, it points to the current directory. This is the directory where all log files will be stored. Let's say you want to store the logs in the /opt/ycrash/logs folder, then specify this new directory path in the property i.e.,
-DlogDir=/opt/ycrash/logs
# Container Setup (Docker/Podman)
To achieve persistent data storage for both -DlogDir=. and -DuploadDir=. in different mount paths, you can modify the docker run command like this:
docker run -p 8080:8080 \
--name yc-server \
-v $(pwd)/logDir:/opt/workspace/yc/logDir \
-v $(pwd)/uploadDir:/opt/workspace/yc/uploadDir \
-v $(pwd)/license.lic:/opt/workspace/yc/uploadDir/license.lic \
yc-server
2
3
4
5
6
# Explanation:
Log Directory (
-DlogDir):- The logs will be stored in
$(pwd)/logDiron your host machine and will be mapped to/opt/workspace/yc/logDirin the container.
- The logs will be stored in
Upload Directory (
-DuploadDir):- Files uploaded by the application will be stored in
$(pwd)/uploadDiron your host machine and will be mapped to/opt/workspace/yc/uploadDirin the container.
- Files uploaded by the application will be stored in
License File (
license.lic):- The
license.licfile on your host machine is mounted to/opt/workspace/yc/uploadDir/license.licinside the container, making it accessible within the-DuploadDirpath.
- The
# Adjusting the ENTRYPOINT Command:
In your Dockerfile, update the ENTRYPOINT command to reflect the paths:
ENTRYPOINT ["/usr/bin/tini", "--", "java", "-Xms2g", "-Xmx4g", "-Dapp=yc", "-DlogDir=/opt/workspace/yc/logDir", "-DuploadDir=/opt/workspace/yc/uploadDir", "-jar", "webapp-runner.jar", "-AconnectionTimeout=3600000", "--port", "8080", "yc.war"]
This setup ensures that your logs and uploaded files persist across container restarts, and the license.lic file is correctly placed within the upload directory.
# Container Orchestration Setup (Kubernetes/OpenShift)
To keep data persistent when deploying in Kubernetes or OpenShift, you'll need to use PersistentVolume (PV) and PersistentVolumeClaim (PVC) resources to manage your storage. Here’s how you can do it:
# 1. Create PersistentVolumes (PVs)
Define PersistentVolumes that correspond to the storage you want to use for logDir and uploadDir.
apiVersion: v1
kind: PersistentVolume
metadata:
name: logdir-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/data/logdir
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: uploaddir-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/data/uploaddir
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Note: hostPath is used for demonstration. In production, you would typically use network-based storage like NFS, GlusterFS, AWS EBS, etc.
# 2. Create PersistentVolumeClaims (PVCs)
Define PersistentVolumeClaims that request the storage from the corresponding PVs.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: logdir-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: uploaddir-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 3. Update the Deployment
Modify your deployment configuration to mount the PVCs into your container, ensuring the paths match those specified in your Dockerfile.
apiVersion: apps/v1
kind: Deployment
metadata:
name: yc-server
spec:
replicas: 1
selector:
matchLabels:
app: yc-server
template:
metadata:
labels:
app: yc-server
spec:
containers:
- name: yc-server
image: yc-server:latest
ports:
- containerPort: 8080
volumeMounts:
- name: logdir-storage
mountPath: /opt/workspace/yc/logDir
- name: uploaddir-storage
mountPath: /opt/workspace/yc/uploadDir
subPath: license.lic
- name: license
mountPath: /opt/workspace/yc/uploadDir/license.lic
volumes:
- name: logdir-storage
persistentVolumeClaim:
claimName: logdir-pvc
- name: uploaddir-storage
persistentVolumeClaim:
claimName: uploaddir-pvc
- name: license
configMap: # or secret if it's stored as a secret
name: license-config
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 4. Create ConfigMap or Secret for License
If the license file needs to be provided, you can create it as a ConfigMap or Secret:
apiVersion: v1
kind: ConfigMap
metadata:
name: license-config
data:
license.lic: |
# license content here
2
3
4
5
6
7
# 5. Deploy in Kubernetes/OpenShift
Finally, apply the YAML files to your Kubernetes/OpenShift cluster:
kubectl apply -f logdir-pv.yaml
kubectl apply -f uploaddir-pv.yaml
kubectl apply -f logdir-pvc.yaml
kubectl apply -f uploaddir-pvc.yaml
kubectl apply -f deployment.yaml
2
3
4
5
This setup will ensure that the logs and uploaded files persist across pod restarts or rescheduling, and that the license.lic file is correctly placed within the upload directory.
Note:
When running yCrash inside a Docker or containerized environment, always configure -DuploadDir and -DlogDir using absolute paths (such as /opt/workspace/yc/uploads and /opt/workspace/yc/logs) that are backed by writable volumes. Avoid using relative paths (such as .), as the container working directory may not be writable and can cause file upload or logging failures.