Skip to content

Commit 3cbef3c

Browse files
committed
installation guide for ubuntu
Signed-off-by: dzdidi <[email protected]>
1 parent f958e1f commit 3cbef3c

File tree

2 files changed

+137
-1
lines changed

2 files changed

+137
-1
lines changed

java/INSTALL.md

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Installation guide without docker
2+
3+
## Ubuntu
4+
5+
### Install Java
6+
7+
```sh
8+
sudo apt update
9+
sudo apt install openjdk-17-jdk
10+
java -version
11+
```
12+
13+
### Install and configure PostgreSQL
14+
15+
```sh
16+
sudo apt install postgresql
17+
18+
sudo -u postgres psql
19+
ALTER USER postgres with encrypted password '<password>';
20+
quit
21+
sudo systemctl restart postgresql.service
22+
```
23+
24+
#### Verify
25+
```sh
26+
psql postgresql://postgres:<password>@localhost:5432/postgres`
27+
quit
28+
```
29+
30+
### Install Gradle
31+
32+
```
33+
sudo apt intall unzip
34+
wget https://services.gradle.org/distributions/gradle-8.11.1-bin.zip -P /tmp
35+
sudo mkdir /opt/gradle
36+
sudo unzip -d /opt/gradle /tmp/gradle-8.11.1-bin.zip
37+
export PATH=$PATH:/opt/gradle/gradle-8.11.1/bin
38+
```
39+
40+
### Install Tomcat
41+
42+
```
43+
sudo useradd -m -U -d /opt/tomcat -s /bin/false tomcat
44+
VERSION=10.1.4
45+
wget https://www-eu.apache.org/dist/tomcat/tomcat-10/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz -P /tmp
46+
sudo tar -xf /tmp/apache-tomcat-${VERSION}.tar.gz -C /opt/tomcat/
47+
sudo ln -s /opt/tomcat/apache-tomcat-${VERSION} /opt/tomcat/latest
48+
sudo chown -R tomcat: /opt/tomcat
49+
sudo sh -c 'chmod +x /opt/tomcat/latest/bin/*.sh'
50+
```
51+
52+
#### Systemd for tomcat
53+
location:
54+
```
55+
/etc/systemd/system/tomcat.service
56+
```
57+
content:
58+
59+
```
60+
[Unit]
61+
Description=Tomcat 10 servlet container
62+
After=network.target
63+
64+
[Service]
65+
Type=forking
66+
67+
User=tomcat
68+
Group=tomcat
69+
70+
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
71+
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom -Djava.awt.headless=true"
72+
73+
Environment="CATALINA_BASE=/opt/tomcat/latest"
74+
Environment="CATALINA_HOME=/opt/tomcat/latest"
75+
Environment="CATALINA_PID=/opt/tomcat/latest/temp/tomcat.pid"
76+
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
77+
78+
ExecStart=/opt/tomcat/latest/bin/startup.sh
79+
ExecStop=/opt/tomcat/latest/bin/shutdown.sh
80+
81+
[Install]
82+
WantedBy=multi-user.target
83+
```
84+
85+
#### Enable and start tomcat
86+
87+
```
88+
sudo systemctl daemon-reload
89+
sudo systemctl enable --now tomcat
90+
sudo systemctl status tomcat
91+
```
92+
93+
### Clone repo
94+
```
95+
git clone https://github.com/lightningdevkit/vss-server.git
96+
cd vss-server/java
97+
```
98+
99+
### Configure by editing password for postgres in this file for the same one used in step 2
100+
```
101+
./app/src/main/resources/application.properties
102+
```
103+
104+
### Build
105+
Note: build command also does tests which are hardcoded to run against containerized posgress, so there will be some errors printed out, if errors are only about tests, then it is fine.
106+
```
107+
gradle wrapper --gradle-version 8.1.1
108+
./gradlew build
109+
```
110+
111+
### Deploy
112+
```
113+
sudo cp app/build/libs/vss-1.0.war /opt/tomcat/latest/webapps/vss.war
114+
```
115+
116+
### Verify deployment
117+
118+
```
119+
curl --data-binary "$(echo "0A0773746F726549641A150A026B3110FFFFFFFFFFFFFFFFFF011A046B317631" | xxd -r -p)" http://localhost:8080/vss/putObjects
120+
121+
curl --data-binary "$(echo "0A0773746F7265496412026B31" | xxd -r -p)" http://localhost:8080/vss/getObject
122+
```
123+
124+
### Enable vss in nginx by adding:
125+
```
126+
location /vss/ {
127+
proxy_pass http://localhost:8080/vss/;
128+
}
129+
```
130+
131+
Restart nginx and try previous step from the external host machine

java/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ This directory hosts the Java-based implementation of the Versioned Storage Serv
99
- Install Docker (https://docs.docker.com/desktop/).
1010
- Install PostgreSQL 15 (https://www.postgresql.org/download/).
1111

12+
13+
### Installation without docker
14+
15+
see [here](./INSTALL.md)
16+
1217
### Building
1318

1419
```
@@ -46,7 +51,7 @@ gradle wrapper --gradle-version 8.1.1
4651
4752
#### To run just the VSS-server:
4853
49-
1. **Edit Configuration**: Modify the Dockerfile or application.properties to set application configurations and
54+
1. **Edit Configuration**: Modify the Dockerfile or `./app/src/main/resources/application.properties` to set application configurations and
5055
environment variables as needed. Add PostgreSQL endpoint configuration.
5156
2. Create table in PostgreSQL using `./app/src/main/java/org/vss/impl/postgres/sql/`
5257
3. **Build the Docker Image**:

0 commit comments

Comments
 (0)