Skip to content
Open
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
46 changes: 32 additions & 14 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
db
docs
docker
.editorconfig
.env-sample
CONTRIBUTING.md
django
README.md
setup.md
docker-compose.yml
.github
.git
node
api/lightning/googleapis
# This file reduces build context size and speeds up builds
# Leading slash (/) anchors patterns to the build context root
# Trailing slash (/) matches only directories
# Best practices:
# - Prefer anchored patterns over unanchored ones
# - List directories or nested paths first, then root-level files, then unanchored patterns
# - Keep the lists sorted in alphabetical order ignoring case

# Directories and nested paths
/.git/
/.github/
/android/
/api/lightning/googleapis/
/collected_static/
/desktopApp/
/development/
/docker/
/docs/
/node/
/nodeapp/
/tests/

# Root-level files
/.dockerignore
/.editorconfig
/.gitignore
/CONTRIBUTING.md
/docker-compose.yml
/README.md

# Unanchored patterns
node_modules/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ node
desktopApp/release-builds

# frontend statics
collected_static
frontend/templates/frontend/*.html
frontend/*.html
desktopApp/static
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ COPY . .
RUN sh scripts/generate_grpc.sh
RUN chmod +x scripts/entrypoint.sh

RUN cp .env-sample .env \
&& python manage.py collectstatic --noinput --clear \
&& rm .env-sample .env \
&& find /usr/src/static -type f -exec gzip -9 --keep {} +

EXPOSE 8000
ENTRYPOINT [ "/usr/src/robosats/scripts/entrypoint.sh" ]

Expand Down
8 changes: 0 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ services:
pull_policy: never
restart: always
container_name: clord-dev
environment:
SKIP_COLLECT_STATIC: "true"
command: python3 manage.py clean_orders
volumes:
- .:/usr/src/robosats
Expand All @@ -81,8 +79,6 @@ services:
depends_on:
- bitcoind
- lnd
environment:
SKIP_COLLECT_STATIC: "true"
command: python3 manage.py follow_invoices
volumes:
- .:/usr/src/robosats
Expand All @@ -95,8 +91,6 @@ services:
pull_policy: never
container_name: tg-dev
restart: always
environment:
SKIP_COLLECT_STATIC: "true"
command: python3 manage.py telegram_watcher
volumes:
- .:/usr/src/robosats
Expand All @@ -111,7 +105,6 @@ services:
restart: always
environment:
REDIS_URL: redis://localhost:6379
SKIP_COLLECT_STATIC: "true"
volumes:
- .:/usr/src/robosats
- ./node/lnd:/lnd
Expand All @@ -128,7 +121,6 @@ services:
restart: always
environment:
REDIS_URL: redis://localhost:6379
SKIP_COLLECT_STATIC: "true"
command: celery -A robosats beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
volumes:
- .:/usr/src/robosats
Expand Down
3 changes: 1 addition & 2 deletions docker-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ services:
# BITCOIND_RPCURL: 'http://127.0.0.1:18443'
# BITCOIND_RPCUSER: 'test'
# BITCOIND_RPCPASSWORD: 'test'
# SKIP_COLLECT_STATIC: "true"
# env_file:
# - ${ROBOSATS_ENVS_FILE}
# volumes:
Expand All @@ -211,4 +210,4 @@ volumes:
bitcoin:
lnd:
cln:
lndrobot:
lndrobot:
2 changes: 1 addition & 1 deletion nodeapp/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ http {
}

}
}
}
2 changes: 2 additions & 0 deletions robosats/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_ROOT = "/usr/src/static"
STATIC_URL = "static/"

# RoboSats version
Expand All @@ -41,6 +42,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
if config("DEVELOPMENT", cast=bool, default=False):
DEBUG = True
STATIC_ROOT = BASE_DIR / "collected_static"

ALLOWED_HOSTS = [
config("HOST_NAME"),
Expand Down
9 changes: 1 addition & 8 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
# Apply migrations
python manage.py migrate

# Collect static files
if [ $SKIP_COLLECT_STATIC ]; then
echo "Skipping collection of static files."
else
python manage.py collectstatic --noinput
fi

# Collect static files
if [ $DEVELOPMENT ]; then
echo "Installing python development dependencies"
Expand All @@ -26,4 +19,4 @@ fi
cp -R /tmp/* /usr/src/robosats/api/lightning/

# Start server / gunicorn / daphne / command
exec "$@"
exec "$@"
3 changes: 3 additions & 0 deletions scripts/traditional/templates/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ http {
types_hash_max_size 2048;
server_tokens off;

gzip_static on;
gzip_proxied expired no-cache no-store private auth;

# nginx: [emerg] could not build map_hash, you should increase map_hash_bucket_size: 64
map_hash_bucket_size 4096;

Expand Down
2 changes: 1 addition & 1 deletion web/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ http {
alias /usr/src/web/static/assets/images/favicon-96x96.png;
}
}
}
}
Loading