Add file info domain + change alias + add api docker installation
This commit is contained in:
parent
e5f608a26d
commit
35f5111ffb
@ -1,9 +1,9 @@
|
|||||||
Gitea : git.c2a-systeme.fr -> 8000, 2200
|
Gitea : git.c2a-systeme.fr -> 8000, 2200
|
||||||
Gitlab : gitlab.c2a-systeme.fr -> 8001, 2201
|
Gitlab : gitlab.c2a-systeme.fr -> 8001, 2201
|
||||||
Jenkins : jenkins.c2a-systeme.fr -> 8002
|
Jenkins : jenkins.c2a-systeme.fr -> 8002
|
||||||
Portainer : portainer.c2a-systeme.fr -> 8003
|
Portainer : portainer.c2a-systeme.fr -> 8003
|
||||||
API Prod : api.c2a-systeme.fr -> 8004
|
API Prod : api.c2a-systeme.fr -> 8004
|
||||||
API Dev : dev.api.c2a-systeme.fr -> 8005
|
API Dev : dev.api.c2a-systeme.fr -> 8005
|
||||||
MongoDB : XXX -> 27017
|
MongoDB : XXX -> 27017
|
||||||
Web Platform : www.c2a-systeme.fr -> Nginx
|
Web Platform : www.c2a-systeme.fr -> Nginx
|
||||||
Web App Constat : reports.c2a-systeme.fr -> Nginx
|
Web App Constat : reports.c2a-systeme.fr -> Nginx
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
echo "
|
echo "
|
||||||
# Alias C2A
|
# Alias C2A
|
||||||
alias letsencrypt='/opt/letsencrypt/letsencrypt-auto'
|
|
||||||
alias sdkmanager='/root/tools/bin/sdkmanager --sdk_root=/opt/android-sdk'
|
|
||||||
alias process='ps -ef | grep python3'
|
|
||||||
|
|
||||||
alias pull-dev=' git --git-dir=/home/C2A/C2A-API-DEV/C2A-Api/.git --work-tree=/home/C2A/C2A-API-DEV/C2A-Api/ pull'
|
alias restart-api='docker restart c2a-api-prod'
|
||||||
alias start-dev='nohup python3 /home/C2A/C2A-API-DEV/C2A-Api/c2a_handler_dev.py dev&> /home/C2A/C2A-API-DEV/c2a.dev.log&'
|
alias restart-api-dev='docker restart c2a-api-dev'
|
||||||
alias stop-dev='pgrep -f \"c2a_handler_dev.py dev\" | xargs kill'
|
|
||||||
alias update-dev='stop-dev; pull-dev; start-dev'
|
|
||||||
|
|
||||||
alias pull-prod=' git --git-dir=/home/C2A/C2A-API-PROD/C2A-Api/.git --work-tree=/home/C2A/C2A-API-PROD/C2A-Api/ pull'
|
export PATH=$PATH:/root/.bin
|
||||||
alias start-prod='nohup python3 /home/C2A/C2A-API-PROD/C2A-Api/c2a_handler_dev.py prod&> /home/C2A/C2A-API-PROD/c2a.prod.log&'
|
|
||||||
alias stop-prod='pgrep -f \"c2a_handler_dev.py prod\" | xargs kill'
|
|
||||||
alias update-prod='stop-prod; pull-prod; start-prod'
|
|
||||||
" > /root/.bashrc
|
" > /root/.bashrc
|
11
docker/c2a-api.dockerfile
Normal file
11
docker/c2a-api.dockerfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
FROM python:3.7.3-slim
|
||||||
|
|
||||||
|
ENV ENV dev
|
||||||
|
|
||||||
|
COPY docker/script/start.sh /root/start.sh
|
||||||
|
|
||||||
|
RUN apt-get update; apt-get install -y git
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
ENTRYPOINT /root/start.sh
|
9
docker/script/start-api-dev.sh
Normal file
9
docker/script/start-api-dev.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
docker stop c2a-api-dev; docker rm c2a-api-dev;
|
||||||
|
docker run --detach \
|
||||||
|
--name c2a-api-dev \
|
||||||
|
--publish 8005:5000 \
|
||||||
|
--env ENV='dev' \
|
||||||
|
--volume /root/.ssh:/root/.ssh \
|
||||||
|
--volume /api/dev:/app \
|
||||||
|
--restart unless-stopped \
|
||||||
|
c2a/api
|
9
docker/script/start-api-prod.sh
Normal file
9
docker/script/start-api-prod.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
docker stop c2a-api-prod; docker rm c2a-api-prod;
|
||||||
|
docker run --detach \
|
||||||
|
--name c2a-api-prod \
|
||||||
|
--publish 8004:5000 \
|
||||||
|
--env ENV='prod' \
|
||||||
|
--volume /root/.ssh:/root/.ssh \
|
||||||
|
--volume /api/prod:/app \
|
||||||
|
--restart unless-stopped \
|
||||||
|
c2a/api
|
3
docker/script/start.sh
Normal file
3
docker/script/start.sh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
git -C /app pull
|
||||||
|
pip3 install -r /app/requirements.txt
|
||||||
|
python3 /app/c2a_handler_dev.py ${ENV}
|
11
install.sh
11
install.sh
@ -22,6 +22,17 @@ apt-get install -y docker-ce docker-ce-cli containerd.io
|
|||||||
# Add Alias in bash
|
# Add Alias in bash
|
||||||
./docker/add-alias.sh
|
./docker/add-alias.sh
|
||||||
|
|
||||||
|
# Generate Docker Image for api
|
||||||
|
|
||||||
|
docker build -f docker/c2a-api.dockerfile -t c2a/api .
|
||||||
|
|
||||||
|
# Copy script to launch APIs
|
||||||
|
# Need to clone in /app/dev for dev and /app/prod for prod
|
||||||
|
|
||||||
|
mkdir /root/.bin
|
||||||
|
cp docker/script/start-api-dev.sh /root/.bin
|
||||||
|
cp docker/script/start-api-prod.sh /root/.bin
|
||||||
|
|
||||||
# Install let's encrypt
|
# Install let's encrypt
|
||||||
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
|
git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user