Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
5c8da842
Commit
5c8da842
authored
Apr 10, 2020
by
John Red Medrano
Browse files
Options
Browse Files
Download
Plain Diff
testing
parents
b950b7b2
16f21014
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
60 deletions
+66
-60
.env
.env
+2
-0
.gitlab-ci.yml
.gitlab-ci.yml
+9
-3
Dockerfile.template
Dockerfile.template
+0
-7
config/settings/base.py
config/settings/base.py
+1
-1
docker-compose.yml.template
docker-compose.yml.template
+5
-23
env.new_template.ini
env.new_template.ini
+20
-25
requirements/export docker image.txt
requirements/export docker image.txt
+5
-0
requirements/reference-ci
requirements/reference-ci
+22
-0
test.env
test.env
+2
-1
No files found.
.env
0 → 100644
View file @
5c8da842
export=9000
local=8000
\ No newline at end of file
.gitlab-ci.yml
View file @
5c8da842
...
@@ -20,8 +20,14 @@ initial_repo:
...
@@ -20,8 +20,14 @@ initial_repo:
-
ssh -tt centos@13.251.192.208 "cd $root_path/dev && sudo git clone http://tir:Qwerty1234@54.169.104.100:27015/red/red-ci-cd.git -b $dev"
-
ssh -tt centos@13.251.192.208 "cd $root_path/dev && sudo git clone http://tir:Qwerty1234@54.169.104.100:27015/red/red-ci-cd.git -b $dev"
-
ssh -tt centos@13.251.192.208 "sudo cp $root_path/dev/$repo_folder/docker-compose.yml.template $root_path/dev/$repo_folder/docker-compose.yml"
-
ssh -tt centos@13.251.192.208 "sudo cp $root_path/dev/$repo_folder/docker-compose.yml.template $root_path/dev/$repo_folder/docker-compose.yml"
-
ssh -tt centos@13.251.192.208 "sudo cp $root_path/dev/$repo_folder/Dockerfile.template $root_path/dev/$repo_folder/Dockerfile"
-
ssh -tt centos@13.251.192.208 "sudo cp $root_path/dev/$repo_folder/Dockerfile.template $root_path/dev/$repo_folder/Dockerfile"
-
ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && $TIRdevINI"
-
ssh -tt centos@13.251.192.208 "sudo cp $root_path/dev/$repo_folder/env.new_template.ini $root_path/dev/$repo_folder/env.ini"
-
ssh -tt centos@13.251.192.208 "sudo echo 'DATABASE_NAME = rms_db' >> env.ini"
-
ssh -tt centos@13.251.192.208 "sudo echo 'DATABASE_USER = red_database' >> env.ini"
-
ssh -tt centos@13.251.192.208 "sudo echo 'DATABASE_PASSWORD = password123' >> env.ini"
-
ssh -tt centos@13.251.192.208 "sudo echo 'DATABASE_HOST = localhost' >> env.ini"
-
ssh -tt centos@13.251.192.208 "sudo echo 'DATABASE_PORT = 3306' >> env.ini"
-
ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose build --build-arg test=hello xxx"
-
ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose build --build-arg test=hello xxx"
-
ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker run -d --restart=always -p 1010:8000 red-test python manage.py runserver 0.0.0.0:8000"
# - ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose -f docker-compose.yml -p $var_dev_container down"
# - ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose -f docker-compose.yml -p $var_dev_container down"
# - ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose -f docker-compose.yml -p $var_dev_container up -d --build"
# - ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose -f docker-compose.yml -p $var_dev_container up -d --build"
-
echo "Initial dev environment for red test ci cd"
-
echo "Initial dev environment for red test ci cd"
...
@@ -38,7 +44,7 @@ clean_initial_repo:
...
@@ -38,7 +44,7 @@ clean_initial_repo:
stage
:
clean_initial_repo
stage
:
clean_initial_repo
image
:
ubuntu
image
:
ubuntu
rules
:
rules
:
-
if
:
'
$CI_COMMIT_MESSAGE
=~
/deploy-dev/
&&
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
$dev'
-
if
:
'
$CI_COMMIT_MESSAGE
=~
/deploy-dev/
&&
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
$dev
||
$CI_COMMIT_BRANCH
==
"red-develop"
'
when
:
on_failure
when
:
on_failure
script
:
script
:
-
echo "this is a clean up for clean_initial_repo"
-
echo "this is a clean up for clean_initial_repo"
...
@@ -48,5 +54,5 @@ clean_initial_repo:
...
@@ -48,5 +54,5 @@ clean_initial_repo:
-
chmod 700 ~/.ssh
-
chmod 700 ~/.ssh
-
echo "$CENTOS_SERVER" | ssh-add - > ~/.ssh/id_rsa
-
echo "$CENTOS_SERVER" | ssh-add - > ~/.ssh/id_rsa
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
'
[[
-f
/.dockerenv
]]
&&
echo
-e
"Host
*\n\tStrictHostKeyChecking
no\n\n"
>
~/.ssh/config'
-
ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose -f docker-compose.yml -p $var_dev_container down"
#
- ssh -tt centos@13.251.192.208 "cd $root_path/dev/$repo_folder && docker-compose -f docker-compose.yml -p $var_dev_container down"
-
ssh -tt centos@13.251.192.208 "sudo rm -rf $root_path/dev"
-
ssh -tt centos@13.251.192.208 "sudo rm -rf $root_path/dev"
\ No newline at end of file
Dockerfile.template
View file @
5c8da842
FROM python:3.6
FROM python:3.6
ARG test
# ENV xxx ${test}
ENV port $port
ENV wow2 "from dockerfile"
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONUNBUFFERED 1
ADD . /code
ADD . /code
COPY . /code
COPY . /code
WORKDIR /code
WORKDIR /code
# RUN echo "Build number: $IMAGE_NAME"
RUN pip install -r requirements/local.txt
RUN pip install -r requirements/local.txt
EXPOSE ${export}
# EXPOSE "${export}"
RUN python manage.py migrate
RUN python manage.py migrate
config/settings/base.py
View file @
5c8da842
...
@@ -192,7 +192,7 @@ CHANNEL_LAYERS = {
...
@@ -192,7 +192,7 @@ CHANNEL_LAYERS = {
print
(
os
.
environ
)
print
(
os
.
environ
)
DATABASES
=
{
DATABASES
=
{
'default'
:
{
'default'
:
{
'ENGINE'
:
config
[
'SETTINGS'
][
'DATABASE_ENGINE'
]
,
'ENGINE'
:
"django.db.backends.mysql"
,
'NAME'
:
config
[
'SETTINGS'
][
'DATABASE_NAME'
],
'NAME'
:
config
[
'SETTINGS'
][
'DATABASE_NAME'
],
'USER'
:
config
[
'SETTINGS'
][
'DATABASE_USER'
],
'USER'
:
config
[
'SETTINGS'
][
'DATABASE_USER'
],
'PASSWORD'
:
config
[
'SETTINGS'
][
'DATABASE_PASSWORD'
],
'PASSWORD'
:
config
[
'SETTINGS'
][
'DATABASE_PASSWORD'
],
...
...
docker-compose.yml.template
View file @
5c8da842
version: '3'
version: '3'
services:
services:
xxx:
dev:
# environment:
image: product-dev
# - $IMAGE_NAME
# - $wow
env_file:
- test.env
image: red-test
build:
build:
context: .
context: .
dockerfile: Dockerfile
dockerfile: Dockerfile
command: python manage.py runserver 0.0.0.0:8000
command: python manage.py runserver 0.0.0.0:8000
volumes:
volumes:
- .:/code
- .:/code
ports:
sit:
- "${export}:8000"
image: product-sit
container_name: dev_rmsv2_api_container
restart: always
ddd:
# environment:
# - $IMAGE_NAME
# - $wow
env_file:
- test.env
image: red-test
build:
build:
context: .
context: .
dockerfile: Dockerfile
dockerfile: Dockerfile
command:
"python manage.py runserver 0.0.0.0:${export}"
command:
python manage.py runserver 0.0.0.0:8000
volumes:
volumes:
- .:/code
- .:/code
ports:
- "${export}:${export}"
container_name: dev_rmsv2_api_container
restart: always
env.new_template.ini
View file @
5c8da842
[SETTINGS]
BATCH_UPLOAD_FORMAT_FILENAME
=
instruction.pdf
SSL
=
1
DATABASE_ENGINE
=
django.db.backends.mysql
DATABASE_NAME
=
rms_db
DATABASE_USER
=
red_database
DATABASE_PASSWORD
=
password123
DATABASE_HOST
=
localhost
DATABASE_PORT
=
3306
SESSION_TIMEOUT
=
30
FRONT_END_URL
=
http://devweb.rmsv2.oneberrysystem.com
AUTH_ACCESSS_TOKEN_TIMEOUT
=
3600
USER_DEFAULT_PASSWORD
=
password
CATCH_EMAIL
=
gladys@tirsolutions.com
CR_LINK
=
http://localhost:8000/cms/change-request/form/view
REALTIMESERVER_IP
=
127.0.0.1:8000
DEBUG
=
False
app_id
=
957253
key
=
c29a7f6579108991e79e
secret
=
b3df5d55196b5fbd3eff
cluster
=
api
cms_notification
=
cms_notification
[NOTIFICATION_EMAIL]
[NOTIFICATION_EMAIL]
APPROVER_MESSAGE
=
has sent you an APPROVAL REQUEST for change request;RMS-ACTIONREQUIRED
APPROVER_MESSAGE
=
has sent you an APPROVAL REQUEST for change request;RMS-ACTIONREQUIRED
REQUESTOR_MESSAGE
=
has APPROVED the change request;RMS-CRAPPROVED
REQUESTOR_MESSAGE
=
has APPROVED the change request;RMS-CRAPPROVED
...
@@ -39,4 +15,23 @@ APPROVER_REJECT_MESSAGE = has REJECTED the change request for your approval;RMS-
...
@@ -39,4 +15,23 @@ APPROVER_REJECT_MESSAGE = has REJECTED the change request for your approval;RMS-
[APPLICATION_CODE]
[APPLICATION_CODE]
RMS
=
APP-20190923-0000001
RMS
=
APP-20190923-0000001
CMS
=
APP-20190923-0000002
CMS
=
APP-20190923-0000002
AMS
=
APP-20190923-0000003
AMS
=
APP-20190923-0000003
\ No newline at end of file
[SETTINGS]
BATCH_UPLOAD_FORMAT_FILENAME
=
instruction.pdf
SSL
=
1
SESSION_TIMEOUT
=
30
FRONT_END_URL
=
http://devweb.rmsv2.oneberrysystem.com
AUTH_ACCESSS_TOKEN_TIMEOUT
=
3600
USER_DEFAULT_PASSWORD
=
password
CATCH_EMAIL
=
gladys@tirsolutions.com
CR_LINK
=
http://localhost:8000/cms/change-request/form/view
REALTIMESERVER_IP
=
127.0.0.1:8000
DEBUG
=
False
app_id
=
957253
key
=
c29a7f6579108991e79e
secret
=
b3df5d55196b5fbd3eff
cluster
=
api
cms_notification
=
cms_notification
\ No newline at end of file
requirements/export docker image.txt
View file @
5c8da842
...
@@ -21,3 +21,8 @@ Clear Cache REDIS
...
@@ -21,3 +21,8 @@ Clear Cache REDIS
docker exec -it container-name redis-cli FLUSHALL
docker exec -it container-name redis-cli FLUSHALL
config set stop-writes-on-bgsave-error no
config set stop-writes-on-bgsave-error no
docker run -p 6379:6379 -d redis:2.8
docker run -p 6379:6379 -d redis:2.8
add string with line number on existing file 3 is the line number
ex -s -c '3i|hello world' -c x file.txt
\ No newline at end of file
requirements/reference-ci
0 → 100644
View file @
5c8da842
how to save a file from gitlab variable to remote server like TIRDEV
sudo bash -c "
cat <<EOF > docker-compose.yml
version: '3'
services:
web:
image: xxx-rmsv2:latest
build:
context: .
dockerfile: reddockerfile
env_file:
- test.env
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "\"1111:8000"\"
container_name: xxx_rmsv2_api_container
restart: always
EOF"
\ No newline at end of file
test.env
View file @
5c8da842
MY_SECRET_KEY=SOME_SECRET
MY_SECRET_KEY=SOME_SECRET
IMAGE_NAME=wow_red
IMAGE_NAME=wow_red
wow=from_env
wow=from_env
export=8080
export=1414
\ No newline at end of file
local=8000
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment