{"id":17274151,"url":"https://github.com/davidthorn/node-sequelize","last_synced_at":"2025-03-26T13:26:39.775Z","repository":{"id":122657931,"uuid":"165303974","full_name":"davidthorn/node-sequelize","owner":"davidthorn","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-12T17:19:36.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T14:47:45.781Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidthorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-11T20:15:09.000Z","updated_at":"2019-01-12T17:19:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"15d85d5a-7605-44ca-8944-03fe1838bb98","html_url":"https://github.com/davidthorn/node-sequelize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidthorn%2Fnode-sequelize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidthorn%2Fnode-sequelize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidthorn%2Fnode-sequelize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidthorn%2Fnode-sequelize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidthorn","download_url":"https://codeload.github.com/davidthorn/node-sequelize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245661475,"owners_count":20651873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T08:53:14.190Z","updated_at":"2025-03-26T13:26:39.751Z","avatar_url":"https://github.com/davidthorn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node \u0026 Sequelize\n\nThis project is about configure a Docker container which is linked to a mysql service running.\n\nwe will use `sequelize` npm package to manage the our databases.\n\nFirst we need to create the services so as to be able to use `sequelize`.\n\n# Create docker-compose.yml\n\n```bash\ntouch docker-compose.yml\n```\n\nDue to me not really knowing at this point how I am going to do this, I am referencing the docker documentation website about `docker compose`: \n\n[Overview of Docker Compose](https://docs.docker.com/compose/overview/)\n\n## Create a `mysql` service\n\n```yaml\nversion: '3'\nservices:\n  db:\n    container_name: db1               # the name of container\n    image: mysql                      # the name of the image which will be used to beuild the container\n    environment:\n    - MYSQL_ROOT_PASSWORD=12345678    # set the mysql root password here\n    volumes:\n    - /tmp/mysql:/var/lib/mysql       # create a volume so that the databases do not get reset upon every up command of docker compose\n```\n\n## Additional steps.\n\nAt this point it you will need to run the following command and add a database user which is `IDENTIFIED` with `mysql_native_password` otherwise the `node-mysql` will encounter a `AUTH_MODE` error.\n\n\u003e Run this command to start the mysql service\n\n```bash\ndocker-compose up -d\n```\n\nYou should see the following output:\n\n```bash\nStarting mysql ... done\n```\n\n## Create your database user\n\nTo enter the mysql container run the following command:\n\n```bash\ndocker exec -it mysql bash\n```\n\nNow your bash prompt should change to something like this: \n\n```bash\nroot@1a244c1608ad:/#\n```\n Run this command to add a 'node' user with the correct privileges to the database.\n\n ```bash\necho \"CREATE USER 'ADD_USERNAME_HERE'@'%' IDENTIFIED WITH mysql_native_password BY 'ADD_PASSWORD_HERE';\\\n      GRANT ALL PRIVILEGES on *.* TO 'ADD_USERNAME_HERE'@'%';\\\n      FLUSH PRIVILEGES;\\\n      \" \u003e user.sql\n\nmysql -p \u003c user.sql\n ```\n\n## Create node service\n\nTo talk to the mysql container through `http` lets add a `sequelize` service beneath the `db` service.\n\n```yaml\n\nversion: '3'\nservices:\n  \n  sequelize:\n    container_name: s1                    # the name of the node service\n    build: .                              # use docker file in this directory\n    ports:\n    - 3000:3000                           # link port 3000 on this machine to the port 3000 on the container\n    links:\n    - db                                  # link the db service to this container\n    volumes:\n    - /home/david/node-sequelize:/app     # create a volume so we look straight in the container\n```\n\n## Start services\n\nNow that we have configured the docker compose file we can start both the services.\n\n```bash\ndocker-compose up -d\n```\n\n\u003e You should see the following output\n\n```bash\nCreating network \"node-sequelize_default\" with the default driver\nCreating mysql ... done\nCreating s1    ... done\n``` \n\n## To be continued....\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidthorn%2Fnode-sequelize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidthorn%2Fnode-sequelize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidthorn%2Fnode-sequelize/lists"}