Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ebi-style-lab - mirror
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ebiwd
ebi-style-lab - mirror
Commits
54a14f93
Commit
54a14f93
authored
5 years ago
by
Peter Walter
Browse files
Options
Downloads
Patches
Plain Diff
add k8s deployment
parent
f931c63c
No related branches found
No related tags found
No related merge requests found
Pipeline
#30755
failed with stages
in 4 minutes and 37 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+71
-2
71 additions, 2 deletions
.gitlab-ci.yml
Dockerfile
+15
-0
15 additions, 0 deletions
Dockerfile
docker-assets/default.conf
+54
-0
54 additions, 0 deletions
docker-assets/default.conf
docker-assets/nginx.conf
+43
-0
43 additions, 0 deletions
docker-assets/nginx.conf
with
183 additions
and
2 deletions
.gitlab-ci.yml
+
71
−
2
View file @
54a14f93
...
...
@@ -18,6 +18,8 @@ variables:
stages
:
-
build
-
deploy
-
deploy_dev
-
deploy_prod
build
:
stage
:
build
...
...
@@ -46,7 +48,7 @@ build:
-
add-ssh-key ${SSH_OWNER} "${SSH_OWNER_KEY}"
-
add-search-domain ebi.ac.uk
deploy_dev
:
&deploy
deploy_dev
:
&deploy
_vm
<<
:
*deploy_setup
variables
:
NAME
:
dev
...
...
@@ -65,7 +67,7 @@ deploy_dev: &deploy
url
:
${URL}
deploy_live
:
<<
:
*deploy
<<
:
*deploy
_vm
only
:
-
tags
variables
:
...
...
@@ -73,3 +75,70 @@ deploy_live:
URL
:
${PROD_URL}
DEST
:
${PROD_DEST}
VMS
:
${PROD_SERVER}
build_docker
:
stage
:
build
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
before_script
:
-
export CI_COMMIT_SHA_SHORT=${CI_COMMIT_SHA::8}
-
export CI_REGISTRY=dockerhub.ebi.ac.uk
-
export IMAGE_NAME=$CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_SHA_SHORT
script
:
-
echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
-
/kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $IMAGE_NAME
# Reusable template, requires the $KUBE_CONFIG and $NAMESPACE variables to be set
# This subsitutes the environment variable $IMAGE_NAME in the overlay file, and deploys
.template
:
&deploy
image
:
ebiwd/alpine-ssh:latest
# Can't use the {::8} notation to get a short sha in the variables section, so exporting below
# Also the CI_REGISTRY variable is set incorrectly in GitLab - so exporting to correct value
before_script
:
-
export CI_COMMIT_SHA_SHORT=${CI_COMMIT_SHA::8}
-
export CI_REGISTRY=dockerhub.ebi.ac.uk
-
export IMAGE_NAME=$CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_SHA_SHORT
script
:
-
mkdir -p $HOME/.kube
-
echo -n $KUBE_CONFIG | base64 -d > $HOME/.kube/config
-
envsubst '$IMAGE_NAME' < k8s/overlays/caas/ci_image.yaml > file.tmp && mv file.tmp k8s/overlays/caas/ci_image.yaml
-
kubectl kustomize k8s/overlays/caas/ | kubectl --namespace=$NAMESPACE apply -f -
deploy_to_hh_dev
:
stage
:
deploy_dev
variables
:
NAMESPACE
:
static-sites-dev
KUBE_CONFIG
:
$HH_KUBE_CONFIG
<<
:
*deploy
deploy_to_hx_dev
:
stage
:
deploy_dev
variables
:
NAMESPACE
:
static-sites-dev
KUBE_CONFIG
:
$HX_KUBE_CONFIG
<<
:
*deploy
deploy_to_hh_prod
:
stage
:
deploy_prod
only
:
-
tags
except
:
-
branches
variables
:
NAMESPACE
:
static-sites-prod
KUBE_CONFIG
:
$HH_KUBE_CONFIG
<<
:
*deploy
deploy_to_hx_prod
:
stage
:
deploy_prod
only
:
-
tags
except
:
-
branches
variables
:
NAMESPACE
:
static-sites-prod
KUBE_CONFIG
:
$HX_KUBE_CONFIG
<<
:
*deploy
This diff is collapsed.
Click to expand it.
Dockerfile
0 → 100644
+
15
−
0
View file @
54a14f93
FROM
ebiwd/node-bower-gulp:6
as
builder
WORKDIR
/tmp
COPY
. /tmp
RUN
npm
install
--quiet
&&
\
bower
--allow-root
install
--quiet
&&
\
npm run build
FROM
nginx:1.17.2-alpine
COPY
docker-assets/nginx.conf /etc/nginx/nginx.conf
COPY
docker-assets/default.conf /etc/nginx/conf.d/default.conf
COPY
--from=builder /tmp/dist /usr/share/nginx/html/style-lab
This diff is collapsed.
Click to expand it.
docker-assets/default.conf
0 → 100644
+
54
−
0
View file @
54a14f93
server
{
listen
80
;
server_name
localhost
;
root
/
usr
/
share
/
nginx
/
html
;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location
/ {
index
index
.
html
index
.
htm
;
expires
1
m
;
add_header
Cache
-
Control
"public"
;
}
# caching for static assets
location
~* \.(?:
jpg
|
jpeg
|
gif
|
png
|
ico
|
xml
|
css
|
js
)$ {
expires
1
d
;
add_header
Cache
-
Control
"public"
;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page
500
502
503
504
/
50
x
.
html
;
location
= /
50
x
.
html
{
root
/
usr
/
share
/
nginx
/
html
;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
This diff is collapsed.
Click to expand it.
docker-assets/nginx.conf
0 → 100644
+
43
−
0
View file @
54a14f93
user
nginx
;
worker_processes
1
;
error_log
/var/log/nginx/error.log
warn
;
pid
/var/run/nginx.pid
;
events
{
worker_connections
1024
;
}
http
{
include
/etc/nginx/mime.types
;
default_type
application/octet-stream
;
log_format
main
'
$remote_addr
-
$remote_user
[
$time_local
]
"
$request
"
'
'
$status
$body_bytes_sent
"
$http_referer
"
'
'"
$http_user_agent
"
"
$http_x_forwarded_for
"'
;
access_log
/var/log/nginx/access.log
main
;
sendfile
on
;
#tcp_nopush on;
keepalive_timeout
65
;
#Enable gzip
gzip
on
;
gzip_disable
"msie6"
;
gzip_vary
on
;
gzip_proxied
any
;
gzip_comp_level
6
;
gzip_buffers
16
8k
;
gzip_http_version
1.1
;
gzip_types
application/javascript
application/rss
+xml
application/vnd
.ms-fontobject
application/x-font
application/x-font-opentype
application/x-font-otf
application/x-font-truetype
application/x-font-ttf
application/x-javascript
application/xhtml
+xml
application/xml
font/opentype
font/otf
font/ttf
image/svg
+xml
image/x-icon
text/css
text/javascript
text/plain
text/xml
;
#Use relative redirects to avoid issues with ports between different on k8s ingress/services and the pods
absolute_redirect
off
;
include
/etc/nginx/conf.d/*.conf
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment