Skip to content

Commit ea4ce6c

Browse files
authored
Update README.md
Updated readme for postgresql usage.
1 parent 632f0a5 commit ea4ce6c

1 file changed

Lines changed: 39 additions & 5 deletions

File tree

docker/README.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Table of Contents
3131
* [Build image for development](#build-image-for-development)
3232
* [How to use docker to develop CodeCompass](#how-to-use-docker-to-develop-codecompass)
3333
* [Build, install and test CodeCompass](#build-install-and-test-codecompass)
34+
* [Make a Postgresql container](#make-a-postgresql-container)
35+
* [Create a network and connect CodeCompass and Postgres](#create-a-network-and-connect-codecompass)
36+
* [Create a Postgres user](#create-a-postgres-user)
3437
* [How to parse a project](#how-to-parse-a-project)
3538
* [How to start a webserver](#how-to-start-a-webserver)
3639
* [Deployment](#deployment)
@@ -60,7 +63,7 @@ First, you have to start a docker container from this image, which will mount
6063
your CodeCompass directory from your host and starts a shell:
6164
```bash
6265
docker run --rm -ti \
63-
--env DATABASE=sqlite --env BUILD_TYPE=Release \
66+
--env DATABASE=pgsql --env BUILD_TYPE=Release \
6467
--volume /path/to/host/CodeCompass:/CodeCompass \
6568
--volume /path/to/your/host/project:/projects/myproject \
6669
-p 8001:8080 \
@@ -77,6 +80,7 @@ have to mount a project directory if you do not want to parse it later.
7780
### Build, install and test CodeCompass
7881
You can use the `codecompass-build.sh` script inside the container to build,
7982
install and test CodeCompass:
83+
(If you get a timeout error when downloading, put this command before install: NODE_OPTIONS="--max-old-space-size=4096" NEXT_PRIVATE_BUILD_WORKER_TIMEOUT=600)
8084
```bash
8185
# Build CodeCompass.
8286
codecompass-build.sh -j8
@@ -88,25 +92,55 @@ codecompass-build.sh install
8892
codecompass-build.sh test
8993
```
9094

95+
### Make a Postgresql container
96+
You need to create a PostgreSQL container that CodeCompass can communicate with.
97+
(postgres is the image name and :15 is the specific version)
98+
```bash
99+
docker run \
100+
--name postgres_container \
101+
-e POSTGRES_PASSWORD=root_password \
102+
-d \
103+
-p 5432:5432 \
104+
postgres:15
105+
```
106+
107+
### Create a network and connect CodeCompass and Postgres
108+
Run the containers and connect them to a nework
109+
```bash
110+
docker network create my_network
111+
docker network connect my_network postgres_name
112+
docker network connect my_network codecompass_container
113+
```
114+
### Create a Postgres user
115+
You need to create a Postgres user and give it admin rights.
116+
(Run these commands from the host computer)
117+
```bash
118+
# 1. Create user "your_user" with password "your_password"
119+
docker exec -it postgres_container psql -U postgres -d postgres -c "CREATE USER your_user WITH PASSWORD 'your_password';"
120+
121+
# 2. Adunk neki Superuser jogot (hogy biztosan tudjon adatbázist írni/olvasni)
122+
docker exec -it postgres_container psql -U postgres -d postgres -c "ALTER USER your_user WITH SUPERUSER;"
123+
```
124+
91125
### How to parse a project
92126
You can parse a project inside a docker container by using the following
93127
command:
128+
(The project must be built before parsing.)
94129
```bash
95130
CodeCompass_parser \
96-
-d "sqlite:database=/CodeCompass/workspace/myproject/data.sqlite" \
131+
-d "pgsql:database=myproject;host=codecompass-postgres;port=5432;user=your_user;password=your_password" \
97132
-w /CodeCompass/workspace \
98133
-n myproject \
99134
-i /projects/myproject
135+
-b /projects/myproject/projectname/bin/Debug \
136+
-f
100137
```
101138

102139
*Note*: the project directory should be mounted inside the container.
103140

104141
### How to start a webserver
105142
You can start a webserver inside the container by using the following command:
106143
```bash
107-
# Create a workspace directory.
108-
mkdir -p /CodeCompass/workspace
109-
110144
# Run the web server.
111145
CodeCompass_webserver \
112146
-w /CodeCompass/workspace

0 commit comments

Comments
 (0)