You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by rg...@apache.org on 2015/07/29 11:53:23 UTC

svn commit: r1693230 - in /comdev/tools: ./ comdev_tools/ events_list/ events_list/static/ events_list/templates/ events_list/templates/events/ events_list/templates/groups/ events_list/templates/include/ events_list/templates/people/ events_list/templ...

Author: rgardler
Date: Wed Jul 29 09:53:22 2015
New Revision: 1693230

URL: http://svn.apache.org/r1693230
Log:
add some scripting for deployment to a staging server (and some housekeeping)

Added:
    comdev/tools/scripts/config.sh
    comdev/tools/scripts/push.sh
      - copied, changed from r1693229, comdev/tools/scripts/cleanDev.sh
Removed:
    comdev/tools/events_list/.svnignore
    comdev/tools/scripts/cleanDev.sh
Modified:
    comdev/tools/   (props changed)
    comdev/tools/.svnignore
    comdev/tools/comdev_tools/   (props changed)
    comdev/tools/events_list/   (props changed)
    comdev/tools/events_list/static/   (props changed)
    comdev/tools/events_list/templates/   (props changed)
    comdev/tools/events_list/templates/events/   (props changed)
    comdev/tools/events_list/templates/groups/   (props changed)
    comdev/tools/events_list/templates/include/   (props changed)
    comdev/tools/events_list/templates/include/navbar.html
    comdev/tools/events_list/templates/people/   (props changed)
    comdev/tools/events_list/templatetags/   (props changed)
    comdev/tools/readme.md
    comdev/tools/scripts/   (props changed)
    comdev/tools/scripts/.svnignore
    comdev/tools/scripts/config.tmpl

Propchange: comdev/tools/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -1,5 +1,9 @@
 scripts/config.sh
 
+*.cer
+*.pem
+*.pfx
+
 # Generated files
 groups.json
 meetups.json

Modified: comdev/tools/.svnignore
URL: http://svn.apache.org/viewvc/comdev/tools/.svnignore?rev=1693230&r1=1693229&r2=1693230&view=diff
==============================================================================
--- comdev/tools/.svnignore (original)
+++ comdev/tools/.svnignore Wed Jul 29 09:53:22 2015
@@ -1,5 +1,9 @@
 scripts/config.sh
 
+*.cer
+*.pem
+*.pfx
+
 # Generated files
 groups.json
 meetups.json

Propchange: comdev/tools/comdev_tools/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Propchange: comdev/tools/events_list/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -1,7 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
 # Generated files
 groups.json
 meetups.json
 meetups.mdtext
 meetups.mlist
 meetups.tweets
-migrations

Propchange: comdev/tools/events_list/static/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Propchange: comdev/tools/events_list/templates/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Propchange: comdev/tools/events_list/templates/events/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Propchange: comdev/tools/events_list/templates/groups/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Propchange: comdev/tools/events_list/templates/include/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Modified: comdev/tools/events_list/templates/include/navbar.html
URL: http://svn.apache.org/viewvc/comdev/tools/events_list/templates/include/navbar.html?rev=1693230&r1=1693229&r2=1693230&view=diff
==============================================================================
--- comdev/tools/events_list/templates/include/navbar.html (original)
+++ comdev/tools/events_list/templates/include/navbar.html Wed Jul 29 09:53:22 2015
@@ -25,7 +25,7 @@
 	<li class="dropdown">
           <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Actions <span class="caret"></span></a>
           <ul class="dropdown-menu">
-            <li><a href="{% url 'eventListMD' %}">Next week (Markdown)</a></li>
+            <li><a href="{% url 'eventListMD' %}">Upcoming (Markdown)</a></li>
             <li role="separator" class="divider"></li>
   	    {% if can_import %}
 	      <li><a href="{% url 'importMeetups' %}">Import Meetups</a></li>

Propchange: comdev/tools/events_list/templates/people/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Propchange: comdev/tools/events_list/templatetags/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -0,0 +1,12 @@
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Modified: comdev/tools/readme.md
URL: http://svn.apache.org/viewvc/comdev/tools/readme.md?rev=1693230&r1=1693229&r2=1693230&view=diff
==============================================================================
--- comdev/tools/readme.md (original)
+++ comdev/tools/readme.md Wed Jul 29 09:53:22 2015
@@ -3,11 +3,9 @@ development.
 
 # Features #
 
