Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+docker-compose, update to the README #228

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 109 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,119 @@

![](icon.png)

# Traveller


## Setup

Create venv named venv inside root folder

Activate it


Install requirements.txt


```bash
$ python -m pip install -r requirements/reqs.txt
```

```text
Debug install (Linux only):

Run if install issues:
(cat requirements/reqs.txt; echo "") | grep "^[^#]" | xargs -L 1 pip install

May need to manually install an older version of Flask:
pip install Flask==2.2.2
```

We are using MySQL but you can have a stab at a different db.

Create a db named traveller or whatever you want in your MySQL db.
<details>
<summary>Setting up the database with docker-compose</summary>

**Note:** You may need to change the docker-compose.yml file is you have changed the username or password
of `instance/config.py`

```yaml

Install docker and docker-compose

```bash
sudo apt install docker.io
sudo apt install docker-compose
```

Adjust permissions for docker

```bash
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
```

Start docker service

```bash
sudo systemctl start docker
```

Ensure you are in the root directory of the project:

```text
traveller/ <- You are here
├── traveller/
│ requirements/
│ etc...
├── docker-compose.yml
```

Run docker-compose

```bash
docker-compose up -d
```

You can navigate to [http://localhost:8080](http://localhost:8080) to access phpmyadmin.

The default username and password are both `root`

The database can be accessed at `localhost:3306` providing you have not changed any defaults.

</details>


<details>
<summary>Setting up MySQL Database on Linux(if this is your first time with using MySQL database )</summary>

- Start MySQL database
- Start MySQL database

```bash
$ systemctl start mysql
```

(or)
(or)

```bash
$ service mysql start
```
- After starting MySQL database, login into the shell

- After starting MySQL database, login into the shell

```bash
$ mysql
```
- Create a database

- Create a database

```mysql
mysql > CREATE DATABASE traveller;
mysql >

CREATE DATABASE traveller;

```
- This will create the database in your local MySQL server, you can exit the Mysql shell and complete the remaining steps

- This will create the database in your local MySQL server, you can exit the Mysql shell and complete the remaining
steps

</details>

Change directory to the traveller folder
Expand All @@ -65,6 +134,7 @@ In instance/config.py set the __SQLALCHEMY_URI__. For MySQL it will be like this
```
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:root@localhost/traveller'
```

'mysql+pymysql://username:password@localhost/dbname'.

Create or edit traveller/config.json with the information needed for each environment.
Expand All @@ -73,35 +143,35 @@ for __development:__

```markdown
{
"environment": "development",
"admin_user": {
"email": "[email protected]",
"password": "pass"
},
"settings": {
"APP_NAME": "Demo",
"ACTIVE_FRONT_THEME": "blogus",
"ACTIVE_BACK_THEME": "boogle",
"CURRENCY": "MUR"
}
"environment": "development",
"admin_user": {
"email": "[email protected]",
"password": "pass"
},
"settings": {
"APP_NAME": "Demo",
"ACTIVE_FRONT_THEME": "blogus",
"ACTIVE_BACK_THEME": "boogle",
"CURRENCY": "MUR"
}
}
```

and for __production:__

```markdown
{
"environment": "production",
"admin_user": {
"email": "[email protected]",
"password": "pass"
},
"settings": {
"APP_NAME": "Demo",
"ACTIVE_FRONT_THEME": "blogus",
"ACTIVE_BACK_THEME": "boogle",
"CURRENCY": "MUR"
}
"environment": "production",
"admin_user": {
"email": "[email protected]",
"password": "pass"
},
"settings": {
"APP_NAME": "Demo",
"ACTIVE_FRONT_THEME": "blogus",
"ACTIVE_BACK_THEME": "boogle",
"CURRENCY": "MUR"
}
}
```

Expand All @@ -116,6 +186,7 @@ Then, to get development example data (make sure requirements in requirements/de
```bash
$ flask seed dev
```

Then

```bash
Expand All @@ -128,8 +199,8 @@ Migrations:
$ python manage.py db migrate
$ python manage.py db upgrade
```
More info can be found in the shopyo docs: [shopyo.readthedocs.io](https://shopyo.readthedocs.io/en/latest/)

More info can be found in the shopyo docs: [shopyo.readthedocs.io](https://shopyo.readthedocs.io/en/latest/)

## Setup Mail Dev Environment

Expand Down Expand Up @@ -163,12 +234,13 @@ class DevelopmentConfig(Config):
MAIL_PORT = 1025
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_USERNAME = '' # os.environ.get("MAIL_USERNAME")
MAIL_PASSWORD = '' # os.environ.get("MAIL_PASSWORD")
MAIL_DEFAULT_SENDER = '[email protected]' # os.environ.get("MAIL_DEFAULT_SENDER")
MAIL_USERNAME = '' # os.environ.get("MAIL_USERNAME")
MAIL_PASSWORD = '' # os.environ.get("MAIL_PASSWORD")
MAIL_DEFAULT_SENDER = '[email protected]' # os.environ.get("MAIL_DEFAULT_SENDER")
```

Go to [http://127.0.0.1:1080](http://127.0.0.1:1080) where it serves it’s web interface by default. See mails arrive in your inbox!
Go to [http://127.0.0.1:1080](http://127.0.0.1:1080) where it serves it’s web interface by default. See mails arrive in
your inbox!
Particularly useful when registering!

## Running tests
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Use root/example as user/password credentials
version: '3.1'

services:

db:
image: mariadb
restart: always
environment:
MARIADB_ROOT_PASSWORD: root
MARIADB_DATABASE: traveller
ports:
- "3306:3306"

adminer:
image: adminer
restart: always
ports:
- "8080:8080"
Loading