Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
.gitignore
node_modules/
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Dockerfile

FROM node:alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
RUN adduser -S app
COPY . .
RUN yarn install
RUN chown -R app /opt/app
USER app
EXPOSE 3000 5555
CMD ["yarn", "dev"]
40 changes: 40 additions & 0 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Calendso (Docker-Compose)

> Note: Make sure you have docker & docker-compose installed on the server / system

## Generating Docker Image

As the Docker Image is not available on Docker Hub yet, you can easily compile using the Dockerfile

```bash
# cd to root directory of Project
cd ..
docker build -t calendso .
```

- Once Docker Image is generated, you can setup your Google API Key.
- Put your Google OAuth2 Credentials JSON into `SECRET_KEY_HERE` of `docker-compose.yml` file

## Start Container / Usage

```bash
docker-compose up -d
```


## Use the following to add new users.
```sh
docker ps

## Copy docker container ID of calends:latest
docker exec -it [CONTAINER_ID] /bin/sh
./startUp.sh
```
> Prisma Studio Started on Port 5555 | CTRL + c to stop & `exit`

## Stop Containers
```bash
docker-compose down
```


26 changes: 26 additions & 0 deletions docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3.7"
services:
postgres:
image: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: p0stgr3s_pass
ports:
- '5432:5432'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to expose this port? The Calendso container will already find the database because of Docker's internal routing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a best practice to document them, for what it's worth. It also helps if you want to use an external postgresql client.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend leaving it there but commented out as it could be a security issue for anyone who adds the compose file to their server and exposes their db port by accident. Docker exposed ports often bypass firewalls too!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rberrelleza, why is it a best practice? In the container on the Docker hub it's probably already mentioned if you want to use it that way. What it does now is use that port (possibly blocking other postgres services) and leave a security risk as @Soneji mentioned.
I should/could have been more clear of my reasoning, but these are the biggest reasons to not expose a port if it's not needed. Postgres isn't a service that needs to communicate with the outside world in this context.

volumes:
- calendso-db:/var/lib/postgresql/data

calendso:
image: calendso
environment:
DATABASE_URL: 'postgresql://postgres:[email protected]:5432'
GOOGLE_API_CREDENTIALS: 'SECRET_KEY_HERE'
depends_on:
- postgres
ports:
- '3000:3000'
- '5555:5555'


volumes:
calendso-db:
2 changes: 2 additions & 0 deletions startUp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npx prisma db push --preview-feature
npx prisma studio