Skip to content

Commit 90c8eed

Browse files
committed
deployment fixes
1 parent e90db96 commit 90c8eed

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Make sure you have installed all of the following prerequisites on your developm
2323
1. Clone this repository to get all of the files necessary for building the project
2424
```$ git clone https://github.com/0xfaust/0xfaust.io```
2525
2. Make copies of the Environment Variable files
26-
```$ cd 0xfaust.io && cp .env.template .env && cp config/postgres/.env.template config/postgres/.env```
27-
3. Configure the ```.env``` and ```config/postgres/.env``` files for your environment.
26+
```$ cd 0xfaust.io && cp .env.template .env && cp config/datadog/.env.template config/datadog/.env && cp config/postgres/.env.template config/postgres/.env```
27+
3. Configure the ```.env```, ```config/datadog.env``` and ```config/postgres/.env``` files for your environment.
2828
4. Build and run all of the Docker Containers in detached mode.
2929
```$ docker-compose up -d --build```
3030
5. The site can then be accessed via [localhost:8000](http://localhost:8000) in your browser.
@@ -38,7 +38,7 @@ Make sure you have installed all of the following prerequisites on your developm
3838

3939
## Deployment
4040
There are a few additional considerations and modifications that need to be made in order to host the project on a live system. Some of the considerations are outlined in Django's [Deployment Checklist](https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/) and most of them have already been addressed using Environment Variables. Here are some additional steps to go from ```localhost``` to your server's IP.
41-
1. In ```config/nginx/conf.d/local.conf```, change ```localhost``` to the IP of your server.
41+
1. In ```config/nginx/nginx.conf```, change ```localhost``` to the IP of your server.
4242
2. In ```src/faust/settings.py``` change ```localhost``` to the list of IP address's and domains, e.g.
4343
```ALLOWED_HOSTS = ['xxx.xxx.xxx.xxx','0xfaust.io','www.0xfaust.io']```
4444

config/datadog/.env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
DD_API_KEY=<DATADOG API KEY>
22
DD_HOSTNAME=<HOSTNAME>
33
DD_SITE=<DATADOG SITE (US OR EU)>
4+
DD_LOGS_ENABLED=<TRUE OR FALSE>
5+
DATADOG_USER=<DB USERNAME>
6+
DATADOG_PASSWORD=<DB PASS>

docker-compose.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ services:
8484
- DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
8585
- DD_DOGSTATSD_SOCKET=/var/run/datadog/dsd.socket
8686
- DD_DOGSTATSD_ORIGIN_DETECTION=true
87+
- DD_CONTAINER_EXCLUDE_LOGS="name:0xfaustio_keras"
8788
networks:
8889
- datadog_network
8990
ports:
@@ -95,8 +96,6 @@ services:
9596
- /var/socket/run/datadog:/var/run/datadog
9697
- ./config/datadog/keras.d/conf.yaml:/etc/datadog-agent/conf.d/keras.d/conf.yaml
9798
- keras_volume:/var/lib/keras/
98-
labels:
99-
com.datadoghq.ad.logs: '[{"source": "agent", "service": "datadog agent"}]'
10099
pid: host
101100
depends_on:
102101
- django
@@ -119,6 +118,8 @@ services:
119118
volumes:
120119
- keras_volume:/opt/services/keras/models
121120
- /var/socket/run/datadog:/var/run/datadog:ro
121+
labels:
122+
com.datadoghq.ad.logs: '[{"source": "keras", "service": "machine learning"}]'
122123
networks:
123124
- datadog_network
124125

nn/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ COPY requirements.txt /opt/services/keras
1010
RUN apt-get update -y
1111
RUN apt-get install -y python3-dev python3-pip build-essential
1212
RUN pip3 install --upgrade pip
13-
RUN pip3 install -r requirements.txt
13+
RUN pip3 install -r requirements.txt --no-cache-dir
1414

1515
# copy project code
1616
COPY . /opt/services/keras
1717

1818
# run training loop
19-
CMD ["python3", "./src/covnet.py"]
19+
CMD ["python3", "./src/covnet.py", "> /dev/null"]

nn/src/covnet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ def on_epoch_end(self, epoch, accuracy, logs=None):
6666
statsd.event('Convolutional Netual Network Model Training Starting', 'Training starting with Batch Size {} for {} Epochs.'.format(epochs_train, batch_size_train), alert_type='info')
6767

6868
with tracer.trace('model.fit'):
69-
model.fit(train_images, train_labels, epochs=epochs_train, batch_size=batch_size_train, callbacks=[LogsAndMetricsCallback()])
69+
model.fit(train_images, train_labels, epochs=epochs_train, batch_size=batch_size_train, callbacks=[LogsAndMetricsCallback()], verbose=0)
7070

7171
with tracer.trace('model.evaluate'):
72-
test_loss, test_acc = model.evaluate(test_images, test_labels)
72+
test_loss, test_acc = model.evaluate(test_images, test_labels, verbose=0)
7373

7474
statsd.event('Convolutional Netual Network Model Training Finished', 'Training finished with Accuracy {} and Loss {}.'.format(test_acc, test_loss), alert_type='success')
7575

76-
print(test_acc)
76+
#print(test_acc)
7777

7878
statsd.gauge('keras.epoch', 0)
7979
statsd.gauge('keras.accuracy', 0)

requirements.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@ Django==3.0.7
22
gunicorn==20.0.4
33
psycopg2==2.8.5
44
ddtrace==0.38.0
5-
tensorflow==2.2.0
6-
numpy==1.18.4
7-
scipy==1.4.1
8-
keras==2.3.1
9-
h5py==2.10.0
105
datadog==0.36.0

0 commit comments

Comments
 (0)