Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dtu-enote-website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
enote
dtu-enote-website
Commits
7f0244d3
Commit
7f0244d3
authored
Mar 5, 2019
by
iaibrys
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup scripts and move precompile to dockerfile
parent
5df4103a
No related branches found
No related tags found
No related merge requests found
Pipeline
#67
passed
Mar 5, 2019
Stage: build
Stage: test
Stage: release
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dockerfile
+2
-0
2 additions, 0 deletions
Dockerfile
deps/dtu-quiz-parser
+1
-1
1 addition, 1 deletion
deps/dtu-quiz-parser
scripts/run-server.sh
+24
-28
24 additions, 28 deletions
scripts/run-server.sh
with
27 additions
and
29 deletions
Dockerfile
+
2
−
0
View file @
7f0244d3
...
@@ -88,5 +88,7 @@ RUN mkdir -p ${APP_ROOT}/log
...
@@ -88,5 +88,7 @@ RUN mkdir -p ${APP_ROOT}/log
# Generate cookie key
# Generate cookie key
RUN
RAILS_ENV
=
production
PRECOMPILE
=
1 bundle
exec
rake secret
>
~/secret-key-base.txt
RUN
RAILS_ENV
=
production
PRECOMPILE
=
1 bundle
exec
rake secret
>
~/secret-key-base.txt
RUN
RAILS_ENV
=
production
PRECOMPILE
=
1 bundle
exec
rake assets:precompile
CMD
["/bin/bash", "-l", "-c", "./scripts/run-server.sh 2>&1 | tee ${APP_ROOT}/log/run-server.log"]
CMD
["/bin/bash", "-l", "-c", "./scripts/run-server.sh 2>&1 | tee ${APP_ROOT}/log/run-server.log"]
This diff is collapsed.
Click to expand it.
dtu-quiz-parser
@
bd85823f
Compare
342df358
...
bd85823f
Subproject commit
342df358ddfdce10717598e5ea39f59094e21cb5
Subproject commit
bd85823fdb0a6926f45023dd886e290b1379db89
This diff is collapsed.
Click to expand it.
scripts/run-server.sh
+
24
−
28
View file @
7f0244d3
#!/bin/bash
#!/bin/bash
timestamp
()
timestamp
()
{
date
"+%FT%T%z"
;
}
{
date
"+%FT%T%z"
log
()
{
echo
"[
$(
timestamp
)
]
${
@
}
"
;
}
}
public
=
/data/website-public
public
=
/data/website-public
CHOWN
=
${
CHOWN
:-
dtuuser
:dtugroup
}
echo
[
$(
timestamp
)
]
RUNNING WEBSITE SERVER AS
`
whoami
`
log
"
RUNNING WEBSITE SERVER AS
$(
whoami
)
(
${
CHOWN
}
)"
echo
[
$(
timestamp
)
]
RUNNING WEBSITE IN TIMEZONE
${
TZ
}
log
"
RUNNING WEBSITE IN TIMEZONE
${
TZ
}
"
echo
[
$(
timestamp
)
]
STARTING SERVER FOR STARTUP MESSAGE
log
"
STARTING SERVER FOR STARTUP MESSAGE
"
export
PORT
=
3000
export
PORT
=
3000
indexpage
=
_rails_starting.html bundle
exec
thin
-R
./maintenance.ru
-p
$PORT
start &
indexpage
=
_rails_starting.html bundle
exec
thin
-R
./maintenance.ru
-p
$
{
PORT
}
start &
ruby
-v
|
grep
"2
\.
5
\.
1"
ruby
-v
|
grep
"2
\.
5
\.
1"
rc
=
$?
if
[[
$?
!=
0
]]
;
then
if
[[
${
rc
}
!=
0
]]
;
then
echo
"Wrong version of Ruby installed!"
echo
"Wrong version of Ruby installed!"
ruby
-v
ruby
-v
exit
${
rc
}
;
exit
${
?
}
;
fi
fi
RAILS_ENV
=
${
RAILS_ENV
:
=
"development"
}
RAILS_ENV
=
${
RAILS_ENV
:
=
"development"
}
...
@@ -35,26 +34,23 @@ curl http://localhost:${PORT}
...
@@ -35,26 +34,23 @@ curl http://localhost:${PORT}
SECRET_KEY_BASE
=
${
SECRET_KEY_BASE
:
=
`
cat
~/secret-key-base.txt
`
}
SECRET_KEY_BASE
=
${
SECRET_KEY_BASE
:
=
`
cat
~/secret-key-base.txt
`
}
export
SECRET_KEY_BASE
=
${
SECRET_KEY_BASE
}
export
SECRET_KEY_BASE
=
${
SECRET_KEY_BASE
}
echo
REMOVING TMP
log
"
REMOVING TMP
"
rm
-rf
tmp/
*
rm
-rf
tmp/
*
rm
-rf
${
APP_ROOT
}
/log/
*
rm
-rf
${
APP_ROOT
}
/log/
*
mkdir
-p
${
APP_ROOT
}
/log/
mkdir
-p
${
APP_ROOT
}
/log/
echo
[
$(
timestamp
)
]
LINKING SHARED ASSETS AND LOGFILES
log
"LINKING SHARED ASSETS AND LOG FILES"
RAILS_ENV
=
production bundle
exec
rake assets:clobber
RAILS_ENV
=
production bundle
exec
rake assets:precompile
# gross! https://github.com/docker/docker/issues/2259
# gross! https://github.com/docker/docker/issues/2259
sudo chown
-R
dtuuser:dtuuser
/data/
*
sudo chown
-R
${
CHOWN
}
/data/
*
sshdir
=
/home/
`
whoami
`
/.ssh
sshdir
=
/home/
$(
whoami
)
/.ssh
[[
-d
${
sshdir
}
]]
||
mkdir
${
sshdir
}
[[
-d
${
sshdir
}
]]
||
mkdir
${
sshdir
}
sudo
sh
-c
"cp /get-pdf-keys/*
${
sshdir
}
&& chown -R
dtuuser:dtugroup
${
sshdir
}
/*"
sudo
sh
-c
"cp /get-pdf-keys/*
${
sshdir
}
&& chown -R
${
CHOWN
}
${
sshdir
}
/*"
sudo chmod
0600
${
sshdir
}
/
*
sudo chmod
0600
${
sshdir
}
/
*
echo
COPYING PRECOMPILED APP ASSETS
log
"
COPYING PRECOMPILED APP ASSETS
"
# make these available for nginx to serve statically
# make these available for nginx to serve statically
cp
-R
./public/
*
${
public
}
cp
-R
./public/
*
${
public
}
...
@@ -68,7 +64,7 @@ cp -R deps/pdfjs/build/generic/web/* ${public}/assets/pdfjs-viewer/
...
@@ -68,7 +64,7 @@ cp -R deps/pdfjs/build/generic/web/* ${public}/assets/pdfjs-viewer/
cp
-R
deps/pdfjs/build/generic/web
${
public
}
/assets/pdfjs-viewer/
cp
-R
deps/pdfjs/build/generic/web
${
public
}
/assets/pdfjs-viewer/
cp
-R
deps/pdfjs/build/generic/build
${
public
}
/assets/pdfjs-viewer/
cp
-R
deps/pdfjs/build/generic/build
${
public
}
/assets/pdfjs-viewer/
echo
[
$(
timestamp
)
]
FLUSHING REDIS SOFT-STATE CACHE
log
"
FLUSHING REDIS SOFT-STATE CACHE
"
redis-cli
-h
redis
-n
1 flushdb
redis-cli
-h
redis
-n
1 flushdb
...
@@ -79,26 +75,26 @@ redis-cli -h redis -n 1 flushdb
...
@@ -79,26 +75,26 @@ redis-cli -h redis -n 1 flushdb
# For feedback.js
# For feedback.js
cp
./vendor/assets/components/feedback/stable/2.0/icons.png
${
public
}
/assets
cp
./vendor/assets/components/feedback/stable/2.0/icons.png
${
public
}
/assets
echo
[
$(
timestamp
)
]
DONE PRECOMPILING ASSETS
log
"
DONE PRECOMPILING ASSETS
"
echo
[
$(
timestamp
)
]
MIGRATING DB
log
"
MIGRATING DB
"
bundle
exec
rake db:migrate
bundle
exec
rake db:migrate
echo
[
$(
timestamp
)
]
KILLING SERVER FOR STARTUP MESSAGE
log
"
KILLING SERVER FOR STARTUP MESSAGE
"
kill
$(
jobs
-p
)
kill
$(
jobs
-p
)
wait
wait
echo
[
$(
timestamp
)
]
STARTING RAILS WITH
RAILS_ENV
=
${
RAILS_ENV
}
log
"
STARTING RAILS WITH RAILS_ENV=
${
RAILS_ENV
}
"
foreman start
foreman start
echo
[
$(
timestamp
)
]
RAILS DIED!
log
"
RAILS DIED!
"
echo
[
$(
timestamp
)
]
STARTING SERVER FOR FAIL MESSAGE
log
"
STARTING SERVER FOR FAIL MESSAGE
"
indexpage
=
_rails_failed.html bundle
exec
thin
-R
./maintenance.ru
-p
${
PORT
}
start
indexpage
=
_rails_failed.html bundle
exec
thin
-R
./maintenance.ru
-p
${
PORT
}
start
echo
[
$(
timestamp
)
]
WAITING FOREVER SO CONTAINER STAYS ACTIVE FOR DEBUGGING
log
"
WAITING FOREVER SO CONTAINER STAYS ACTIVE FOR DEBUGGING
"
tail
-F
-n0
/etc/hosts
tail
-F
-n0
/etc/hosts
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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