Code Monkey home page Code Monkey logo

cpjudge-webserver's Introduction

CP Judge Webserver

Database Setup

This section is only if you're not using docker to run the app. If you are using docker, follow the Docker setup section.

It looks like you chose to set up your application using a mysql database! Fantastic!

The first thing you need to do is open up the "database.yml" file and edit it to use the correct usernames, passwords, hosts, etc... that are appropriate for your environment.

You will also need to make sure that you start/install the database of your choice. Buffalo won't install and start mysql for you.

Create Your Databases

Ok, so you've edited the "database.yml" file and started mysql, now Buffalo can create the databases in that file for you:

$ buffalo db create -a

Starting the Application

Buffalo ships with a command that will watch your application and automatically rebuild the Go binary and any assets for you. To do that run the "buffalo dev" command:

$ buffalo dev

If you point your browser to http://127.0.0.1:3000 you should see a "Welcome to Buffalo!" page.

Congratulations! You now have your Buffalo application up and running.

Docker setup

To run the application using docker, you need to have the following installed:

We have used two services in our docker-compose file - db and app.

The db service is for the database, which in our case is mysql v5.7. It has the /var/lib/mysql directory mounted as a docker volume to have persistent database between containers.

The app service is for the Buffalo web application. It has current directory mounted as a volume.

Starting the Containers

To start the containers, run the following command from the root directory of this project:

$ docker-compose up -d

-d flag is used to run the containers in detached mode (background)

After that, to connect to the container and open a terminal, run:

$ docker-compose exec app bash

You are now inside the container with access to its terminal.

Starting the Application

Make sure all dependencies are installed by using "dep":

$ dep ensure

Create the databases by running the following command:

$ buffalo db create -a

Then, run the app by using the buffalo command line utility:

$ buffalo dev run

If you point your browser to http://127.0.0.1:3000 you should see a "Welcome to Buffalo!" page.

To stop the containers, you can run the command:

$ docker-compose down

cpjudge-webserver's People

Contributors

pvgupta24 avatar mahim23 avatar saurabhagarwala avatar

Watchers

James Cloos 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.