mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 12:11:35 +00:00
Init dockerization of dev environment with docker-compose
This commit is contained in:
parent
14ae3d0c2e
commit
f830c4df15
1
.gitignore
vendored
1
.gitignore
vendored
@ -637,7 +637,6 @@ FodyWeavers.xsd
|
|||||||
|
|
||||||
# Django
|
# Django
|
||||||
*migrations*
|
*migrations*
|
||||||
frontend/static/frontend/main*
|
|
||||||
|
|
||||||
# Celery
|
# Celery
|
||||||
django
|
django
|
||||||
|
@ -2,7 +2,8 @@ FROM python:3.9
|
|||||||
|
|
||||||
RUN mkdir -p /usr/src/robosats
|
RUN mkdir -p /usr/src/robosats
|
||||||
|
|
||||||
WORKDIR /usr/src/robosats # specifying the working dir inside the container
|
# specifying the working dir inside the container
|
||||||
|
WORKDIR /usr/src/robosats
|
||||||
|
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
@ -7,6 +7,7 @@ from rest_framework.response import Response
|
|||||||
|
|
||||||
from django.contrib.auth import authenticate, login, logout
|
from django.contrib.auth import authenticate, login, logout
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.conf import settings as conf_settings
|
||||||
|
|
||||||
from .serializers import ListOrderSerializer, MakeOrderSerializer, UpdateOrderSerializer
|
from .serializers import ListOrderSerializer, MakeOrderSerializer, UpdateOrderSerializer
|
||||||
from .models import LNPayment, MarketTick, Order, Currency
|
from .models import LNPayment, MarketTick, Order, Currency
|
||||||
@ -28,7 +29,8 @@ EXP_MAKER_BOND_INVOICE = int(config('EXP_MAKER_BOND_INVOICE'))
|
|||||||
FEE = float(config('FEE'))
|
FEE = float(config('FEE'))
|
||||||
RETRY_TIME = int(config('RETRY_TIME'))
|
RETRY_TIME = int(config('RETRY_TIME'))
|
||||||
|
|
||||||
avatar_path = Path('frontend/static/assets/avatars')
|
avatar_path = Path(conf_settings.STATIC_ROOT,'/assets/avatars')
|
||||||
|
print(str(avatar_path))
|
||||||
avatar_path.mkdir(parents=True, exist_ok=True)
|
avatar_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
80
docker-compose.yml
Normal file
80
docker-compose.yml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
version: '3.9'
|
||||||
|
services:
|
||||||
|
redis:
|
||||||
|
image: sickp/alpine-redis:3.2.2
|
||||||
|
container_name: redis
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- redisdata:/data
|
||||||
|
networks:
|
||||||
|
- redis_network
|
||||||
|
|
||||||
|
robosats:
|
||||||
|
build: .
|
||||||
|
container_name: rs-dev
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
# - bitcoind-dev
|
||||||
|
# - lnd-dev
|
||||||
|
- redis
|
||||||
|
environment:
|
||||||
|
DEVELOPMENT: True
|
||||||
|
volumes:
|
||||||
|
- ./robosats/:/usr/src/robosats
|
||||||
|
networks:
|
||||||
|
- nginx_network
|
||||||
|
- redis_network
|
||||||
|
command: python3 manage.py runserver
|
||||||
|
|
||||||
|
npm:
|
||||||
|
build: ./frontend
|
||||||
|
container_name: npm-dev
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- ./robosats/:/usr/src/robosats
|
||||||
|
networks:
|
||||||
|
- nginx_network
|
||||||
|
- redis_network
|
||||||
|
|
||||||
|
clean-orders-testnet:
|
||||||
|
build: ./robosats
|
||||||
|
restart: always
|
||||||
|
container_name: clord-dev
|
||||||
|
command: python3 manage.py clean-orders-testnet
|
||||||
|
volumes:
|
||||||
|
- ./robosats/:/usr/src/robosats
|
||||||
|
|
||||||
|
follow-invoices-testnet:
|
||||||
|
build: ./robosats
|
||||||
|
container_name: invo-dev
|
||||||
|
restart: always
|
||||||
|
# depends_on:
|
||||||
|
# - bitcoind-testnet
|
||||||
|
# - lnd-testnet
|
||||||
|
command: python3 manage.py follow_invoices
|
||||||
|
volumes:
|
||||||
|
- /mnt/database:/usr/src/database
|
||||||
|
|
||||||
|
celery-beat-testnet:
|
||||||
|
build: ./robosats
|
||||||
|
container_name: cbeat-dev
|
||||||
|
restart: always
|
||||||
|
command: celery -A robosats worker --beat -l info -S django
|
||||||
|
environment:
|
||||||
|
REDIS_URL: redis://redis:6379
|
||||||
|
volumes:
|
||||||
|
- /mnt/database:/usr/src/database
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
networks:
|
||||||
|
- redis_network
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
redisdata:
|
||||||
|
static-content:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
nginx_network:
|
||||||
|
driver: bridge
|
||||||
|
redis_network:
|
||||||
|
driver: bridge
|
41
frontend/Dockerfile
Normal file
41
frontend/Dockerfile
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
FROM alpine
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/src/robosats/frontend
|
||||||
|
|
||||||
|
# specifying the working dir inside the container
|
||||||
|
WORKDIR /usr/src/robosats/frontend
|
||||||
|
|
||||||
|
COPY requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# copy current dir's content to container's WORKDIR root i.e. all the contents of the robosats app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN apt install RUN
|
||||||
|
|
||||||
|
# packages we use
|
||||||
|
|
||||||
|
RUN npm init -y
|
||||||
|
RUN npm i webpack webpack-cli --save-dev
|
||||||
|
RUN npm i @babel/core babel-loader @babel/preset-env @babel/preset-react --save-dev
|
||||||
|
RUN npm i react react-dom --save-dev
|
||||||
|
RUN npm install @material-ui/core
|
||||||
|
RUN npm install @babel/plugin-proposal-class-properties
|
||||||
|
RUN npm install react-router-dom@5.2.0
|
||||||
|
RUN npm install @material-ui/icons
|
||||||
|
RUN npm install material-ui-image
|
||||||
|
RUN npm install @mui/system @emotion/react @emotion/styled
|
||||||
|
RUN npm install react-native
|
||||||
|
RUN npm install react-native-svg
|
||||||
|
RUN npm install react-qr-code
|
||||||
|
RUN npm install @mui/material
|
||||||
|
RUN npm install websocket
|
||||||
|
RUN npm install react-countdown
|
||||||
|
RUN npm install @mui/icons-material
|
||||||
|
RUN npm install @mui/x-data-grid
|
||||||
|
RUN npm install react-responsive
|
||||||
|
RUN npm install react-qr-reader
|
||||||
|
|
||||||
|
# launch
|
||||||
|
|
||||||
|
CMD ["npm", "run", "dev"]
|
2
frontend/static/frontend/main.js
Normal file
2
frontend/static/frontend/main.js
Normal file
File diff suppressed because one or more lines are too long
2283
frontend/static/frontend/main.js.LICENSE.txt
Normal file
2283
frontend/static/frontend/main.js.LICENSE.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -26,12 +26,18 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'frontend/static/')
|
|||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = 'django-insecure-6^&6uw$b5^en%(cu2kc7_o)(mgpazx#j_znwlym0vxfamn2uo-'
|
SECRET_KEY = 'django-insecure-6^&6uw$b5^en%(cu2kc7_o)(mgpazx#j_znwlym0vxfamn2uo-'
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
STATIC_ROOT = os.path.join('/usr/src/static/')
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
if os.environ.get('DEVELOPMENT'):
|
||||||
|
DEBUG = True
|
||||||
|
STATIC_URL = '/static/'
|
||||||
|
STATIC_ROOT = os.path.join(BASE_DIR, 'frontend/static/')
|
||||||
|
|
||||||
ALLOWED_HOSTS = [config('HOST_NAME'),'127.0.0.1']
|
ALLOWED_HOSTS = [config('HOST_NAME'),'127.0.0.1']
|
||||||
|
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
@ -85,15 +91,27 @@ WSGI_APPLICATION = 'robosats.wsgi.application'
|
|||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
|
||||||
|
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': BASE_DIR / 'db.sqlite3',
|
'NAME': '/usr/src/database/db.sqlite3',
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
'timeout': 20, # in seconds
|
'timeout': 20, # in seconds
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.environ.get('DEVELOPMENT'):
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': BASE_DIR / 'db.sqlite3',
|
||||||
|
'OPTIONS': {
|
||||||
|
'timeout': 20, # in seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Password validation
|
# Password validation
|
||||||
|
Loading…
Reference in New Issue
Block a user