Merge pull request 'DebugCompose' (#3) from DebugCompose into main
Reviewed-on: https://git.infra.nkode.tech/dkelly/go-nkode/pulls/3
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ secrets.json
|
|||||||
|
|
||||||
flaticon_svgs
|
flaticon_svgs
|
||||||
flaticon_colored_svgs
|
flaticon_colored_svgs
|
||||||
|
icons
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ VOLUME /app/data/icons
|
|||||||
# Copy go.mod and go.sum files
|
# Copy go.mod and go.sum files
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
|
|
||||||
# Download all dependencies
|
# Download all dependencies
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ RUN go build
|
|||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
#ENV FRONTEND_HOST=https://app.nkode.tech
|
#ENV FRONTEND_HOST=https://app.nkode.tech
|
||||||
ENV FRONTEND_HOST=http://localhost:8090
|
#ENV FRONTEND_HOST=http://localhost:8090
|
||||||
ENV SVG_DIR=/app/data/icons
|
ENV SVG_DIR=/app/data/icons
|
||||||
ENV DB_PATH=/app/data/sqlite/nkode.db
|
ENV DB_PATH=/app/data/sqlite/nkode.db
|
||||||
ENV SQLITE_DB=/app/data/sqlite/nkode.db
|
ENV SQLITE_DB=/app/data/sqlite/nkode.db
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 443 ssl http2;
|
|
||||||
server_name api.nkode.tech;
|
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/api.nkode.tech/fullchain.pem;
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/api.nkode.tech/privkey.pem;
|
|
||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
ssl_dhparam /etc/ssl/certs/dhparam.pem;
|
|
||||||
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
|
|
||||||
ssl_session_cache shared:SSL:10m;
|
|
||||||
ssl_session_timeout 10m;
|
|
||||||
ssl_stapling on;
|
|
||||||
ssl_stapling_verify on;
|
|
||||||
resolver 8.8.8.8 8.8.4.4 valid=300s;
|
|
||||||
resolver_timeout 5s;
|
|
||||||
|
|
||||||
add_header X-Content-Type-Options nosniff;
|
|
||||||
add_header X-Frame-Options DENY;
|
|
||||||
add_header X-XSS-Protection "1; mode=block";
|
|
||||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
proxy_pass http://127.0.0.1:8080; # Your application port
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name api.nkode.tech;
|
|
||||||
|
|
||||||
# Redirect all HTTP traffic to HTTPS
|
|
||||||
return 301 https://$host:443$request_uri;
|
|
||||||
}
|
|
||||||
11
compose/coolify_compose.yaml
Normal file
11
compose/coolify_compose.yaml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
services:
|
||||||
|
go-nkode:
|
||||||
|
container_name: go-nkode
|
||||||
|
image: registry.infra.nkode.tech/go-nkode
|
||||||
|
volumes:
|
||||||
|
- /var/go-nkode/sqlite:/app/data/sqlite
|
||||||
|
- /var/go-nkode/icons:/app/data/icons
|
||||||
|
|
||||||
|
environment:
|
||||||
|
- JWT_SECRET=${JWT_SECRET}
|
||||||
|
- FRONTEND_HOST=https://app.nkode.tech
|
||||||
@@ -1,16 +1,13 @@
|
|||||||
version: '3.9'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
go-nkode:
|
go-nkode:
|
||||||
container_name: go-nkode
|
container_name: go-nkode
|
||||||
image: registry.donovankelly.dev/go-nkode
|
image: registry.infra.nkode.tech/go-nkode
|
||||||
volumes:
|
volumes:
|
||||||
- /var/go-nkode/sqlite:/app/data/sqlite
|
- /var/go-nkode/sqlite:/app/data/sqlite
|
||||||
- /var/go-nkode/icons:/app/data/icons
|
- /var/go-nkode/icons:/app/data/icons
|
||||||
|
|
||||||
# .env should contain JWT_SECRET
|
environment:
|
||||||
env_file:
|
- JWT_SECRET=0123456789
|
||||||
- .env
|
- FRONTEND_HOST=http://localhost:8090
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8070:8080"
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Create a temporary directory to hold the files
|
|
||||||
#mkdir -p /tmp/nkodeapi
|
|
||||||
#
|
|
||||||
#cp -r ./core/* /tmp/nkodeapi/
|
|
||||||
#cp -r ./hashset/* /tmp/nkodeapi/
|
|
||||||
#cp -r ./py-builtin/* /tmp/nkodeapi/
|
|
||||||
#cp -r ./util/* /tmp/nkodeapi/
|
|
||||||
#
|
|
||||||
#cp go.mod /tmp/nkodeapi/
|
|
||||||
#cp main.go /tmp/nkodeapi/
|
|
||||||
|
|
||||||
|
|
||||||
# Disable extended attributes and create the tar file
|
|
||||||
export COPYFILE_DISABLE=1
|
|
||||||
tar -cvf go-nkode.tar -C ../ go-nkode
|
|
||||||
|
|
||||||
|
|
||||||
#scp go-nkode.tar dkelly@api.nkode.tech:/home/dkelly
|
|
||||||
|
|
||||||
scp api.nkode.tech dkelly@217.21.78.137:/home/dkelly
|
|
||||||
scp go-nkode.tar dkelly@217.21.78.137:/home/dkelly
|
|
||||||
|
|
||||||
rm go-nkode.tar
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
docker build -t go-nkode .
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
docker run --name go-nkode -p 8080:8080 \
|
|
||||||
-v /Users/donov/databases/:/app/data/sqlite \
|
|
||||||
-v /Users/donov/Desktop/go-nkode/core/sqlite-init/flaticon_colored_svgs/:/app/data/icons \
|
|
||||||
-e JWT_SECRET=cab2f6a968c2a11601bb33c41c5940b7 \
|
|
||||||
go-nkode
|
|
||||||
2
go.mod
2
go.mod
@@ -9,11 +9,9 @@ require (
|
|||||||
github.com/mattn/go-sqlite3 v1.14.22
|
github.com/mattn/go-sqlite3 v1.14.22
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
golang.org/x/crypto v0.26.0
|
golang.org/x/crypto v0.26.0
|
||||||
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/aws/aws-sdk-go v1.55.5 // indirect
|
|
||||||
github.com/aws/aws-sdk-go-v2 v1.31.0 // indirect
|
github.com/aws/aws-sdk-go-v2 v1.31.0 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.27.37 // indirect
|
github.com/aws/aws-sdk-go-v2/config v1.27.37 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.35 // indirect
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.35 // indirect
|
||||||
|
|||||||
1
script/docker_build.sh
Normal file
1
script/docker_build.sh
Normal file
@@ -0,0 +1 @@
|
|||||||
|
docker buildx build --platform linux/amd64,linux/arm64 -t registry.infra.nkode.tech/go-nkode:latest --push .
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Define the number of bytes you want to generate
|
|
||||||
num_bytes=16
|
|
||||||
|
|
||||||
# Use dd to read cryptographically secure bytes from /dev/urandom
|
|
||||||
# and convert them to hexadecimal using od
|
|
||||||
secure_bytes=$(dd if=/dev/urandom bs=1 count=$num_bytes 2>/dev/null | od -An -tx1)
|
|
||||||
|
|
||||||
# Remove leading/trailing spaces and concatenate the hex bytes into a single string
|
|
||||||
secure_bytes=$(echo $secure_bytes | tr -d ' \n')
|
|
||||||
|
|
||||||
# Output the result as a hexadecimal string
|
|
||||||
echo "Cryptographically secure bytes (as hex): $secure_bytes"
|
|
||||||
Reference in New Issue
Block a user