make_dev_container
Expand on support for devs by scripting the process of creating, starting, and initialising a dev container. Take container name as an optional parameter
This commit is contained in:
		
							parent
							
								
									fb5d0b8941
								
							
						
					
					
						commit
						fe8da10c22
					
				
					 2 changed files with 47 additions and 7 deletions
				
			
		
							
								
								
									
										42
									
								
								README.rst
									
										
									
									
									
								
							
							
						
						
									
										42
									
								
								README.rst
									
										
									
									
									
								
							|  | @ -1,5 +1,7 @@ | ||||||
| symposion_app | symposion_app | ||||||
| =============== | ============= | ||||||
|  | 
 | ||||||
|  | .. contents:: | ||||||
| 
 | 
 | ||||||
| At this time, considerations have not been made to have the django project run | At this time, considerations have not been made to have the django project run | ||||||
| without additional infrastructure. | without additional infrastructure. | ||||||
|  | @ -40,8 +42,36 @@ You may consider testing with testshib. | ||||||
| 
 | 
 | ||||||
| Configure signing and encryption keys, and configure them in the settings.py | Configure signing and encryption keys, and configure them in the settings.py | ||||||
| 
 | 
 | ||||||
| VirtualEnv | Running a dev instance in Docker | ||||||
| ~~~~~~~~~~ | -------------------------------- | ||||||
|  | 
 | ||||||
|  | Assuming you have docker installed and working on your machine:: | ||||||
|  |     ./make_dev_container.sh | ||||||
|  | 
 | ||||||
|  | will build you a container and run through the initial setup steps. | ||||||
|  | The last stage interactively creates a superuser account: you'll need | ||||||
|  | to interact with this for it to finish. | ||||||
|  | 
 | ||||||
|  | Once this has completed, you can hit http://localhost:28000/admin to | ||||||
|  | log into the admin interface. Once you're logged in, | ||||||
|  | http://localhost:28000 will take you to the dashboard. | ||||||
|  | 
 | ||||||
|  | Note that when you do this you're logged in as a superuser, so what | ||||||
|  | you see will be different from what a normal user will see. | ||||||
|  | 
 | ||||||
|  | Making migrations | ||||||
|  | ~~~~~~~~~~~~~~~~~ | ||||||
|  | 
 | ||||||
|  | If you make changes to the data model, you'll need to run "manage.py | ||||||
|  | makemigrations" to create a matching migration file. If you're on a | ||||||
|  | mac, or a system without python3, this can be difficult. In such a | ||||||
|  | case, the ``makemigrations.sh`` script takes advantaged of a docker | ||||||
|  | container that's slightly modified, and runs the makemigration action | ||||||
|  | on the files in your working directory. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | Running a dev instance in a VirtualEnv | ||||||
|  | -------------------------------------- | ||||||
| 
 | 
 | ||||||
| Not all things are lovely, so we use constraints to force the versions we | Not all things are lovely, so we use constraints to force the versions we | ||||||
| we wish for without having to do anything ugly.  This may require a newer | we wish for without having to do anything ugly.  This may require a newer | ||||||
|  | @ -54,6 +84,9 @@ with a python3 interpreter. | ||||||
| - ``source ./venv/bin/activate`` | - ``source ./venv/bin/activate`` | ||||||
| - ``pip install -c constraints.txt -r requirements.txt`` | - ``pip install -c constraints.txt -r requirements.txt`` | ||||||
| 
 | 
 | ||||||
|  | Once your dev instance is up and running | ||||||
|  | ---------------------------------------- | ||||||
|  | 
 | ||||||
| Pre-post-start configuration | Pre-post-start configuration | ||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
| 
 | 
 | ||||||
|  | @ -72,6 +105,9 @@ Shut down and now run: | ||||||
| 
 | 
 | ||||||
| Now you can run the system and see how it goes. | Now you can run the system and see how it goes. | ||||||
| 
 | 
 | ||||||
|  | Admin tasks | ||||||
|  | ----------- | ||||||
|  | 
 | ||||||
| Admin Credentials | Admin Credentials | ||||||
| ~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,10 +9,14 @@ docker container create --env-file docker/laptop-mode-env -p 28000:8000 --name s | ||||||
| docker container start symposion | docker container start symposion | ||||||
| docker exec symposion ./manage.py migrate | docker exec symposion ./manage.py migrate | ||||||
| docker exec symposion ./manage.py loaddata ./fixtures/*.json | docker exec symposion ./manage.py loaddata ./fixtures/*.json | ||||||
|  | docker exec symposion ./manage.py populate_inventory | ||||||
| docker exec symposion ./manage.py create_review_permissions | docker exec symposion ./manage.py create_review_permissions | ||||||
| docker exec -it symposion ./manage.py createsuperuser | docker exec -it symposion ./manage.py createsuperuser --username root --email root@example.com | ||||||
| 
 | 
 | ||||||
| ## The following sets up everything required for rego - tickets and | set +x | ||||||
| ## t-shirts and stuff. At this stage, it's not something we want. | echo "Now you can log into http://localhost:28000/admin" | ||||||
|  | echo "Username: root      Password: the one you just typed twice" | ||||||
|  | echo "If you need to test as a non-admin user, create one at" | ||||||
|  | echo "http://localhost:28000/admin/auth/user/add/ - then log out" | ||||||
|  | echo "and log back in at http://localhost:28000" | ||||||
| 
 | 
 | ||||||
| #docker exec symposion ./manage.py populate_inventory |  | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 James Polley
						James Polley