Giter VIP home page Giter VIP logo

ekmixon / awesomebits Goto Github PK

View Code? Open in Web Editor NEW

This project forked from awesomefoundation/awesomebits

0.0 1.0 0.0 16.87 MB

This is the source code for the Awesome Foundation website

Home Page: https://www.awesomefoundation.org/

License: GNU Affero General Public License v3.0

Ruby 45.23% CoffeeScript 2.12% JavaScript 17.78% CSS 3.02% HTML 11.63% PHP 0.97% Shell 0.02% Gherkin 4.35% Dockerfile 0.04% Hack 0.12% SCSS 14.72%

awesomebits's Introduction

Build Status

AwesomeBits

Configuration

Docker

To start developing this project quickly, feel free to use the docker-compose workflow. This will install a local Postgres database in a Docker container, and the Rails app in another container.

Installing the Docker runtime

Linux: Install the Native Docker Engine

If you're developing on a Linux system, follow these instructions to install Docker natively on your system. You will also need to install Docker Compose.

Mac or Windows: Install Docker Machine

If you're developing from a Mac or Windows machine, you will need to use Docker Machine to run the Docker engine in a Linux VM and proxy commands to it. You can install Docker Machine via the Docker Toolbox. The Docker toolbox will also install Docker Compose.

Once you have Docker Machine installed, you'll need to create a new machine for this project. Assuming you have Virtualbox installed, you'd run the following:

docker-machine create -d virtualbox awesomebits
eval $(docker-machine env awesomebits)

Starting the app with Docker Compose

Once you have the Docker engine and Docker Compose installed, you should be able to launch the app with the following command:

docker-compose up

If successful, your terminal should look something like this:

Docker Compose Up Success

Changes to the Dockerfile

If there are any changes made to the Dockerfile (for example, if the Ruby version changes), you will have rebuild the Docker container that runs the app. You will only have to do this once:

docker-compose up --build

Executing arbitary commands with Docker Compose

You can also run arbitrary commands within the Docker container. For example, to run rails console, do the following:

docker-compose run web rails console

Running Rails Console with Docker Compose

Environment Variables

In order to set environment variables (for example, to enable S3 in your development environment), create a file called .env in the main project directory. This file will look like this:

AWS_ACCESS_KEY_ID=XXX
AWS_SECRET_ACCESS_KEY=YYY
AWS_BUCKET=your-bucket-name

Subdomains

The site supports chapter subdomain redirects. When a wildcard DNS record is set up to point at the app, all traffic to subdomains other than www and the subdomain that is contained in the SUBDOMAIN environment variable will be redirected to the chapter page with that subdomain set as the chapter slug.

For example, nyc.awesomefoundation.org redirects to www.awesomefoundation.org/en/chapters/nyc

In order to prevent that redirect for other installations (such as staging environments), or for testing with a service like ngrok, set the SUBDOMAIN environment variable to the site's subdomain.

SUBDOMAIN=staging

Secret Token

When deploying to production, the SECRET_KEY_BASE environment variable must be set. This token only needs to be generated once and then stored in the environment variable, but it must be kept secret. This does not need to be set in development or test environments.

For a Heroku deployment, something like the following could be used:

$ heroku config:set SECRET_KEY_BASE=`rake secret`

Countries

Constant COUNTRY_PRIORITY used to define an array of priority countries. This used in the Chapter Form to create quick access to popular countries; also used in CountrySorter model for sorting the chapters.

Constant can be found in initializers file config/initializers/countries.rb

Localization

Much of the AwesomeBits interface has been localized. Localization files are stored in two places, depending on the type of content being localized:

  • Discrete srings and localizations are stored in config/locales/ directory with a separate file for each language
  • Partials with localized content are stored in the app/views/locales/ directory with the locale in the names of the file (i.e. _about_us.en.md)

Images

Images are resized dynamically via the Magickly gem. In order to display images properly, you must have a Magickly installation running and you must set the MAGICKLY_HOST environment variable to point to that host.

e.g. If you are running Magickly localy on port 8888, add the following line to your .env file:

MAGICKLY_HOST=http://localhost:8888

Blacklist

Very basic blacklisting is implemented using Rack::Attack. To blacklist an IP, simply add the IP address to the BLACKLIST_IPS environment variable. Multiple IPs should be comma separated:

BLACKLIST_IPS=10.0.0.1,10.0.0.2

Password Protection

There are instances where you want to put a password on the entire site (for example, a staging server which is on the public internet but should not be accessible to the general public). Set the SITE_PASSWORD environment variable to a password you want people to have to use to access the site. The user should then enter the SITE_PASSWORD text for both the username and password when prompted.

SITE_PASSWORD=topsecret

HTTPS

The site can be forced to redirect users to https pages by setting the FORCE_HTTPS environment variable. By doing this, all traffic to the www subdomain will be forced to https.

NOTE: We do not currently enforce HSTS in case there is a problem and we need to turn off https. This might change in the future.

FORCE_HTTPS=true

License

AwesomeBits is Copyright 2012-2021, Institute on Higher Awesome Studies

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

awesomebits's People

Contributors

abadzhevak8 avatar al3x avatar ariel-lindgren avatar arsduo avatar avicaplan avatar deadroxy avatar dependabot[bot] avatar dima-antonenko avatar divideby0 avatar harlow avatar ilya-konanykhin avatar jcn avatar jonpierce avatar jsteiner avatar mitcho avatar mjankowski avatar sother avatar tarraschk avatar tibbon avatar timhwang avatar

Watchers

 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.