Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hunter T Jozwiak
whats-open
Commits
ccb153a4
Commit
ccb153a4
authored
Oct 13, 2017
by
David Haynes
🙆
Browse files
Merge branch '67-docker-swarm' into '2.1-dev'
Resolve "Docker Stack/Swarm Integration" See merge request
!27
parents
118b97b4
8a0111fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
ccb153a4
############################################################
#
Dockerfile to build
What's Open
Django App
# What's Open
API v2
############################################################
# Set the base image to Ubuntu
...
...
@@ -10,8 +10,10 @@ ENV PYTHONUNBUFFERED 1
RUN
apt-get update
RUN
apt-get
install
netcat libgdal1h libproj-dev proj-data proj-bin
-y
RUN
mkdir
/whats_open
WORKDIR
/whats_open
ADD
/requirements/ /whats_open/
RUN
pip
install
-r
base.txt
ADD
. /whats_open/
# Copy over all project files into /whats_open
RUN
mkdir
/whats-open/
WORKDIR
/whats-open/
ADD
. /whats-open/
# Pip install all required dependecies
RUN
pip
install
-r
/whats-open/requirements/base.txt
README.md
View file @
ccb153a4
...
...
@@ -121,19 +121,17 @@ Additionally, you will need to install docker-compose: https://docs.docker.com/c
Next inside the
`whats-open/`
root directory run:
docker
-compose build
docker
build . -t 'whats-open-api'
If that doesn't work, try:
This builds the docker image that we will deploy to the swarm in a stack.
sudo docker-compose build
Initialize your swarm:
Then, follow up with:
docker swarm init
docker-compose up
And finally,
If that doesn't work, try:
sudo docker-compose build
docker stack deploy whats-open-api_stack -c docker-compose.yml
You should see that the server is running by going to http://localhost:8000
in your browser. Any changes you make to your local file system will be mirrored in the server.
...
...
docker-compose.yml
View file @
ccb153a4
version
:
'
2
'
version
:
'
3
'
services
:
wopen_web
:
build
:
.
restart
:
always
db
:
image
:
mysql
deploy
:
replicas
:
1
restart_policy
:
condition
:
on-failure
networks
:
-
wopen_net
ports
:
-
"
3306:3306"
environment
:
MYSQL_ALLOW_EMPTY_PASSWORD
:
'
yes'
MYSQL_DATABASE
:
wopen
MYSQL_USER
:
wopen
MYSQL_PASSWORD
:
wopen
api
:
image
:
whats-open-api
deploy
:
replicas
:
1
restart_policy
:
condition
:
on-failure
networks
:
-
wopen_net
ports
:
-
'
8000:8000'
command
:
/bin/bash ./startup.sh
volumes
:
-
.:/whats
_
open
-
.:/whats
-
open
depends_on
:
-
wopen_
db
-
db
environment
:
-
WOPEN_EMAIL_DOMAIN=@masonlive.gmu.edu
-
WOPEN_DB_NAME=wopen
-
WOPEN_DB_USER=wopen
-
WOPEN_DB_PASSWORD=wopen
-
WOPEN_DB_HOST=
wopen_
db
-
WOPEN_DB_HOST=db
-
WOPEN_DB_PORT=3306
-
WOPEN_SUPERUSER=admin
wopen_db
:
image
:
mysql
environment
:
MYSQL_ALLOW_EMPTY_PASSWORD
:
'
yes'
MYSQL_DATABASE
:
wopen
MYSQL_USER
:
wopen
MYSQL_PASSWORD
:
wopen
\ No newline at end of file
networks
:
wopen_net
:
\ No newline at end of file
startup.sh
View file @
ccb153a4
until
nc
-z
wopen_
db 3306
;
do
until
nc
-z
db 3306
;
do
echo
"waiting for database to start..."
sleep
1
done
...
...
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