-Currently we have a Command Line Interface and a Web Interface. At the
-time of writing the CLI is more feature complete. Furthermore, at the
-time of writing the two systems do not share the same database, in
-fact the CLI does not persist its data between executions (it is
-written to a JSON file but this is overwritten on each run).
+Currently we have a Command Line Interface and a Web Interface. The
+CLI is easy to use but very simple. The web application has more
+features but is more complex to use (and is in rapid development).
 
 ## Command Line Features ##
 
@@ -22,13 +20,43 @@ application.
 
 ## Web Application Features##
 
-The web application is in development. Youwill probably want to use
-the CLI in preference to the webapp at this point. However, we welcome
-your contributions to the webapp.
-
-  * Import new meetups from meetups.com
-  * Maintain data in a database
-  
+Basic features (mimicking the CLI):
+
+    1)	Visit http://yourhost.com/events
+    2)	View the meetups that have been imported already (if any)
+    3)	[OPTIONAL] Click the "actions" dropdown in the top right and select "Import Meetups" to import any new meetups (be patient)
+    4)	Click the "actions" dropdown in the top right and select "Upcoming (Markdown)"
+
+Now you have your markdown file like the one generated in the
+CLI. we've not implemented the email or twitter files yet. But will
+gladly do so if you actually use them - let us know.
+
+Now for the additional features (there is more than this, poke around,
+I just enumerate the ones I think you will find useful)...
+
+We can define multiple search terms we want to include. It's currently
+set up for "Apache" only but we could add "Hadoop" for
+example. Duplicate events will be removed.
+
+When viewing the events at http://yourhost.com/events you can click
+"Mark Event N/A" and this will hide the event from view (and from the
+markdown export). Better yet you can click "Mark Group N/A" this will
+mark all meetups organized by this group in the database as N/A
+(including ones that are subsequently imported). In other words make
+the "Apache Junction" group as N/A and you'll never see a meetup from
+them again.
+
+Click on a specific meetup and you are given a summary of the
+event. On this page there is a "Later" button. Create yourself a
+Hootsuite account and you can use this to schedule tweets at a
+convenient time.
+
+There is more to the application than this but the above are the
+things that most people find useful from the start. We welcome your
+feature requests (preferably via the ComDev issue tracker). We welcome
+contributions even more and are happy to help you figure out where to
+put them if you want to do it yourself.
+
 # Python CLI Script #
 
 To run the application as a Python script simply execyte get_meetups
@@ -46,16 +74,24 @@ command line menu allowing you to work w
 
 Note that these are POSSIBLY Apache-related. Typically, there's around
 a 50% false positive rate, what with hiking trails, native American
-dance enthusiasts, and heilcopter fans. These lists MUST be manually
+dance enthusiasts, and helicopter fans. These lists MUST be manually
 filtered before they are used anywhere publicly.
 
+See above for a description of a feture in the webapp version that
+helps immensly with this filtering.
+
 If you use this script be respectful of the included API key.
 
+# Webapp #
+
+The webapp is a Dockerized application, the easiest way to get going
+is to read the development section below.
+
 # Development #
 
 ## Docker Prerequisites ##
 
-If you are using Windows as your client machine then it is a good idea
+If you are using Windows as your client mhine then it is a good idea
 to install Git for Windows from http://msysgit.github.io/. This will
 provide both Git and a Bash shell. We will use the Bash shell as a
 convenience since the scripts we have built are Bash scripts.
@@ -76,30 +112,34 @@ Machine on other platforms see: http://d
 
 ### Docker Hosts ###
 
-As a minimum you will need a Docker host for development. You'll most likely
-want this to be on your local machine. So run the following command (as an 
-administrator):
+We provide a number of convenience scripts for working with the
+application in the form of docker containers. In order to use these
+scripts you will need to do the following:
+
+	$ cp scripts/config.tmpl scripts/config.sh
+
+As a minimum you will need a Docker host for development. By default
+this is called "dev" (you can change this name in the config.sh file
+you just created). You'll most likely want this to be on your local
+machine. So run the following command (as an administrator):
 
-	$ docker-machine create -d hyper-v comdev
+	$ docker-machine create -d hyper-v dev
 
 Note the "-d hyper-v" is for Windows machines, you may want to use a
 different provider if you are developing on a different platform.
 
-You'll also need to ensure that your docker client is using this
-machine. Run the following command:
-
-	$ eval "$(docker-machine env comdev)"
+If you want to use a cloud provideor for your staging server then
+create a machine on the appropriate cloud using docker-machine and
+edit config.sh to point to the right machine name.
 
 #### Share your project code with the Docker Host ####
 
 You need to ensure your project directory is available on the Docker
 Host. On Windows you will need to share it explicitly. We've provided
