GithubHelp home page GithubHelp logo

isabella232 / cloud-marketplace-prototype Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 18f/cloud-marketplace-prototype

0.0 0.0 0.0 574 KB

Prototype for the Cloud Marketplace.

License: Other

Shell 3.63% Python 82.68% JavaScript 1.60% CSS 0.32% HTML 11.78%

cloud-marketplace-prototype's Introduction

This is a prototype for the Cloud Marketplace.

Quick start

Install Docker, then run:

cp .env.sample .env
ln -sf docker-compose.local.yml docker-compose.override.yml
./docker-update.sh

docker-compose run app python manage.py seeddb

Then start everything up:

docker-compose up

You can now visit the site at http://localhost:8000/.

You can log in as [email protected] to access the site's administrative functionality.

Accessing the main app container

To access the main app container, run:

docker-compose run app bash

This will run an interactive bash session inside the main app container. In this container, the /cmp directory is mapped to the root of the repository on your host.

Running tests

We use pytest-django for tests. To run them, use:

docker-compose run app pytest

A note about manage.py

manage.py automatically attempts to run itself inside the app container if needed, so you can just run it with python manage.py on your Docker host. However, if you run into problems, you can use docker-compose run app manage.py instead.

Resetting the database

You can wipe the database and re-populate it with development data using the following command:

docker-compose run app python manage.py seeddb --reset

Updating the containers

Whenever you update your repository via e.g. git pull or git checkout, you should update your containers by running ./docker-update.sh.

Deploying to cloud environments

The Docker setup can also be used to deploy to cloud environments.

To do this, you'll first need to configure Docker Machine for the cloud, which involves provisioning a host on a cloud provider and setting up your local environment to make Docker's command-line tools use that host. For example, to do this on Amazon EC2, you might use:

docker-machine create aws16 --driver=amazonec2

Docker Machine's cloud drivers intentionally don't support folder sharing, which means that you can't just edit a file on your local system and see the changes instantly on the remote host. Instead, your app's source code is part of the container image. To facilitate this, you'll need to create a new Dockerfile that augments your existing one:

cat Dockerfile Dockerfile.cloud-extras > Dockerfile.cloud

Also, unlike local development, cloud deploys don't support an .env file. So you'll want to create a custom docker-compose.override.yml file that defines the app's environment variables, and also points to the alternate Dockerfile:

cp docker-compose.cloud.yml docker-compose.override.yml

You can edit this file to add or change environment variables as needed.

You'll also want to tell Docker Compose what port to listen on, which can be done in the terminal by running export DOCKER_EXPOSED_PORT=80.

At this point, you can use Docker's command-line tools and this project's Docker-related scripts, and your actions will take effect on the remote host instead of your local machine.

So, you should first run ./docker-update.sh to set everything up, followed by docker-compose up. Now you should have a server running in the cloud!

Note: A script, create-aws-instance.sh, actually automates all of this for you, but it's coupled to Amazon Web Services (AWS). You're welcome to use it directly or edit it to your own needs. Run it without any arguments for help.

Note: As mentioned earlier, your app's source code is part of the container image. This means that every time you make a source code change, you will need to re-run ./docker-update.sh.

cloud-marketplace-prototype's People

Contributors

toolness avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.