calvh / mlh-final-project

MIT License
0 stars 2 forks source link

RPS

License Open
Issues Closed
Issues Open
PRs Closed
PRs

About

RPS is rock, paper, scissors built with Flask, and MongoDB on the backend, jQuery on the frontend, and SocketIO on frontend and backend. The app is designed to be run using Docker Compose.

Play it at https://rockpaperscissors.duckdns.org/

Description

To play anonymously:

1. Click the *Play Anonymously* Button
2. Click either *Play against CPU* or *Play against Human*
3. Click on your choice of Rock, Paper, or Scissors
4. Click the button *Play Again?* to start a new game

To play with an account:

1. Login to an existing account or Register a new account
2. Click either *Play against CPU* or *Play against Human*
3. Click on your choice of Rock, Paper, or Scissors
4. Click the button *Play Again?* to start a new game

Deploying on a webserver

Create .env files using the .env.example files as a template and set the variables accordingly. Most variables have the sensible default values but some need to be set explicitly:

```
# flask.env
SECRET_KEY

# mongo.env
MONGO_INITDB_ROOT_USERNAME
MONGO_INITDB_ROOT_PASSWORD
MONGO_DB

# nginx.env
CERTBOT_EMAIL
```

If you do not already have the SSL certificates in /etc/letsencrypt/, the Nginx container will automatically request them for you.

Run docker-compose up -d to start the app.

Testing on localhost

Create .env files using the .env.example files as a template and set the following variables:

```
# nginx.env
USE_LOCAL_CA=1
DHPARAM_SIZE=512
```

Here, DHPARAM_SIZE is set to a low number to reduce the amount of time it takes for the Nginx container to startup. In production, 2048 or larger is recommended.

Next, change the following specifications in docker-compose.yaml:

```
nginx:
    image: jonasal/nginx-certbot:dev
    volumes:
        - ./nginx/localhost_conf.d:/etc/nginx/user_conf.d
```

Run docker-compose up -d and navigate to https://localhost once the app has started up. Your browser will warn you of unrecognized certificates: this is normal because the test configuration generates self-signed certificates. Accept the warning in order to see the app.

AWS Config

instance details networking rules

Contributors