Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from better-docker-dev-prod #137

Draft
wants to merge 1 commit into
base: sdk
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev_database
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{go,sh}]
indent_style = tab

[{Makefile,Caddyfile}]
indent_style = tab

[LICENSE]
trim_trailing_whitespace = false
insert_final_newline = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@

# Dependency directories (remove the comment below to include it)
# vendor/
dev_database/
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:22-alpine AS node
WORKDIR /app

# Download the node dependencies first before adding the rest for caching
COPY ./net/web/package.json ./net/web/yarn.lock ./
RUN yarn --frozen-lockfile

COPY ./net/web/ ./
RUN yarn run build

FROM golang:alpine AS go
EXPOSE 7000
WORKDIR /app/databag

RUN apk add build-base imagemagick sqlite ffmpeg curl

RUN mkdir -p /opt/databag
RUN mkdir -p /var/lib/databag
RUN mkdir -p /app/databag/net

COPY ./net/server /app/databag/net/server
COPY ./net/transform /opt/databag/transform

WORKDIR /app/databag/net/server
RUN go mod download
RUN CGO_ENABLED=1 go build -o databag .

COPY --from=node /app/build /app/databag/net/web/build

ENV DEV=0
ENV ADMIN=password

ENTRYPOINT /app/databag/net/server/entrypoint.sh
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
default:
@grep '^[^#[:space:].].*:' Makefile

dev-start:
docker compose -f docker-compose.dev.yml up -d
dev-stop:
docker compose -f docker-compose.dev.yml down

dev-restart-server:
docker compose -f docker-compose.dev.yml restart net-server
dev-restart-web:
docker compose -f docker-compose.dev.yml restart net-web
dev-restart-repeater:
docker compose -f docker-compose.dev.yml restart net-repeater

prod-docker-start:
docker compose up -d

prod-raw-build:
./build.sh
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,24 @@ The app is available on fdroid as well as the google and apple stores. You can t

To use databag, you will need a DNS name pointing to your node with a certificate. You can deploy a node manually, but you will have a much easier time using a container service. Containers for arm64 and amd64 are available [here](https://hub.docker.com/r/balzack/databag/tags).

### Docker Compose Command
### Docker Compose

From the net/container sub directory:
- sudo docker-compose -f compose.yaml -p databag up
Launch with dockerhub container using docker compose:

#### Standard launch
```shell
# From the net/container sub directory:
docker-compose -f compose.yaml -p databag up
```

#### Launch with certbot https certificate
```shell
# FIRST: create a DNS entry in your DNS to point your desired subdomain to your host
# SECOND: edit the net/container/docker-compose-swag.yml to include your domain name
# THIRD: From the root of the project directory:
mkdir -p ~/appdata
docker-compose -f net/container/docker-compose-swag.yml -p databag up
```

### Example with Portainer and Nginx Proxy Manager

Expand Down Expand Up @@ -154,4 +168,4 @@ If you want to enable audio and video calls, you should setup your own relay ser

### Roadmap

Please let me know any missing features; [here](/doc/backlog.md) is the current backlog. Features are prioritized based on interest from the community.
Please add any missing features; [here](/doc/backlog.md) is the current backlog. Features are prioritized based on interest from the community.
2 changes: 2 additions & 0 deletions app/mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.DS_Store
6 changes: 6 additions & 0 deletions app/mobile/src/api/setCardStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ export async function setCardConnecting(server, token, cardId) {
}

export async function setCardConnected(server, token, cardId, access, view, article, channel, profile) {
const insecure = /^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|:\d+$|$)){4}$/.test(server);
const protocol = insecure ? 'http' : 'https';

let card = await fetchWithTimeout(`${protocol}://${server}/contact/cards/${cardId}/status?agent=${token}&token=${access}&viewRevision=${view}&articleRevision=${article}&channelRevision=${channel}&profileRevision=${profile}`, { method: 'PUT', body: JSON.stringify('connected') } );
checkResponse(card);
return await card.json();
}

export async function setCardConfirmed(server, token, cardId) {
const insecure = /^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|:\d+$|$)){4}$/.test(server);
const protocol = insecure ? 'http' : 'https';

let card = await fetchWithTimeout(`${protocol}://${server}/contact/cards/${cardId}/status?agent=${token}`, { method: 'PUT', body: JSON.stringify('confirmed') } );
checkResponse(card);
return await card.json();
Expand Down
Loading