Working docker-compose

This commit is contained in:
Reckless_Satoshi 2022-02-07 10:11:57 -08:00
parent de702d19ac
commit 470393f2a0
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
4 changed files with 35 additions and 34 deletions

View File

@ -11,20 +11,21 @@ services:
backend: backend:
build: . build: .
container_name: rs-dev container_name: django-dev
restart: always restart: always
depends_on: depends_on:
# - bitcoind-dev # - bitcoind-dev
# - lnd-dev # - lnd-dev
- redis - redis
environment: environment:
DEVELOPMENT: True DEVELOPMENT: 1
volumes: volumes:
- ./robosats/:/usr/src/robosats - .:/usr/src/robosats
- /mnt/development/database:/usr/src/database
networks: networks:
- nginx_network - nginx_network
- redis_network - redis_network
command: python3 manage.py runserver command: python3 manage.py runserver 0.0.0.0:8000
ports: ports:
- 8000:8000 - 8000:8000
@ -33,21 +34,22 @@ services:
container_name: npm-dev container_name: npm-dev
restart: always restart: always
volumes: volumes:
- ./robosats/:/usr/src/robosats - .:/usr/src/robosats
networks: networks:
- nginx_network - nginx_network
- redis_network - redis_network
clean-orders: clean-orders:
build: ./robosats build: .
restart: always restart: always
container_name: clord-dev container_name: clord-dev
command: python3 manage.py clean-orders-testnet command: python3 manage.py clean_orders
volumes: volumes:
- ./robosats/:/usr/src/robosats - .:/usr/src/robosats
- /mnt/development/database:/usr/src/database
follow-invoices: follow-invoices:
build: ./robosats build: .
container_name: invo-dev container_name: invo-dev
restart: always restart: always
# depends_on: # depends_on:
@ -55,17 +57,19 @@ services:
# - lnd-testnet # - lnd-testnet
command: python3 manage.py follow_invoices command: python3 manage.py follow_invoices
volumes: volumes:
- /mnt/dev/database:/usr/src/database - .:/usr/src/robosats
- /mnt/development/database:/usr/src/database
celery: celery:
build: ./robosats build: .
container_name: cbeat-dev container_name: cbeat-dev
restart: always restart: always
command: celery -A robosats worker --beat -l info -S django command: celery -A robosats worker --beat -l info -S django
environment: environment:
REDIS_URL: redis://redis:6379 REDIS_URL: redis://redis:6379
volumes: volumes:
- /mnt/dev/database:/usr/src/database - .:/usr/src/robosats
- /mnt/development/database:/usr/src/database
depends_on: depends_on:
- redis - redis
networks: networks:

View File

@ -1,24 +1,23 @@
FROM alpine FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN mkdir -p /usr/src/robosats/frontend RUN mkdir -p /usr/src/frontend
# specifying the working dir inside the container # specifying the working dir inside the container
WORKDIR /usr/src/robosats/frontend WORKDIR /usr/src/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 current dir's content to container's WORKDIR root i.e. all the contents of the robosats app
COPY . . COPY . .
RUN apt install RUN RUN apt update
RUN apt -y install npm
# packages we use # packages we use
RUN npm init -y RUN npm init -y
RUN npm i webpack webpack-cli --save-dev RUN npm install webpack webpack-cli --save-dev
RUN npm i @babel/core babel-loader @babel/preset-env @babel/preset-react --save-dev RUN npm install @babel/core babel-loader @babel/preset-env @babel/preset-react --save-dev
RUN npm i react react-dom --save-dev RUN npm install react react-dom --save-dev
RUN npm install @material-ui/core RUN npm install @material-ui/core
RUN npm install @babel/plugin-proposal-class-properties RUN npm install @babel/plugin-proposal-class-properties
RUN npm install react-router-dom@5.2.0 RUN npm install react-router-dom@5.2.0

View File

@ -101,18 +101,6 @@ DATABASES = {
} }
} }
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
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators

View File

@ -217,4 +217,14 @@ Then launch it with
``` ```
systemctl start clean_orders systemctl start clean_orders
systemctl enable clean_orders systemctl enable clean_orders
```
# Docker set up for development, example for testnet (-dev containers)
```
docker-compose build --no-cache
docker-compose up
sudo docker exec -it rs-dev python3 manage.py makemigrations
sudo docker exec -it rs-dev python3 manage.py migrate
sudo docker exec -it rs-dev python3 manage.py createsuperuser
docker-compose restart
``` ```