Backend service of Nyxordinal Notes.
A. Set Up
- Clone this repo and change directory to project folder
git clone https://github.com/nyxordinal/nyxordinal-online-notes.git && cd /nyxordinal-online-notes
- Install dependencies
composer install
- Copy .env.example to .env
cp .env.example .env
- Generate aplication key
php artisan key:generate
- Set your database credential in .env on key DB_*
- If you are in production, do not forget to set APP_ENV in .env to "production" and set APP_DEBUG to "false"
B. Run Dev Server
- Open terminal in your project folder
- Use below command in the terminal
php artisan serve
- Access development server in http://localhost:8000
- Create
notes
database in your RDMBS - Run migration
php artisan migrate
A. Publish Development Changes
- Do your changes
- Build notes-be docker image
docker build -t nyxordinal/notes-be:{tag} .
- Push docker image to nyxordinal registry
docker push nyxordinal/notes-be:{tag}
B. Deploy Docker Image (Production Server)
- Pull notes-be docker image
docker pull nyxordinal/notes-be:{tag}
- Create and start notes-be container
docker run -d -p {host-port}:8001 --name notes-be \
--env APP_NAME="Nyxordinal Online Notes API" \
--env APP_ENV=production \
--env APP_DEBUG=false \
--env APP_URL=http://localhost:8001 \
--env APP_TIMEZONE=UTC \
--env DB_CONNECTION=mysql \
--env DB_HOST={your-docker-host-ip} \
--env DB_PORT=3306 \
--env DB_DATABASE=notes \
--env DB_USERNAME={your-db-username} \
--env DB_PASSWORD={your-db-password} \
nyxordinal/notes-be:{tag}
- Access notes-be in http://localhost:{host-port}
NOTE: How to check your docker host IP, find out in this link
Or you can add--net="host"
indocker run
command and then for DB_HOST you can use"localhost"
.
If you use--net="host"
indocker run
command,-p {host-port}:8001
must be removed fromdocker run
command
Developed with passion by Nyxordinal