Commit 703a7f8f authored by Philippe Valfok's avatar Philippe Valfok

Adicionando Pipfiles, iniciando task para criação automática de domínios

parent 7ac9d6ff
......@@ -10,7 +10,11 @@ RUN set -ex && mkdir /src
# -- Adding Compose Folder
ADD /compose/*.sh /
RUN chmod +x /*.sh
RUN set -ex && chmod +x /*.sh
# -- Make Scripts Executables
ADD /scripts/*.py /
RUN set -ex && chmod +x /*.py
WORKDIR /src
......@@ -19,4 +23,14 @@ ADD Pipfile /
ADD Pipfile.lock /
# -- Install dependencies:
RUN set -ex && pipenv install --deploy --system
\ No newline at end of file
RUN set -ex && pipenv install --deploy --system
# -- Install Python2 to run Fabric Tasks
RUN set -ex && apt-get update
RUN set -ex && apt-get install -y python-pip
RUN set -ex && apt-get install -y python-dev
RUN set -ex && pip2 install setuptools --upgrade
RUN set -ex && pip2 install cryptography --upgrade
RUN set -ex && pip2 install fabric --upgrade
RUN set -ex && pip2 install enum --upgrade
RUN set -ex && pip2 install ipaddress --upgrade
\ No newline at end of file
......@@ -22,6 +22,7 @@ python-decouple = "*"
unipath = "*"
python-digitalocean = "*"
gunicorn = "*"
"python2" = "*"
[requires]
......
{
"_meta": {
"hash": {
"sha256": "3cf09d52c00bece1036b2af1412bb627954f172bb539df46b3e46eca2d615507"
"sha256": "8591da5304523e6f55ccd7381bf591176b281c80b9e5b20e2d45d3a8bffbf354"
},
"host-environment-markers": {
"implementation_name": "cpython",
......@@ -146,6 +146,12 @@
],
"version": "==1.13.2"
},
"python2": {
"hashes": [
"sha256:9219352345a5cfcdf2e104c469bcbfe5b959b8e15f194988809b984a3fcdda55"
],
"version": "==1.2"
},
"pytz": {
"hashes": [
"sha256:80af0f3008046b9975242012a985f04c5df1f01eed4ec1633d56cc47a75a6a48",
......@@ -296,11 +302,11 @@
},
"typing": {
"hashes": [
"sha256:349b1f9c109c84b53ac79ac1d822eaa68fc91d63b321bd9392df15098f746f53",
"sha256:63a8255fe7c6269916baa440eb9b6a67139b0b97a01af632e7bd2842e1e02f15",
"sha256:d514bd84b284dd3e844f0305ac07511f097e325171f6cc4a20878d11ad771849"
"sha256:b2c689d54e1144bbcfd191b0832980a21c2dbcf7b5ff7a66248a60c90e951eb8",
"sha256:3a887b021a77b292e151afb75323dea88a7bc1b3dfa92176cff8e44c8b68bddf",
"sha256:d400a9344254803a2368533e4533a4200d21eb7b6b729c173bc38201a74db3f2"
],
"version": "==3.6.2"
"version": "==3.6.4"
},
"urllib3": {
"hashes": [
......
......@@ -29,6 +29,9 @@ services:
DEBUG: "False"
DATABASE_URL: "postgres://postgres:infatecbdadmin@165.227.205.36/diario_manager"
SECRET_KEY: "=b+8s@l*rnqjd*=1rrsp!op82-qcgubm6oysex+thbu1+myen-"
MANAGER_HOST: "165.227.205.48"
MANAGER_HOST_USER: "infatec"
MANAGER_HOST_PASSWORD: "adminfatec"
restart: always
links:
- redis
......
This diff is collapsed.
#!/usr/bin/python2
print "olha eu aqui!"
\ No newline at end of file
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import os
import sys
import logging
from fabric.api import env, run, settings, show, hide
from fabric.tasks import execute
logging.getLogger(
'paramiko.transport'
).addHandler(
logging.StreamHandler()
)
env.hosts = [
os.environ.get('MANAGER_HOST')
]
env.user = os.environ.get('MANAGER_HOST_USER')
env.password = os.environ.get('MANAGER_HOST_PASSWORD')
def exec_add_domain(domain_name):
script_path = "django_apps/DIARIO_MANAGER/scripts/add_domain.py"
with settings(hide('everything'), show('running')):
result = run("chmod +x %s && %s %s" % (script_path, script_path, domain_name))
if result.failed:
return "Erro ao executar script de criação de domínio. (%s)" % result.command
return "Erro ao executar script de criação de domínio"
if __name__ == '__main__':
try:
domain_name = sys.argv[1]
execute(exec_add_domain, domain_name)
except Exception as err:
msg = "Erro ao executar comando! (%s)" % err
print msg
# Generated by Django 2.0.1 on 2018-01-25 11:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0009_auto_20180124_1052'),
]
operations = [
migrations.AddField(
model_name='configuracao',
name='chave_ssh',
field=models.TextField(blank=True),
),
]
# Generated by Django 2.0.1 on 2018-01-25 14:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0010_configuracao_chave_ssh'),
]
operations = [
migrations.RemoveField(
model_name='configuracao',
name='chave_ssh',
),
]
......@@ -10,8 +10,6 @@ class Configuracao(SingletonModel):
"""Model definition for COnfigurations"""
token = models.CharField(max_length=255)
chave_ssh = models.TextField(blank=True)
droplets_region = models.CharField(_('Região dos Droplets'), max_length=50, default="nyc1")
droplets_image = models.CharField(_('Imagem/SO dos Droplets'), max_length=50, default="ubuntu-16-04-x64")
droplets_size = models.CharField(_('Tamanho dos Droplets'), max_length=50, default="s-1vcpu-1gb")
......
......@@ -59,14 +59,6 @@ ROOT_URLCONF = 'backend.urls'
SITE_ID = 1
WSGI_APPLICATION = 'backend.wsgi.application'
# RQ_QUEUES = {
# 'default': {
# 'HOST': 'localhost',
# 'PORT': 6379,
# 'DB': 0
# }
# }
# RQ (Redis Queue)
# http://python-rq.org/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment