Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better dev env #37

Closed
stlim0730 opened this issue Jun 30, 2016 · 6 comments
Closed

Better dev env #37

stlim0730 opened this issue Jun 30, 2016 · 6 comments
Assignees

Comments

@stlim0730
Copy link
Owner

One of several shameful aspects of this project is that the development environment shares resources with the production environment. Not all of it, but one of the most critical parts, database. The two environments need to get separated.

This assignment includes:

  • Adjust Django settings.
  • Separate credentials used in this project. It includes 3rd party services such as Dropbox, CartoDB, etc. Also, find a good way to share & manage them within the team.
  • Set up vagrant (https://www.vagrantup.com/) for this project. The virtual machine should have all the capabilities required.
  • Update README.MD accordingly.

Waiting for a volunteer.

@sohyeonlee
Copy link
Collaborator

I can help! Even though I have never done setting up vm myself.

@stlim0730
Copy link
Owner Author

Great. I'll take the lead, then. Thank you for stepping up.

I think we may want to use the combination of vagrant and virtualbox, which has been proven.
Actually, I started the configuration this morning with the latest version (5.1) of virtualbox, which has been released TODAY, but the current version of vagrant doesn't officially support it. I found vagrant dev team started working on the support for it.

In the meantime, let's first finish up the existing branches and come back to this issue. This issue doesn't have the highest priority before the workshop on July 29.

@stlim0730
Copy link
Owner Author

Working on vagrant configurations.
Reference for managing multiple settings.py: https://code.djangoproject.com/wiki/SplitSettings

@stlim0730
Copy link
Owner Author

stlim0730 commented Feb 8, 2017

Been a while!

@karingoh, @nutelIa, (optional, but strongly recommended to @calo1), I'm giving you an assignment :) The goal of this assignment is to decide pass / nonpass my assignment. This assignment may take time if you have slow Internet connection, although it's not technically or intellectually challenging.

On your command line terminal, first go to your local project repo. If you have changes uncommitted (I guess not, though, because our dev team has had a long break), commit or stash them first (let me know if you need help in doing this). If you don't have the project repo on your computer, that's great. Good time to just clone it.

Once you have your local repo ready, make sure it's up-to-date on master branch.

$ git checkout master
$ git pull

Switch to vagrant branch I've been working on.

$ git checkout vagrant

Your repo will now have all the updates I've made on this branch.

Go to VirtualBox Downloads. VirtualBox is a free software that creates a virtual computer on your computer memory. We'll use the virtual computer for development environment. Download the latest binary installer for your OS and install it.

Go to Vagrant Downloads. Vagrant is a free automation software to set up a virtual computer and configure it as we want. We'll use it to configure our consistent but distributed development environment settings. Download the latest binary installer for your OS and install it. You may remove the installers downloaded once you've completed the installations.

Go back to your command line and run this in the project repo.

$ vagrant up

This command will automatically

  1. download a copy of Linux OS (Ubuntu 14.04) from the Internet; from my experience, this command may take less than 2 minutes or over 20 minutes depending on your internet connection. Be wise in doing this: I'd get my meal ready while it's being downloaded.
  2. setup a new Linux computer; after this, the virtual Linux computer will open it's own terminal window. We don't use it, so minimize the window. We keep it running behind-the-scene, because this window is a good indicator saying we have a virtual machine running.
  3. configure the Linux computer for our project; this command may take 5 minutes or more

following the options I defined.

In your terminal, you'll see tons of log messages. Some may look suspicious, but never mind. When it finishes and gives the control back to you, it's time to grade my assignment.

The virtual Linux computer is your own development server for this project; yes, we've wanted to separate it from the production server. Now you have your own, you turned it on using vagrant up command, so go ahead and test it.

Open http://localhost:8888 on your web browser. Click through the links and try everything you want. Again, everything is happening on your local copy of the server, so feel free to test everything without damaging the production server.

I won't say it's perfect. Your assignment is that you try all the features and give me your bug report; what's not working as expected. I tested it at the system level, but not at the feature level, so your report will be greatly helpful (@calo1, try to write fake blog posts on it!).

When you had enough, run this command on the terminal to turn off the virtual server.

$ vagrant destroy

I recommend you switch back to master branch or your own branch.

$ git checkout master

Let me know if you have any questions. Thanks!

@stlim0730
Copy link
Owner Author

stlim0730 commented Feb 10, 2017

Thanks to @karingoh's early note on Slack, I learned I can't get the pass decision for the assignment at my first attempt. She said she got internal server error when she tried. I think it's about Django migration. I give you a checklist for your inspection on your virtual Linux machine.

  • After running vagrant up, do you see two lines of ...done. at the end of log messages? This verifies that provision of vagrant worked fine. Let me know if you don't.
  • While vagrant is up, open http://localhost:8000, but not 8888 this time. Do you see nginx welcome page? This verifies that the Linux server is running on your virtual computer.
  • In other words, the server is running, but it doesn't serve the Django project properly. To go deeper, run vagrant ssh to connect to the virtual computer; you are now on the virtual computer as if it's a real one.
  • On the Linux computer (through ssh connection from your Mac / Windows), go to the project folder.
$ cd /farmview
  • Verify Django is installed. Do you see something like Django (1.9.7) when you run the command below? If you see other weird messages, let me know.
$ pip list|grep Django
  • Verify Django has correct database settings by running Django's automatized database migration. Do you see normal output messages when you run the commands below? If you see other weird messages, let me know.
$ python manage.py makemigrations
$ python magage.py migrate
  • After those commands, open the app running on your local virtual server http://localhost:8888.
  • When you're done, type exit to quit the ssh connection. Turn off the virtual machine and checkout master branch on the terminal as explained in the previous post.

Those steps will hopefully make your local copy of the server running, if my investigation was correct. Let me know how it goes. Thanks!

@stlim0730
Copy link
Owner Author

@calo1 and @karingoh had successfully test the guest machine. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants