Added Docker support
This commit is contained in:
parent
6a41e75852
commit
22cc9ad1d5
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../../../:\Users\Netkas\Documents\gits\CoffeeHousePy\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="PLAIN" />
|
||||
<option name="myDocStringFormat" value="Plain" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/CoffeeHousePy.iml" filepath="$PROJECT_DIR$/.idea/CoffeeHousePy.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
echo "### Initializing CoffeeHouse-Utils ###"
|
||||
chmod a+x /usr/local/bin/update_server
|
||||
if [ ! -f /firstrun.pass ]; then
|
||||
echo "(!) First run! Installing resources..."
|
||||
update_server
|
||||
echo "(+) Setting boot flag..."
|
||||
touch /firstrun.pass
|
||||
echo "[...] Restarting server in detached mode..."
|
||||
else
|
||||
cd /CoffeeHousePy
|
||||
echo "### Starting CoffeeHouse-LangDetect ###"
|
||||
make start_langdetect &
|
||||
echo "### Starting CoffeeHouse-SpamDetect ###"
|
||||
make start_spamdetect &
|
||||
|
||||
while sleep 60; do
|
||||
|
||||
# If grep find anything, they exit with 0 status
|
||||
# If they are not 0, then something is wrong
|
||||
|
||||
ps aux | grep coffeehouse_languagedetection | grep -q -v grep
|
||||
LANGDETECT_STATUS=$?
|
||||
if [ $LANGDETECT_STATUS -ne 0 ]; then
|
||||
echo "ERROR: coffeehouse_languagedetection has been terminated, terminating container."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ps aux | grep coffeehouse_spamdetection | grep -q -v grep
|
||||
SPAMDETECT_STATUS=$?
|
||||
if [ $SPAMDETECT_STATUS -ne 0 ]; then
|
||||
echo "ERROR: coffeehouse_spamdetection has been terminated, terminating container."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
# Written by Netkas 3/01/2021
|
||||
echo "Intellivoid Provisioning"
|
||||
echo "Running on x86_64 (docker) [PRODUCTION]"
|
||||
echo " "
|
||||
echo " ## Authentication Required "
|
||||
read -p 'Enter your 25-50 character PAT: ' GIT_API_KEY
|
||||
|
||||
|
||||
echo " #### Cloning CoffeeHousePy"
|
||||
git clone https://${GIT_API_KEY}@github.com/Intellivoid/CoffeeHousePy.git
|
||||
cd /CoffeeHousePy
|
||||
git checkout production
|
||||
|
||||
echo " #### Preparing System for Python"
|
||||
make system_prep_python
|
||||
|
||||
echo " #### Preparing System for pip"
|
||||
make system_prep_pip
|
||||
|
||||
echo " #### Preparing System for GCC"
|
||||
make system_prep_gcc
|
||||
|
||||
echo " #### Building and Installing CoffeeHousePy"
|
||||
make install
|
|
@ -0,0 +1,16 @@
|
|||
FROM ubuntu:18.04
|
||||
EXPOSE 5606 5601 5603
|
||||
MAINTAINER Diederik Noordhuis (diederikn@intellivoid.net)
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
COPY Docker/bootstrap /usr/local/bin/bootstrap
|
||||
COPY Docker/update_server /usr/local/bin/update_server
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \
|
||||
apt-get update && \
|
||||
apt-get install git make sudo nano vim wget curl unzip -y && \
|
||||
apt-get clean
|
||||
|
||||
CMD ["/bin/bash", "/usr/local/bin/bootstrap"]
|
13
Makefile
13
Makefile
|
@ -163,4 +163,15 @@ start_spamdetect:
|
|||
python3 -m coffeehouse_spamdetection --start-server
|
||||
|
||||
start_translation:
|
||||
python3 -m coffeehouse_translation --start-server
|
||||
python3 -m coffeehouse_translation --start-server
|
||||
|
||||
# ======================================================================================================================
|
||||
|
||||
docker_build:
|
||||
docker build -t="coffeehouse_utils" -f Dockerfile .
|
||||
|
||||
docker_run:
|
||||
docker run -it --name coffeehouse_utils -h coffeehouse_utils --restart always -p 5601:5601 -p 5606:5606 -p 5603:5603 coffeehouse_utils
|
||||
|
||||
docker_rm:
|
||||
docker rm -f coffeehouse_utils
|
Loading…
Reference in New Issue