lots of things
This commit is contained in:
@@ -14,6 +14,7 @@ before_install:
|
|||||||
- sudo mv docker-compose /usr/local/bin
|
- sudo mv docker-compose /usr/local/bin
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
- export REACT_APP_USERS_SERVICE_URL=http://127.0.0.1
|
||||||
- docker-compose up -d --build
|
- docker-compose up -d --build
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
version: '3.7'
|
version: '3.7'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
client:
|
||||||
|
container_name: client
|
||||||
|
build:
|
||||||
|
context: ./services/client
|
||||||
|
dockerfile: Dockerfile-prod
|
||||||
|
args:
|
||||||
|
- NODE_ENV=production
|
||||||
|
- REACT_APP_USERS_SERVICE_URL=${REACT_APP_USERS_SERVICE_URL}
|
||||||
|
ports:
|
||||||
|
- "3007:80"
|
||||||
|
depends_on:
|
||||||
|
- users
|
||||||
users:
|
users:
|
||||||
build:
|
build:
|
||||||
context: ./services/users
|
context: ./services/users
|
||||||
@@ -32,3 +44,4 @@ services:
|
|||||||
- "80:80"
|
- "80:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- users
|
- users
|
||||||
|
- client
|
||||||
|
|||||||
@@ -1,6 +1,20 @@
|
|||||||
version: '3.7'
|
version: '3.7'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
client:
|
||||||
|
build:
|
||||||
|
context: ./services/client
|
||||||
|
dockerfile: services/client/Dockerfile-prod
|
||||||
|
volumes:
|
||||||
|
- './services/client:/usr/src/app'
|
||||||
|
- '/usr/src/app/node_mdules'
|
||||||
|
ports:
|
||||||
|
- 3007:3000
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- REACT_APP_USERS_SERVICE_URL=${REACT_APP_USERS_SERVICE_URL}
|
||||||
|
depends_on:
|
||||||
|
- users
|
||||||
users:
|
users:
|
||||||
build:
|
build:
|
||||||
context: ./services/users
|
context: ./services/users
|
||||||
@@ -34,4 +48,5 @@ services:
|
|||||||
- "80:80"
|
- "80:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
- users
|
- users
|
||||||
|
- client
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,15 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
proxy_pass http://client:3000;
|
||||||
|
proxy_redirect default;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /users {
|
||||||
proxy_pass http://users:5000;
|
proxy_pass http://users:5000;
|
||||||
proxy_redirect default;
|
proxy_redirect default;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|||||||
@@ -3,6 +3,15 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
|
proxy_pass http://client:80;
|
||||||
|
proxy_redirect default;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /users {
|
||||||
proxy_pass http://users:5000;
|
proxy_pass http://users:5000;
|
||||||
proxy_redirect default;
|
proxy_redirect default;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ psycopg2-binary = "*"
|
|||||||
flask-testing = "*"
|
flask-testing = "*"
|
||||||
coverage = "*"
|
coverage = "*"
|
||||||
flake8 = "*"
|
flake8 = "*"
|
||||||
|
flask-debugtoolbar = "*"
|
||||||
|
flask-cors = "*"
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.8"
|
python_version = "3.8"
|
||||||
|
|||||||
24
services/users/Pipfile.lock
generated
24
services/users/Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "77ca234305c2fbf685654a912edd73bd100774766adeb44a9cafa01deb77a205"
|
"sha256": "e69adbf7b4a00904ef2c27e32b8d3c4b3fea6781f3d1db45fe78c1c0a58320a1"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -23,6 +23,12 @@
|
|||||||
],
|
],
|
||||||
"version": "==8.0.0"
|
"version": "==8.0.0"
|
||||||
},
|
},
|
||||||
|
"blinker": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"
|
||||||
|
],
|
||||||
|
"version": "==1.4"
|
||||||
|
},
|
||||||
"click": {
|
"click": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
|
"sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
|
||||||
@@ -91,6 +97,22 @@
|
|||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"version": "==1.1.1"
|
"version": "==1.1.1"
|
||||||
},
|
},
|
||||||
|
"flask-cors": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:72170423eb4612f0847318afff8c247b38bd516b7737adfc10d1c2cdbb382d16",
|
||||||
|
"sha256:f4d97201660e6bbcff2d89d082b5b6d31abee04b1b3003ee073a6fd25ad1d69a"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==3.0.8"
|
||||||
|
},
|
||||||
|
"flask-debugtoolbar": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:3d9657bc0c3633ace429e3ff451742bb59d1b7a7b95c9eb23a65ac9be2812959",
|
||||||
|
"sha256:ec810083123aae0632eb32ba11e1cb4cdace81e7ce6c5009dd06c5204afbce52"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.10.1"
|
||||||
|
},
|
||||||
"flask-restful": {
|
"flask-restful": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:ecd620c5cc29f663627f99e04f17d1f16d095c83dc1d618426e2ad68b03092f8",
|
"sha256:ecd620c5cc29f663627f99e04f17d1f16d095c83dc1d618426e2ad68b03092f8",
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
from flask_cors import CORS
|
||||||
|
from flask_debugtoolbar import DebugToolbarExtension
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
|
||||||
db = SQLAlchemy()
|
db = SQLAlchemy()
|
||||||
|
toolbar = DebugToolbarExtension()
|
||||||
|
cors = CORS()
|
||||||
|
|
||||||
|
|
||||||
def create_app(script_info=None):
|
def create_app():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app_settings = os.getenv('APP_SETTINGS')
|
app_settings = os.getenv('APP_SETTINGS')
|
||||||
app.config.from_object(app_settings)
|
app.config.from_object(app_settings)
|
||||||
|
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
toolbar.init_app(app)
|
||||||
|
cors.init_app(app)
|
||||||
|
|
||||||
from project.api.users import users_blueprint
|
from project.api.users import users_blueprint
|
||||||
app.register_blueprint(users_blueprint)
|
app.register_blueprint(users_blueprint)
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ class BaseConfig:
|
|||||||
TESTING = False
|
TESTING = False
|
||||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
SECRET_KEY = 'my_precious'
|
SECRET_KEY = 'my_precious'
|
||||||
|
DEBUG_TB_ENABLED = False
|
||||||
|
DEBUG_TB_INTERCEPT_REDIRECTS = False
|
||||||
|
|
||||||
|
|
||||||
class DevelopmentConfig(BaseConfig):
|
class DevelopmentConfig(BaseConfig):
|
||||||
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
|
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
|
||||||
|
DEBUG_TB_ENABLED = True
|
||||||
|
|
||||||
|
|
||||||
class ProductionConfig(BaseConfig):
|
class ProductionConfig(BaseConfig):
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class TestDevelopmentConfig(TestCase):
|
|||||||
app.config['SQLALCHEMY_DATABASE_URI'] ==
|
app.config['SQLALCHEMY_DATABASE_URI'] ==
|
||||||
os.environ.get('DATABASE_URL')
|
os.environ.get('DATABASE_URL')
|
||||||
)
|
)
|
||||||
|
self.assertTrue(app.config['DEBUG_TB_ENABLED'])
|
||||||
|
|
||||||
|
|
||||||
class TestTestingConfig(TestCase):
|
class TestTestingConfig(TestCase):
|
||||||
@@ -36,6 +37,7 @@ class TestTestingConfig(TestCase):
|
|||||||
app.config['SQLALCHEMY_DATABASE_URI'] ==
|
app.config['SQLALCHEMY_DATABASE_URI'] ==
|
||||||
os.environ.get('DATABASE_TEST_URL')
|
os.environ.get('DATABASE_TEST_URL')
|
||||||
)
|
)
|
||||||
|
self.assertFalse(app.config['DEBUG_TB_ENABLED'])
|
||||||
|
|
||||||
|
|
||||||
class TestProductionConfig(TestCase):
|
class TestProductionConfig(TestCase):
|
||||||
@@ -46,6 +48,7 @@ class TestProductionConfig(TestCase):
|
|||||||
def test_app_is_testing(self):
|
def test_app_is_testing(self):
|
||||||
self.assertTrue(app.config['SECRET_KEY'] == 'my_precious')
|
self.assertTrue(app.config['SECRET_KEY'] == 'my_precious')
|
||||||
self.assertFalse(app.config['TESTING'])
|
self.assertFalse(app.config['TESTING'])
|
||||||
|
self.assertFalse(app.config['DEBUG_TB_ENABLED'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
-i https://pypi.org/simple
|
-i https://pypi.org/simple
|
||||||
aniso8601==8.0.0
|
aniso8601==8.0.0
|
||||||
|
blinker==1.4
|
||||||
click==7.0
|
click==7.0
|
||||||
coverage==4.5.4
|
coverage==4.5.4
|
||||||
entrypoints==0.3
|
entrypoints==0.3
|
||||||
flake8==3.7.9
|
flake8==3.7.9
|
||||||
|
flask-cors==3.0.8
|
||||||
|
flask-debugtoolbar==0.10.1
|
||||||
flask-restful==0.3.7
|
flask-restful==0.3.7
|
||||||
flask-sqlalchemy==2.4.1
|
flask-sqlalchemy==2.4.1
|
||||||
flask-testing==0.7.1
|
flask-testing==0.7.1
|
||||||
|
|||||||
Reference in New Issue
Block a user