Skip to content

Commit

Permalink
Add Docker instructions and .env updates
Browse files Browse the repository at this point in the history
  • Loading branch information
samporapeli committed Sep 15, 2020
1 parent ccb351c commit 3214e93
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ENV.MD
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Create .env file at the root of the project with the following contents
# Create .env file at the root of the project with the following contents (notice that each value should be on their own line, so copy this file instead of copy-paste from GitHub's markdown view on browser)

MYSQL_USER=your-mysql-user
MYSQL_PASSWORD=your-mysql-password
MYSQL_DATABASE=ilmomasiina
MYSQL_HOST=localhost
# MYSQL in Docker container requires some root password, by default use a random one
MYSQL_RANDOM_ROOT_PASSWORD=true
ADMIN_REGISTRATION_ALLOWED=true

EDIT_TOKEN_SALT=randomly-generated-token
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,39 @@ Ilmomasiina is Athene's event registration system.
- npm `^5.6.0`
- MySQL `^8.0`

These are automatically installed when you use the Docker container.
## Using Docker container
In project root directory
```bash
docker-compose up
```
This should build and run the environment so that it is accesible at [localhost:3000](http://localhost:3000). You will need to create an `.env` file in project root (see [ENV.md](ENV.md)).

### Create fake data
Use `docker exec ilmomasiina_backend_1 npm run create-fake-data` to create some data to dockerized Ilmomasiina. The server does not like an empty database, so this is a really good idea to do when first starting the server.
## MYSQL Setup (Mac)

Only follow this if you don't use the Docker container.
1. Install `mysql` (8.x) with Homebrew (https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e)
2. Start the mysql service with `brew services start mysql`
3. Open the mysql terminal with `mysql -u root`
4. In the mysql terminal, create a new user e.g. `CREATE USER 'juuso'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';`
5. Type `exit` to exit the mysql terminal, and sign in with your new user e.g. `mysql -u juuso -p password`
6. Create the `ilmomasiina` database with `CREATE DATABASE ilmomasiina;`

## Getting started
### MYSQL Setup (Ubuntu)
Only follow this if you don't use the Docker container.
1. Install mysql with `sudo apt install mysql-server`
2. Service should start automatically
3. Same as with Mac, but use `sudo mysql -u root`
4. Follow Mac instructions
5. Fix permissions (this is probably too permissive, but it works): `GRANT ALL PRIVILEGES ON *.* TO 'sampo'@'localhost' WITH GRANT OPTION;`
6. Exit with `exit` and sign in with your new user e. g. `mysql -u juuso -p` (don't use `mysql -u juuso -p password`)
7. Follow Mac instructions step 6

1. Create an `.env` file at the root of the project. For the contents of the .env file, check `ENV.MD`
## Getting started
If you are using the Docker container, only follow step 1 as rest are automatically executed.
1. Create an `.env` file at the root of the project. For the contents of the .env file, check [ENV.MD](./ENV.MD)
2. `npm install`
3. `npm start`

Expand Down

0 comments on commit 3214e93

Please sign in to comment.