README.md 4.05 KB
Newer Older
Tyler Williamson's avatar
Tyler Williamson committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
# Dirt Road Century  
This is the repo for https://dirtroadcentury.com  
The website is built using python3 with [Flask](https://www.palletsprojects.com/p/flask/), and uses the [UI kit Phantom,
 by Html5UP](https://html5up.net/phantom).  
  
### Wiki    
[Standard Deluxe Dirt Road Century: The Wiki](https://tylerwesleywilliamson.us/t0ps0il/dirt-road-century/-/wikis/Standard-Deluxe-Dirt-Road-Century:-The-Wiki)  

The wiki is incomplete, but will eventually document all the details of the project.  
  
*If something is documented in the wiki it should be considered current.*  
*If something in the README or contribution guide conflicts with the wiki, the wiki is right.*  
*THE WIKI IS THE SOURCE OF TRUTH*      

 ## Contributing  
   
[Please see the contributing guide](CONTRIBUTING.md)

## Development Setup
Clone the repo
`git clone https://tylerwesleywilliamson.us/t0ps0il/dirt-road-century.git`  
   
Create a virtual envirnment and install the requirements  
```
cd dirt-road-century  
virtualenv -p python3 venv  
source venv/bin/activate  
pip install -r requirements.txt  
```  
  
Set the following environment variables for the contact us page to work properly. If you don't mind emails and the slack
 messages not being sent this can be skipped.  

`SECRET_KEY` - The websites secret key  
`MAIL_SERVER` - Defaults to smtp.gmail.com  
`MAIL_PORT` - Defaults to 456  
`MAIL_USERNAME` - Username for whatever mail service you use  
`GMAIL_SECRET` - App specific password if using gmail account.  
`RECAPTCHA_PUBLIC_KEY` - Recaptcha's public key. Defaults to this website's public key.  
`RECAPTCHA_PRIVATE_KEY` - Private key for recaptcha  
`SLACK_URL` - Webhook endpoint for Slack. Needed if you want Contact Us messages to mirror to Slack. 
 
Run the project  
`python app.py`  
    
## Running with Docker  
Currently, I'm in the process of running the app via Docker.  
  
To build:  
```
tylerww@Sisyphus DirtRoadCentury % docker build -t terrafirma:latest .   
```   
 
Running from Docker:  
```
tylerww@Sisyphus DirtRoadCentury % docker run --name terrafirma -d -p 8000:5000 --rm terrafirma:latest
44d7017f056cc5bd0fb003f4063b4cb991134f45bfe3cbd83fd9174c2ec2f5ff
```  
    
This will run the docker image in the background, and will output a hash that identifies the docker container.
Environment variables can be included when running the docker image by appended the `-e` flag for each environment 
variable.    
EX:
  
```
tylerww@Sisyphus DirtRoadCentury % docker run --name terrafirma -d -p 8000:5000 --rm terrafirma:latest -e RECAPTCHA_PRIVATE_KEY="my_key"
44d7017f056cc5bd0fb003f4063b4cb991134f45bfe3cbd83fd9174c2ec2f5ff
```  

To stop the container from running, use:   
```
tylerww@Sisyphus DirtRoadCentury % docker stop 44d7017f056cc5bd0fb003f4063b4cb991134f45bfe3cbd83fd9174c2ec2f5ff
44d7017f056cc5bd0fb003f4063b4cb991134f45bfe3cbd83fd9174c2ec2f5ff
```

If you don't remember the container hash, you can list all docker containers with:  
```
tylerww@Sisyphus DirtRoadCentury % docker container list
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES
44d7017f056c        terrafirma:latest   "./run.sh"          2 minutes ago       Up 2 minutes        0.0.0.0:8000->5000/tcp   terrafirma
```

To run in the foreground remove the `-d` flag. Stop the container using `ctrl+c` if using the `-d` flag.  
   
  
## Production Details  
Currenlty, the website is built into a Docker image which is run on a [Digital Ocean](https://digitalocean.com) server running Ubuntu Server 18.04 LTS.   
[Gunicorn](https://gunicorn.org/) serves the application to the localhost on port 8000. Apache is set up to forward all requests coming into ports 80 and 443 to localhost:8000. HTTPS is made possible by [Let's Encrypt](https://letsencrypt.org/) and apache is configured to force https.  
  
#### Running in production  

Tyler Williamson's avatar
Tyler Williamson committed
92
Each commit to master gets automagically deployed to production. In the future, only tagged released will get deployed.
Tyler Williamson's avatar
Tyler Williamson committed
93 94 95
  

## TODO List  
96
See our [Issues page](https://tylerwesleywilliamson.us/t0ps0il/dirt-road-century/issues)