This is a docker-compose template for a lemp stack.
Make sure to change both the root password under the mysql service, and the absolute URI on the phpmyadmin container.
You can also expose phpMyAdmin locally instead of remotely by properly configuring the ports.
Default locations:
(Original) -> (Your server)
/var/www/html -> ./webroot
/etc/nginx -> ./nginx
| ########## Install NGINX ############## | |
| # Install software-properties-common package to give us add-apt-repository package | |
| sudo apt-get install -y software-properties-common | |
| # Install latest nginx version from community maintained ppa | |
| sudo add-apt-repository ppa:nginx/stable | |
| # Update packages after adding ppa |
| function iso7064Mod97_10(iban) { | |
| var remainder = iban, | |
| block; | |
| while (remainder.length > 2){ | |
| block = remainder.slice(0, 9); | |
| remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); | |
| } | |
| return parseInt(remainder, 10) % 97; |
apt-get install python-pip
pip install shadowsocks
sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start| # for development | |
| pm2 start npm --name "next" -- run dev | |
| # for production | |
| npm run build | |
| pm2 start npm --name "next" -- start | |
| "scripts": { | |
| "start": "node ./node_modules/.bin/pm2 start app.js -i max --attach" |
| #!/usr/bin/env node | |
| console.log('yay gist') |
When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).
When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.
Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.
So let's go through the one query that's worth memorizing to handle your eager loading.
Next.js, Nginx with Reverse proxy, SSL certificate
- UPDATE (07/20/2021):
- This process got simplified over the years of this gist being out
- Older version of this gist (without certbot): https://gist.github.com/kocisov/2a9567eb51b83dfef48efce02ef3ab06/33fdd88872a0801bdde58fccce430fa48737ae10
- I would also now recommend deploying to Vercel if you don't need custom server support
Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.
| { | |
| "apps": [{ | |
| "name": "Application", | |
| "exec_interpreter": "./node_modules/babel-cli/bin/babel-node.js", | |
| "script": "./bin/www", | |
| "args": [], | |
| "watch": ["public", "package.json", "pm2.development.json"], | |
| "ignore_watch": ["public"], | |
| "watch_options": { | |
| "persistent": true, |