finishing up makefile, adding health page, adjusting docker-compose files

pull/3/head
lalanza808 5 years ago
parent e44cb91b10
commit eb693f6ce0

@ -10,18 +10,25 @@ build: ## Build all the required containers
docker build -t monero -f Dockerfile-monero .
docker build -t xmrauctions -f Dockerfile-xmrauctions .
up: ## Run dev service containers
docker-compose up -d
dev: ## Start development web service
./manage.py runserver
### Stage
### Deploy
stage-up: ## Run the stage containers
docker-compose -f docker-compose.yaml -f docker-compose.stage.yaml up -d
deploy-up: ## Run the containers
docker-compose -f docker-compose.yaml -f docker-compose.deploy.yaml up -d
stage-ps: ## Show containers
docker-compose -f docker-compose.yaml -f docker-compose.stage.yaml ps
deploy-down: ## Stop the containers
docker-compose -f docker-compose.yaml -f docker-compose.deploy.yaml down
stage-logs: ## Show logs
docker-compose -f docker-compose.yaml -f docker-compose.stage.yaml logs -f
deploy-ps: ## Show the containers
docker-compose -f docker-compose.yaml -f docker-compose.deploy.yaml ps
stage-static: ## Collect static
deploy-logs: ## Show container logs
docker-compose -f docker-compose.yaml -f docker-compose.deploy.yaml logs -f
deploy-static: ## Collect static
docker run --rm --env-file=.env xmrauctions ./manage.py collectstatic --no-input

@ -4,5 +4,6 @@ from . import views
urlpatterns = [
path('', views.home, name='home'),
path('shipping/edit/', views.edit_shipping, name='edit_shipping')
path('health/', views.health, name='health'),
path('shipping/edit/', views.edit_shipping, name='edit_shipping'),
]

@ -1,10 +1,11 @@
from django.shortcuts import render, HttpResponseRedirect, reverse
from django.http import JsonResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib import messages
from core.forms import UserShippingAddressForm
from core.models import UserShippingAddress
from core.monero import AuctionDaemon
from core.monero import AuctionDaemon, AuctionWallet
def home(request):
@ -17,6 +18,17 @@ def home(request):
return render(request, 'home.html', {'daemon_info': daemon_info})
def health(request):
daemon = AuctionDaemon()
wallet = AuctionWallet()
context = {
'daemon_connected': daemon.connected,
'wallet_connected': wallet.connected
}
return JsonResponse(context)
@login_required
def edit_shipping(request):
profile = UserShippingAddress.objects.filter(user=request.user).first()

@ -0,0 +1,19 @@
version: '3'
services:
gunicorn:
env_file:
- .env
image: xmrauctions:latest
command: [".venv/bin/gunicorn", "-b", "0.0.0.0:8000", "xmrauctions.wsgi"]
ports:
- 8000:8000
migrations:
env_file:
- .env
image: xmrauctions:latest
command: ["./manage.py", "migrate"]
huey:
env_file:
- .env
image: xmrauctions:latest
command: ["./manage.py", "run_huey"]

@ -1,9 +0,0 @@
version: '3'
services:
gunicorn:
env_file:
- .env
image: xmrauctions:latest
command: [".venv/bin/gunicorn", "-b", "0.0.0.0:8000", "xmrauctions.wsgi"]
ports:
- 8000:8000