-a helper script to do this. First, create a confiduration file:
-
-	$ cp scripts/config.tmpl scripts/config.sh
+a helper script to do this. 
 
-Edit the 'config.sh' file, paying close attention to the section on
-Windows share configuration.
+You will need to edit the 'config.sh' file, paying close attention to
+the section on Windows share configuration.
 
 Now run:
 
@@ -119,28 +159,32 @@ will be mapped into /project on the cont
 be available in your development container immediately.
 
 We have provided a script that will setup a development environment
-for you. First ensure the Docker CLI is setup to work with the right
-Docker host using the following command:
-
-        $ eval "$(docker-machine env MACHINE_NAME)"
+for you. To setup a clean environment (i.e. no starting data) on
+either your dev or staging server using the command:
 
-Then you can setup a clean dev environment with the command:
+        $ scripts/push.sh
 
-        $ scripts/cleanDev.sh
-
-NOTE: this command kills any running dev containers and restarts them
+NOTE: this command kills any running containers and restarts them
 (see below for less destructive scripts). This will remove any data
 that has been changed during the most recent development
 activity. Only run this command if you are prepared to go back to a
 clean dev state.
 
+Note that while this will start your development environment it does
+not provide any starting data. Log in to your admin interface
+(http:://yourhost.com/admin) and enter at least one
+"hashtag". Hashtags are search terms used when searching meetups.com.
+
 If, rather than creating a clean development environment, you want to
 migrate the database in a running instance of the application to a new
-version of the application use the command (this will generate any
+version of the application use the following command to generate any
 migrations and execute them):
 
         $ script/migrateDev.sh
 
+TODO: make the migration scripts work on staging servers not just dev
+servers
+
 NOTE: This will only work if each new field has defaults provided. The
 system will report errors if no defaults are defined. If you do not
 want to have a default in the final version of the database simply add
@@ -162,10 +206,11 @@ To run individual commands rather than e
 ### Using the Admin Interface ###
 
 To access the admin interface of the application you need an admin
-user account. Assuming you are starting from a clean development
-container (i.e. with no data in the database) you will need to create
-an admin user. To do this run the following command in your Django
-terminal.
+user account. If you used the push.sh script you will have defined an
+admin user during initial deployment of the application.
+
+If you need to create another admin user then run the following
+command:
 
 	$ docker exec -it meetups_app python manage.py createsuperuser
 

Propchange: comdev/tools/scripts/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Jul 29 09:53:22 2015
@@ -1 +1,12 @@
-config.sh
+scripts/config.sh
+
+*.cer
+*.pem
+*.pfx
+
+# Generated files
+groups.json
+meetups.json
+meetups.mdtext
+meetups.mlist
+meetups.tweets

Modified: comdev/tools/scripts/.svnignore
URL: http://svn.apache.org/viewvc/comdev/tools/scripts/.svnignore?rev=1693230&r1=1693229&r2=1693230&view=diff
==============================================================================
--- comdev/tools/scripts/.svnignore (original)
+++ comdev/tools/scripts/.svnignore Wed Jul 29 09:53:22 2015
@@ -1 +1 @@
-config.sh
\ No newline at end of file
+config.sh

Added: comdev/tools/scripts/config.sh
URL: http://svn.apache.org/viewvc/comdev/tools/scripts/config.sh?rev=1693230&view=auto
==============================================================================
--- comdev/tools/scripts/config.sh (added)
+++ comdev/tools/scripts/config.sh Wed Jul 29 09:53:22 2015
@@ -0,0 +1,13 @@
+# Docker Host names
+DEV_MACHINE_NAME=dev
+
+STAGE_MACHINE_NAME=dockerDemo3
+STAGE_PORT=8000
+
+PROD_MACHINE_NAME=tutorialProd
+
+# Variables needed to workaround bug in folder sharing
+# on Windows, see configureDevHyper-v.sh
+USER_NAME=ross@gardler.org
+CLIENT_IP=192.168.1.25
+CLIENT_PATH_TO_PROJECT=Users/Ross/projects/comdev/tools

Modified: comdev/tools/scripts/config.tmpl
URL: http://svn.apache.org/viewvc/comdev/tools/scripts/config.tmpl?rev=1693230&r1=1693229&r2=1693230&view=diff
==============================================================================
--- comdev/tools/scripts/config.tmpl (original)
+++ comdev/tools/scripts/config.tmpl Wed Jul 29 09:53:22 2015
@@ -1,6 +1,9 @@
 # Docker Host names
 DEV_MACHINE_NAME=tutorialDev
+
 STAGE_MACHINE_NAME=tutorialStage
+STAGE_PORT=8888
+
 PROD_MACHINE_NAME=tutorialProd
 
 # Variables needed to workaround bug in folder sharing

Copied: comdev/tools/scripts/push.sh (from r1693229, comdev/tools/scripts/cleanDev.sh)
URL: http://svn.apache.org/viewvc/comdev/tools/scripts/push.sh?p2=comdev/tools/scripts/push.sh&p1=comdev/tools/scripts/cleanDev.sh&r1=1693229&r2=1693230&rev=1693230&view=diff
==============================================================================
--- comdev/tools/scripts/cleanDev.sh (original)
+++ comdev/tools/scripts/push.sh Wed Jul 29 09:53:22 2015
@@ -1,10 +1,23 @@
 echo "##################################################################################################"
-echo "# Check we really want to create clean dev containers"
+echo "# Push a clean build of the containers to dev, stage"
+echo "# BEWARE: this will kill all data on the chosen machine, use with extreme caution"
 echo "##################################################################################################"
 
-PS3='Please enter your choice: '
-options=("Option 1" "Option 2" "Option 3" "Quit")
+source scripts/config.sh
 
+read -p "What kind of deployment do you want (enter 'dev' or 'stage') " type
+case $type in
+    "dev")
+	eval "$(docker-machine env $DEV_MACHINE_NAME)"
+	;;
+    "stage")
+	eval "$(docker-machine env $STAGE_MACHINE_NAME)"
+	;;
+    *)
+	echo "Unkown option, aborting"
+        exit 255
+	;;
+esac
 
 
 echo "DOCKER_HOST is set to $DOCKER_HOST"
@@ -26,7 +39,14 @@ docker rm -f meetups_app
 echo "##################################################################################################"
 echo "# Start the database container"
 echo "##################################################################################################"
-docker run -d -v //home/docker/project:/project -p 5432:5432 --name meetups_db postgres
+case $type in
+    "dev")
+	docker run -d -v //home/docker/project:/project -p 5432:5432 --name meetups_db postgres
+	;;
+    "stage")
+	docker run -d -p 5432:5432 --name meetups_db postgres
+	;;
+esac
 sleep 3 # a small delay to ensure the DB hads time to start before we try to conenct to it
 
 echo "##################################################################################################"
@@ -37,8 +57,16 @@ docker build -t meetups .
 echo "##################################################################################################"
 echo "# Configure the database"
 echo "##################################################################################################"
-docker run --rm -v //home/docker/comdev/meetups:/project --link meetups_db:db meetups python manage.py makemigrations events_list
-docker run --rm -v //home/docker/comdev/meetups:/project --link meetups_db:db meetups python manage.py migrate
+case $type in
+    "dev")
+	docker run --rm -v //home/docker/comdev/meetups:/project --link meetups_db:db meetups python manage.py makemigrations events_list
+	docker run --rm -v //home/docker/comdev/meetups:/project --link meetups_db:db meetups python manage.py migrate
+	;;
+    "stage")
+	docker run --rm --link meetups_db:db meetups python manage.py makemigrations events_list
+	docker run --rm --link meetups_db:db meetups python manage.py migrate
+	;;
+esac
 
 echo "##################################################################################################"
 echo "# Setup a superuser (hit return to continue once created)"
@@ -48,7 +76,14 @@ docker run --rm -it --link meetups_db:db
 echo "##################################################################################################"
 echo "# Run the application"
 echo "##################################################################################################"
-docker run --rm -v //home/docker/comdev/meetups:/project --link meetups_db:db -p 80:8000 --name meetups_app meetups python manage.py runserver 0.0.0.0:8000
+case $type in
+    "dev")
+	docker run --rm -v //home/docker/comdev/meetups:/project --link meetups_db:db -p 80:8000 --name meetups_app meetups python manage.py runserver 0.0.0.0:8000
+	;;
+    "stage")
+	docker run -d --link meetups_db:db -p $STAGE_PORT:8000 --name meetups_app meetups python manage.py runserver 0.0.0.0:8000
+	;;
+esac
 
 echo "##################################################################################################"
 echo "# Assuming no errors above your application is now running."